WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 17/16] xenpaging: notify policy only on resume

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 17/16] xenpaging: notify policy only on resume
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Wed, 3 Nov 2010 20:24:13 +0100
Delivery-date: Wed, 03 Nov 2010 12:24:57 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1288812256; l=1955; s=domk; d=aepfle.de; h=In-Reply-To:Content-Type:MIME-Version:References:Subject:To:From: Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=Ow7ekcilH1bGQsyT4vlUEcXpCPs=; b=ukg56zL5KRkar/SU6OA6bEM0znpM63P3kCu2di8pZuKnlpBuLuEmzVfdbxBN+/WQUNG oKo0rV9rB8YjBcgV33YkfQMvN5R64F0i9num1Xzz+mlv99uxeGUD6aa+7D8YleAYhz+5U 8D3bxl4b7WbbAzmP7Axz2TOW7Hf2bqwqkwo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101102223010.603002116@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20101102223010.603002116@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
If a page is requested more than once, the policy is also notified more
than once about the page-in. However, a page-in happens only once. Any
further resume will only unpause the other vcpu. The multiple notify
will put the page into the mru list multiple times and it will unlock
other already resumed pages too early. In the worst case, a page that
was just resumed can be evicted right away, causing a deadlock in the
guest.  

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

---
This happend since some time already, today I found the cause.

 tools/xenpaging/xenpaging.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- xen-unstable.hg-4.1.22353.orig/tools/xenpaging/xenpaging.c
+++ xen-unstable.hg-4.1.22353/tools/xenpaging/xenpaging.c
@@ -382,7 +382,7 @@ int xenpaging_evict_page(xc_interface *x
     return ret;
 }
 
-static int xenpaging_resume_page(xenpaging_t *paging, mem_event_response_t 
*rsp)
+static int xenpaging_resume_page(xenpaging_t *paging, mem_event_response_t 
*rsp, int notify_policy)
 {
     int ret;
 
@@ -392,7 +392,8 @@ static int xenpaging_resume_page(xenpagi
         goto out;
 
     /* Notify policy of page being paged in */
-    policy_notify_paged_in(paging->mem_event.domain_id, rsp->gfn);
+    if ( notify_policy )
+        policy_notify_paged_in(paging->mem_event.domain_id, rsp->gfn);
 
     /* Tell Xen page is ready */
     ret = xc_mem_paging_resume(paging->xc_handle, paging->mem_event.domain_id,
@@ -626,7 +627,7 @@ int main(int argc, char *argv[])
                 rsp.vcpu_id = req.vcpu_id;
                 rsp.flags = req.flags;
 
-                rc = xenpaging_resume_page(paging, &rsp);
+                rc = xenpaging_resume_page(paging, &rsp, 1);
                 if ( rc != 0 )
                 {
                     ERROR("Error resuming page");
@@ -655,7 +656,7 @@ int main(int argc, char *argv[])
                     rsp.vcpu_id = req.vcpu_id;
                     rsp.flags = req.flags;
 
-                    rc = xenpaging_resume_page(paging, &rsp);
+                    rc = xenpaging_resume_page(paging, &rsp, 0);
                     if ( rc != 0 )
                     {
                         ERROR("Error resuming");

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