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] grant-tables: do not fail attempts to GNTTABOP_set_v

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] grant-tables: do not fail attempts to GNTTABOP_set_version to the current version
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 03 Dec 2009 10:22:44 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 03 Dec 2009 02:27:04 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1259835732 0
# Node ID 2c88f78095f90c9c2e3e5149afadecb50c29c6b3
# Parent  aa0b5558564f882903ca1c84948bc2a3619d9f73
grant-tables: do not fail attempts to GNTTABOP_set_version to the current 
version.
even if theiur are active grants.

This triggers when checkpoint a guest which essentially resumes
without actually having gone through the suspend so the domain is
already latched to v2 inside Xen.

Also return the current actual version on success and failure. Not
terribly useful with only 2 options but is more robust to future
developments.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Cc: Brendan Cully <brendan@xxxxxxxxxx>
Cc: Steven Smith <Steven.Smith@xxxxxxxxxxxxx>

diff -r aa0b5558564f -r 2c88f78095f9 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Wed Dec 02 18:46:14 2009 +0000
+++ b/xen/common/grant_table.c  Thu Dec 03 10:22:12 2009 +0000
@@ -1972,14 +1972,19 @@
     struct domain *d = current->domain;
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act;
-    long res = 0;
+    long res;
     int i;
 
     if (copy_from_guest(&op, uop, 1))
         return -EFAULT;
 
+    res = -EINVAL;
     if (op.version != 1 && op.version != 2)
-        return -EINVAL;
+        goto out;
+
+    res = 0;
+    if ( gt->gt_version == op.version )
+        goto out;
 
     spin_lock(&gt->lock);
     /* Make sure that the grant table isn't currently in use when we
@@ -1997,7 +2002,7 @@
                          gt->gt_version,
                          op.version);
                 res = -EBUSY;
-                goto out;
+                goto out_unlock;
             }
         }
     }
@@ -2009,7 +2014,7 @@
     {
         res = gnttab_populate_status_frames(d, gt);
         if ( res < 0)
-            goto out;
+            goto out_unlock;
     }
 
     if ( op.version < 2 && gt->gt_version == 2 )
@@ -2025,8 +2030,14 @@
 
     gt->gt_version = op.version;
 
+out_unlock:
+    spin_unlock(&gt->lock);
+
 out:
-    spin_unlock(&gt->lock);
+    op.version = gt->gt_version;
+
+    if (copy_to_guest(uop, &op, 1))
+        res = -EFAULT;
 
     return res;
 }
diff -r aa0b5558564f -r 2c88f78095f9 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h  Wed Dec 02 18:46:14 2009 +0000
+++ b/xen/include/public/grant_table.h  Thu Dec 03 10:22:12 2009 +0000
@@ -463,7 +463,7 @@
  */
 #define GNTTABOP_set_version          8
 struct gnttab_set_version {
-    /* IN parameters */
+    /* IN/OUT parameters */
     uint32_t version;
 };
 typedef struct gnttab_set_version gnttab_set_version_t;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] grant-tables: do not fail attempts to GNTTABOP_set_version to the current version, Ian Campbell <=