xen/xenpaging.paging_prep_enomem.patch
Charles Arnold 9a05aa7fc4 - bnc#658704 - SLES11 SP1 Xen boot panic in x2apic mode
22707-x2apic-preenabled-check.patch
- bnc#641419 - L3: Xen: qemu-dm reports "xc_map_foreign_batch: mmap failed:
  Cannot allocate memory"
  7434-qemu-rlimit-as.patch
- Additional or upstream patches from Jan
  22693-fam10-mmio-conf-base-protect.patch
  22694-x86_64-no-weak.patch
  22708-xenctx-misc.patch
  21432-4.0-cpu-boot-failure.patch
  22645-amd-flush-filter.patch
  qemu-fix-7433.patch

- Maintain compatibility with the extid flag even though it is
  deprecated for both legacy and sxp config files.
  hv_extid_compatibility.patch 

- bnc#649209-improve suspend eventchn lock
  suspend_evtchn_lock.patch

- Removed the hyper-v shim patches in favor of using the upstream 
  version. 

- bnc#641419 - L3: Xen: qemu-dm reports "xc_map_foreign_batch: mmap
  failed: Cannot allocate memory" 
  qemu-rlimit-as.patch

- Upstream c/s 7433 to replace qemu_altgr_more.patch
  7433-qemu-altgr.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=90
2011-01-14 18:24:51 +00:00

78 lines
2.5 KiB
Diff

Subject: xenpaging: handle temporary out-of-memory conditions during page-in
p2m_mem_paging_prep() should return -ENOMEM if a new page could not be
allocated. This can be handled in xenpaging to retry the page-in. Right
now such condition would stall the guest because the requested page will
not come back, xenpaging simply exits. So xenpaging could very well
retry the allocation forever to rescue the guest.
(xen-unstable changeset: 22446:08158f001f19)
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/xenpaging/xenpaging.c | 27 ++++++++++++++++++++-------
xen/arch/x86/mm/p2m.c | 2 +-
2 files changed, 21 insertions(+), 8 deletions(-)
--- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c
@@ -23,6 +23,7 @@
#include <inttypes.h>
#include <stdlib.h>
#include <signal.h>
+#include <unistd.h>
#include <xc_private.h>
#include <xen/mem_event.h>
@@ -409,19 +410,31 @@ static int xenpaging_populate_page(
unsigned long _gfn;
void *page;
int ret;
+ unsigned char oom = 0;
- /* Tell Xen to allocate a page for the domain */
- ret = xc_mem_paging_prep(paging->xc_handle, paging->mem_event.domain_id,
- *gfn);
- if ( ret != 0 )
+ _gfn = *gfn;
+ do
{
- ERROR("Error preparing for page in");
- goto out_map;
+ /* Tell Xen to allocate a page for the domain */
+ ret = xc_mem_paging_prep(paging->xc_handle, paging->mem_event.domain_id,
+ _gfn);
+ if ( ret != 0 )
+ {
+ if ( errno == ENOMEM )
+ {
+ if ( oom++ == 0 )
+ DPRINTF("ENOMEM while preparing gfn %lx\n", _gfn);
+ sleep(1);
+ continue;
+ }
+ ERROR("Error preparing for page in");
+ goto out_map;
+ }
}
+ while ( ret && !interrupted );
/* Map page */
ret = -EFAULT;
- _gfn = *gfn;
page = xc_map_foreign_pages(paging->xc_handle, paging->mem_event.domain_id,
PROT_READ | PROT_WRITE, &_gfn, 1);
*gfn = _gfn;
--- xen-4.0.1-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.0.1-testing/xen/arch/x86/mm/p2m.c
@@ -2611,7 +2611,7 @@ int p2m_mem_paging_prep(struct domain *d
/* Get a free page */
page = alloc_domheap_page(d, 0);
if ( unlikely(page == NULL) )
- return -EINVAL;
+ return -ENOMEM;
/* Fix p2m mapping */
p2m_lock(d->arch.p2m);