xen/xenpaging.policy_linear.patch
Charles Arnold 08a77ed8c4 - fate#310510 - fix xenpaging
xenpaging.tools_xenpaging_cleanup.patch

- fate#310510 - fix xenpaging
  xenpaging.mem_event_check_ring-free_requests.patch

- install /etc/xen/examples/xentrace_formats.txt to get human readable
  tracedata if xenalyze is not used

- fate#310510 - fix xenpaging
  xenpaging.autostart_delay.patch
  xenpaging.blacklist.patch
  xenpaging.MRU_SIZE.patch
  remove xenpaging.hacks.patch, realmode works

- Upstream patches from Jan including fixes for the following bugs
  bnc#583568 - Xen kernel is not booting
  bnc#615206 - Xen kernel fails to boot with IO-APIC problem
  bnc#640773 - Xen kernel crashing right after grub
  bnc#643477 - issues with PCI hotplug/hotunplug to Xen driver domain
  22223-vtd-igd-workaround.patch
  22222-x86-timer-extint.patch
  22214-x86-msr-misc-enable.patch
  22213-x86-xsave-cpuid-check.patch
  22194-tmem-check-pv-mfn.patch
  22177-i386-irq-safe-map_domain_page.patch
  22175-x86-irq-enter-exit.patch
  22174-x86-pmtimer-accuracy.patch
  22160-Intel-C6-EOI.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=76
2010-10-20 21:00:35 +00:00

123 lines
3.8 KiB
Diff

Subject: xenpaging: break endless loop during inital page-out with large pagefiles
To allow the starting for xenpaging right after 'xm start XYZ', I
specified a pagefile size equal to the guest memory size in the hope to
catch more errors where the paged-out state of a p2mt is not checked.
While doing that, xenpaging got into an endless loop because some pages
cant be paged out right away. Now the policy reports an error if the gfn
number wraps.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Already-Acked-by: Patrick Colp <pjcolp@cs.ubc.ca>
Already-Acked-by: Keir Fraser <keir.fraser@citrix.com>
---
tools/xenpaging/policy_default.c | 35 ++++++++++++++++++++++++++++-------
tools/xenpaging/xenpaging.c | 7 +++++--
2 files changed, 33 insertions(+), 9 deletions(-)
--- xen-4.0.1-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.0.1-testing/tools/xenpaging/policy_default.c
@@ -30,8 +30,12 @@
static unsigned long mru[MRU_SIZE];
-static unsigned int i_mru = 0;
+static unsigned int i_mru;
static unsigned long *bitmap;
+static unsigned long *unconsumed;
+static unsigned long current_gfn;
+static unsigned long bitmap_size;
+static unsigned long max_pages;
int policy_init(xenpaging_t *paging)
@@ -43,6 +47,14 @@ int policy_init(xenpaging_t *paging)
rc = alloc_bitmap(&bitmap, paging->bitmap_size);
if ( rc != 0 )
goto out;
+ /* Allocate bitmap to track unusable pages */
+ rc = alloc_bitmap(&unconsumed, paging->bitmap_size);
+ if ( rc != 0 )
+ goto out;
+
+ /* record bitmap_size */
+ bitmap_size = paging->bitmap_size;
+ max_pages = paging->domain_info->max_pages;
/* Initialise MRU list of paged in pages */
for ( i = 0; i < MRU_SIZE; i++ )
@@ -51,8 +63,6 @@ int policy_init(xenpaging_t *paging)
/* Don't page out page 0 */
set_bit(0, bitmap);
- rc = 0;
-
out:
return rc;
}
@@ -60,17 +70,27 @@ int policy_init(xenpaging_t *paging)
int policy_choose_victim(xenpaging_t *paging, domid_t domain_id,
xenpaging_victim_t *victim)
{
+ unsigned long wrap = current_gfn;
ASSERT(victim != NULL);
/* Domain to pick on */
victim->domain_id = domain_id;
-
+
do
{
- /* Randomly choose a gfn to evict */
- victim->gfn = rand() % paging->domain_info->max_pages;
+ current_gfn++;
+ if ( current_gfn >= max_pages )
+ current_gfn = 0;
+ if ( wrap == current_gfn )
+ {
+ victim->gfn = INVALID_MFN;
+ return -ENOSPC;
+ }
}
- while ( test_bit(victim->gfn, bitmap) );
+ while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) );
+
+ set_bit(current_gfn, unconsumed);
+ victim->gfn = current_gfn;
return 0;
}
@@ -78,6 +98,7 @@ int policy_choose_victim(xenpaging_t *pa
void policy_notify_paged_out(domid_t domain_id, unsigned long gfn)
{
set_bit(gfn, bitmap);
+ clear_bit(gfn, unconsumed);
}
void policy_notify_paged_in(domid_t domain_id, unsigned long gfn)
--- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c
@@ -440,7 +440,8 @@ static int evict_victim(xenpaging_t *pag
ret = policy_choose_victim(paging, domain_id, victim);
if ( ret != 0 )
{
- ERROR("Error choosing victim");
+ if ( ret != -ENOSPC )
+ ERROR("Error choosing victim");
goto out;
}
@@ -518,7 +519,9 @@ int main(int argc, char *argv[])
memset(victims, 0, sizeof(xenpaging_victim_t) * num_pages);
for ( i = 0; i < num_pages; i++ )
{
- evict_victim(paging, domain_id, &victims[i], fd, i);
+ rc = evict_victim(paging, domain_id, &victims[i], fd, i);
+ if ( rc == -ENOSPC )
+ break;
if ( i % 100 == 0 )
DPRINTF("%d pages evicted\n", i);
}