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] libxc: add xc_domain_memory_exchange_page

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Oct 2010 06:50:22 -0700
Delivery-date: Wed, 20 Oct 2010 06:53:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1287418447 -3600
# Node ID 835b06768104fbd54c5e1ab4fbd06c690fa7a39a
# Parent  5ec79c06b18a4d26d93faf74f39e8dc8d1d1800a
libxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange

Generalised from exchange_page in xc_offline_page.c

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_domain.c       |   31 +++++++++++++++++++++++++++++++
 tools/libxc/xc_offline_page.c |   33 +++------------------------------
 tools/libxc/xenctrl.h         |    9 +++++++++
 3 files changed, 43 insertions(+), 30 deletions(-)

diff -r 5ec79c06b18a -r 835b06768104 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Mon Oct 18 16:54:42 2010 +0100
+++ b/tools/libxc/xc_domain.c   Mon Oct 18 17:14:07 2010 +0100
@@ -728,6 +728,37 @@ int xc_domain_populate_physmap_exact(xc_
     return err;
 }
 
+int xc_domain_memory_exchange_pages(xc_interface *xch,
+                                    int domid,
+                                    unsigned long nr_in_extents,
+                                    unsigned int in_order,
+                                    xen_pfn_t *in_extents,
+                                    unsigned long nr_out_extents,
+                                    unsigned int out_order,
+                                    xen_pfn_t *out_extents)
+{
+    int rc;
+
+    struct xen_memory_exchange exchange = {
+        .in = {
+            .nr_extents   = nr_in_extents,
+            .extent_order = in_order,
+            .domid        = domid
+        },
+        .out = {
+            .nr_extents   = nr_out_extents,
+            .extent_order = out_order,
+            .domid        = domid
+        }
+    };
+    set_xen_guest_handle(exchange.in.extent_start, in_extents);
+    set_xen_guest_handle(exchange.out.extent_start, out_extents);
+
+    rc = xc_memory_op(xch, XENMEM_exchange, &exchange);
+
+    return rc;
+}
+
 static int xc_domain_pod_target(xc_interface *xch,
                                 int op,
                                 uint32_t domid,
diff -r 5ec79c06b18a -r 835b06768104 tools/libxc/xc_offline_page.c
--- a/tools/libxc/xc_offline_page.c     Mon Oct 18 16:54:42 2010 +0100
+++ b/tools/libxc/xc_offline_page.c     Mon Oct 18 17:14:07 2010 +0100
@@ -512,35 +512,6 @@ static int clear_pte(xc_interface *xch, 
                       __clear_pte, mfn);
 }
 
-static int exchange_page(xc_interface *xch, xen_pfn_t mfn,
-                     xen_pfn_t *new_mfn, int domid)
-{
-    int rc;
-    xen_pfn_t out_mfn;
-
-       struct xen_memory_exchange exchange = {
-               .in = {
-                       .nr_extents   = 1,
-                       .extent_order = 0,
-                       .domid        = domid
-               },
-               .out = {
-                       .nr_extents   = 1,
-                       .extent_order = 0,
-                       .domid        = domid
-               }
-    };
-    set_xen_guest_handle(exchange.in.extent_start, &mfn);
-    set_xen_guest_handle(exchange.out.extent_start, &out_mfn);
-
-    rc = xc_memory_op(xch, XENMEM_exchange, &exchange);
-
-    if (!rc)
-        *new_mfn = out_mfn;
-
-    return rc;
-}
-
 /*
  * Check if a page can be exchanged successfully
  */
@@ -704,7 +675,9 @@ int xc_exchange_page(xc_interface *xch, 
         goto failed;
     }
 
-    rc = exchange_page(xch, mfn, &new_mfn, domid);
+    rc = xc_domain_memory_exchange_pages(xch, domid,
+                                        1, 0, &mfn,
+                                        1, 0, &new_mfn);
 
     if (rc)
     {
diff -r 5ec79c06b18a -r 835b06768104 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Oct 18 16:54:42 2010 +0100
+++ b/tools/libxc/xenctrl.h     Mon Oct 18 17:14:07 2010 +0100
@@ -828,6 +828,15 @@ int xc_domain_populate_physmap_exact(xc_
 /* Temporary for compatibility */
 #define xc_domain_memory_populate_physmap(x, d, nr, eo, mf, es) \
     xc_domain_populate_physmap_exact(x, d, nr, eo, mf, es)
+
+int xc_domain_memory_exchange_pages(xc_interface *xch,
+                                    int domid,
+                                    unsigned long nr_in_extents,
+                                    unsigned int in_order,
+                                    xen_pfn_t *in_extents,
+                                    unsigned long nr_out_extents,
+                                    unsigned int out_order,
+                                    xen_pfn_t *out_extents);
 
 int xc_domain_set_pod_target(xc_interface *xch,
                              uint32_t domid,

_______________________________________________
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] libxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange, Xen patchbot-unstable <=