Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:Maintenance:114
xen.openSUSE_Evergreen_11.4
25754-x86-PoD-early-access.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 25754-x86-PoD-early-access.patch of Package xen.openSUSE_Evergreen_11.4
References: bnc#771099 # HG changeset patch # User Jan Beulich <jbeulich@suse.com> # Date 1345104851 -7200 # Node ID be8ae5439a884a48f1287989232e379c5985cf00 # Parent 6d56e31fe1e1dc793379d662a36ff1731760eb0c x86/PoD: prevent guest from being destroyed upon early access to its memory When an external agent (e.g. a monitoring daemon) happens to access the memory of a PoD guest prior to setting the PoD target, that access must fail for there not being any page in the PoD cache, and only the space above the low 2Mb gets scanned for victim pages (while only the low 2Mb got real pages populated so far). To accomodate for this - set the PoD target first - do all physmap population in PoD mode (i.e. not just large [2Mb or 1Gb] pages) - slightly lift the restrictions enforced by p2m_pod_set_mem_target() to accomodate for the changed tools behavior Tested-by: Jürgen Groß <juergen.gross@ts.fujitsu.com> (in a 4.0.x based incarnation) Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> --- xen-4.0.3-testing/tools/libxc/xc_hvm_build.c.orig 2012-11-21 19:58:54.641491891 +0100 +++ xen-4.0.3-testing/tools/libxc/xc_hvm_build.c 2012-11-21 19:58:58.701315332 +0100 @@ -124,7 +124,7 @@ goto error_out; if ( memsize > target ) - pod_mode = 1; + pod_mode = XENMEMF_populate_on_demand; memset(&elf, 0, sizeof(elf)); if ( elf_init(&elf, image, image_size) != 0 ) @@ -164,13 +164,32 @@ for ( i = HVM_BELOW_4G_RAM_END >> PAGE_SHIFT; i < nr_pages; i++ ) page_array[i] += HVM_BELOW_4G_MMIO_LENGTH >> PAGE_SHIFT; + if ( pod_mode ) + { + /* + * Subtract 0x20 from target_pages for the VGA "hole". Xen will + * adjust the PoD cache size so that domain tot_pages will be + * target_pages - 0x20 after this call. + */ + + rc = xc_domain_memory_set_pod_target(xc_handle, + dom, + target_pages - 0x20, + NULL, NULL, NULL); + if ( rc != 0 ) + { + PERROR("Could not set PoD target for HVM guest.\n"); + goto error_out; + } + } + /* * Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. * We allocate pages in batches of no more than 8MB to ensure that * we can be preempted and hence dom0 remains responsive. */ rc = xc_domain_memory_populate_physmap( - xc_handle, dom, 0xa0, 0, 0, &page_array[0x00]); + xc_handle, dom, 0xa0, 0, pod_mode, &page_array[0x00]); cur_pages = 0xc0; while ( (rc == 0) && (nr_pages > cur_pages) ) { @@ -217,19 +236,11 @@ if ( count != 0 ) { rc = xc_domain_memory_populate_physmap( - xc_handle, dom, count, 0, 0, &page_array[cur_pages]); + xc_handle, dom, count, 0, pod_mode, &page_array[cur_pages]); cur_pages += count; } } - /* Subtract 0x20 from target_pages for the VGA "hole". Xen will - * adjust the PoD cache size so that domain tot_pages will be - * target_pages - 0x20 after this call. */ - if ( pod_mode ) - rc = xc_domain_memory_set_pod_target(xc_handle, - dom, - target_pages - 0x20, - NULL, NULL, NULL); if ( rc != 0 ) { --- xen-4.0.3-testing/xen/arch/x86/mm/p2m.c.orig 2012-11-21 19:04:40.556884355 +0100 +++ xen-4.0.3-testing/xen/arch/x86/mm/p2m.c 2012-11-21 19:15:05.706733878 +0100 @@ -525,8 +525,9 @@ p2m_lock(p2md); - /* P == B: Nothing to do. */ - if ( p2md->pod.entry_count == 0 ) + /* P == B: Nothing to do (unless the guest is being created). */ + populated = d->tot_pages - p2md->pod.count; + if ( populated > 0 && p2md->pod.entry_count == 0 ) goto out; /* Don't do anything if the domain is being torn down */ @@ -538,13 +539,11 @@ if ( target < d->tot_pages ) goto out; - populated = d->tot_pages - p2md->pod.count; - pod_target = target - populated; /* B < T': Set the cache size equal to # of outstanding entries, * let the balloon driver fill in the rest. */ - if ( pod_target > p2md->pod.entry_count ) + if ( populated > 0 && pod_target > p2md->pod.entry_count ) pod_target = p2md->pod.entry_count; ASSERT( pod_target >= p2md->pod.count );
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor