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-changelog

[Xen-changelog] [xen-unstable] Minor clean ups to shadow logdirty peek /

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Minor clean ups to shadow logdirty peek / clean.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Dec 2006 14:20:27 -0800
Delivery-date: Fri, 29 Dec 2006 14:57:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Steven Hand <steven@xxxxxxxxxxxxx>
# Date 1167402303 0
# Node ID 25723963a6b639a0651b961c40808be63cb2c27b
# Parent  a8b2738a6f7ff22022e0b49e14c3142409f8681a
Minor clean ups to shadow logdirty peek / clean.

Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/common.c |   52 ++++++++++++++++++++++------------------
 1 files changed, 29 insertions(+), 23 deletions(-)

diff -r a8b2738a6f7f -r 25723963a6b6 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Fri Dec 29 14:12:55 2006 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Fri Dec 29 14:25:03 2006 +0000
@@ -3123,7 +3123,7 @@ static int shadow_log_dirty_op(
 static int shadow_log_dirty_op(
     struct domain *d, struct xen_domctl_shadow_op *sc)
 {
-    int i, rv = 0, clean = 0;
+    int i, rv = 0, clean = 0, peek = 1;
 
     domain_pause(d);
     shadow_lock(d);
@@ -3137,12 +3137,12 @@ static int shadow_log_dirty_op(
                   d->arch.shadow.dirty_count);
 
     sc->stats.fault_count = d->arch.shadow.fault_count;
-    sc->stats.dirty_count = d->arch.shadow.dirty_count;    
-        
-    if ( clean ) 
-    {
-        /* Need to revoke write access to the domain's pages again. 
-         * In future, we'll have a less heavy-handed approach to this, 
+    sc->stats.dirty_count = d->arch.shadow.dirty_count;
+
+    if ( clean )
+    {
+        /* Need to revoke write access to the domain's pages again.
+         * In future, we'll have a less heavy-handed approach to this,
          * but for now, we just unshadow everything except Xen. */
         shadow_blow_tables(d);
 
@@ -3150,31 +3150,37 @@ static int shadow_log_dirty_op(
         d->arch.shadow.dirty_count = 0;
     }
 
-    if ( guest_handle_is_null(sc->dirty_bitmap) ||
-         (d->arch.shadow.dirty_bitmap == NULL) )
-    {
-        rv = -EINVAL;
+    if ( guest_handle_is_null(sc->dirty_bitmap) )
+        /* caller may have wanted just to clean the state or access stats. */
+        peek = 0;
+
+    if ( (peek || clean) && (d->arch.shadow.dirty_bitmap == NULL) )
+    {
+        rv = -EINVAL; /* perhaps should be ENOMEM? */
         goto out;
     }
  
     if ( sc->pages > d->arch.shadow.dirty_bitmap_size )
-        sc->pages = d->arch.shadow.dirty_bitmap_size; 
+        sc->pages = d->arch.shadow.dirty_bitmap_size;
 
 #define CHUNK (8*1024) /* Transfer and clear in 1kB chunks for L1 cache. */
     for ( i = 0; i < sc->pages; i += CHUNK )
     {
-        int bytes = ((((sc->pages - i) > CHUNK) 
-                      ? CHUNK 
+        int bytes = ((((sc->pages - i) > CHUNK)
+                      ? CHUNK
                       : (sc->pages - i)) + 7) / 8;
-     
-        if ( copy_to_guest_offset(
-                 sc->dirty_bitmap, 
-                 i/(8*sizeof(unsigned long)),
-                 d->arch.shadow.dirty_bitmap + (i/(8*sizeof(unsigned long))),
-                 (bytes + sizeof(unsigned long) - 1) / sizeof(unsigned long)) )
-        {
-            rv = -EINVAL;
-            goto out;
+
+        if ( likely(peek) )
+        {
+            if ( copy_to_guest_offset(
+                     sc->dirty_bitmap,
+                     i/(8*sizeof(unsigned long)),
+                     d->arch.shadow.dirty_bitmap+(i/(8*sizeof(unsigned long))),
+                     (bytes+sizeof(unsigned long)-1) / sizeof(unsigned long)) )
+            {
+                    rv = -EFAULT;
+                    goto out;
+            }
         }
 
         if ( clean )

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Minor clean ups to shadow logdirty peek / clean., Xen patchbot-unstable <=