[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4 of 5] xenpaging: restore p2mt if gfn is needed before evict


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Tue, 06 Dec 2011 18:07:05 +0100
  • Delivery-date: Tue, 06 Dec 2011 17:08:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1323189150 -3600
# Node ID 4e52b9c9309815a4b05c7b970a95e318d59fb71b
# Parent  7f2cfd9bd113c40a49cc7e036fd07eb706a22f15
xenpaging: restore p2mt if gfn is needed before evict

In the rare case that a gfn is needed by a guest or a foreign domain
between nominate and evict, restore the p2mt and skip sending a request.
A request is not needed because the pager will notice the evict failure.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r 7f2cfd9bd113 -r 4e52b9c93098 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -905,6 +905,7 @@ void p2m_mem_paging_populate(struct doma
     p2m_type_t p2mt;
     p2m_access_t a;
     mfn_t mfn;
+    int restored = 0;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     /* Check that there's space on the ring for this request */
@@ -920,22 +921,25 @@ void p2m_mem_paging_populate(struct doma
     /* Allow only nominated or evicted pages to enter page-in path */
     if ( p2m_do_populate(p2mt) )
     {
-        /* Evict will fail now, tag this request for pager */
-        if ( p2mt == p2m_ram_paging_out )
-            req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
-
-        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in_start, 
a);
+        /* Restore page state if gfn was requested before evict */
+        if ( p2mt == p2m_ram_paging_out && mfn_valid(mfn) ) {
+            set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K,
+                          paging_mode_log_dirty(d) ? p2m_ram_logdirty : 
p2m_ram_rw, a);
+            restored = 1;
+        } else {
+            set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, 
p2m_ram_paging_in_start, a);
+        }
     }
     p2m_unlock(p2m);
 
     /* Pause domain if request came from guest and gfn has paging type */
-    if (  p2m_is_paging(p2mt) && v->domain == d )
+    if ( !restored && p2m_is_paging(p2mt) && v->domain == d )
     {
         vcpu_pause_nosync(v);
         req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
     }
     /* No need to inform pager if the gfn is not in the page-out path */
-    else if ( !p2m_do_populate(p2mt) )
+    else if ( restored || !p2m_do_populate(p2mt) )
     {
         /* gfn is already on its way back and vcpu is not paused */
         mem_event_put_req_producers(&d->mem_event->paging);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.