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 24 of 25] libxc: do not align/lock buffers which do n

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 24 of 25] libxc: do not align/lock buffers which do not need it
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 22 Oct 2010 15:16:06 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 22 Oct 2010 07:58:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1287756942@xxxxxxxxxxxxxxxxxxxxx>
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 1287756891 -3600
# Node ID 5d4e169f1ef0cc1ec40855f42443752b2c29093c
# Parent  02dca31076126f4a0334881eb9a9980fd188cf25
libxc: do not align/lock buffers which do not need it

On restore:

region_mfn is passed to xc_map_foreign_range and
xc_map_foreign_bulk. In both cases the buffer is accessed from the
ioctl handler in the kernel and not from any hypercall. Therefore
normal copy_{to,from}_user handling in the kernel will cope with any
faulting access.

p2m_batch is passed to xc_domain_memory_populate_physmap which takes
care of bouncing the buffer already.

On save:

pfn_type is passed to xc_map_foreign_bulk which does not need locking
as per region_mfn above.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 02dca3107612 -r 5d4e169f1ef0 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Fri Oct 22 15:14:51 2010 +0100
+++ b/tools/libxc/xc_domain_restore.c   Fri Oct 22 15:14:51 2010 +0100
@@ -1172,10 +1172,8 @@ int xc_domain_restore(xc_interface *xch,
     ctx->p2m   = calloc(dinfo->p2m_size, sizeof(xen_pfn_t));
     pfn_type   = calloc(dinfo->p2m_size, sizeof(unsigned long));
 
-    region_mfn = xc_memalign(PAGE_SIZE, ROUNDUP(
-                              MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
-    ctx->p2m_batch = xc_memalign(
-        PAGE_SIZE, ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
+    region_mfn = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), 
PAGE_SHIFT));
+    ctx->p2m_batch = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), 
PAGE_SHIFT));
 
     if ( (ctx->p2m == NULL) || (pfn_type == NULL) ||
          (region_mfn == NULL) || (ctx->p2m_batch == NULL) )
@@ -1189,18 +1187,6 @@ int xc_domain_restore(xc_interface *xch,
            ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT)); 
     memset(ctx->p2m_batch, 0,
            ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT)); 
-
-    if ( lock_pages(xch, region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE) )
-    {
-        PERROR("Could not lock region_mfn");
-        goto out;
-    }
-
-    if ( lock_pages(xch, ctx->p2m_batch, sizeof(xen_pfn_t) * MAX_BATCH_SIZE) )
-    {
-        ERROR("Could not lock p2m_batch");
-        goto out;
-    }
 
     /* Get the domain's shared-info frame. */
     domctl.cmd = XEN_DOMCTL_getdomaininfo;
diff -r 02dca3107612 -r 5d4e169f1ef0 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Fri Oct 22 15:14:51 2010 +0100
+++ b/tools/libxc/xc_domain_save.c      Fri Oct 22 15:14:51 2010 +0100
@@ -1071,8 +1071,7 @@ int xc_domain_save(xc_interface *xch, in
 
     analysis_phase(xch, dom, ctx, HYPERCALL_BUFFER(to_skip), 0);
 
-    pfn_type   = xc_memalign(PAGE_SIZE, ROUNDUP(
-                              MAX_BATCH_SIZE * sizeof(*pfn_type), PAGE_SHIFT));
+    pfn_type   = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(*pfn_type), 
PAGE_SHIFT));
     pfn_batch  = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
     pfn_err    = malloc(MAX_BATCH_SIZE * sizeof(*pfn_err));
     if ( (pfn_type == NULL) || (pfn_batch == NULL) || (pfn_err == NULL) )
@@ -1083,12 +1082,6 @@ int xc_domain_save(xc_interface *xch, in
     }
     memset(pfn_type, 0,
            ROUNDUP(MAX_BATCH_SIZE * sizeof(*pfn_type), PAGE_SHIFT));
-
-    if ( lock_pages(xch, pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type)) )
-    {
-        PERROR("Unable to lock pfn_type array");
-        goto out;
-    }
 
     /* Setup the mfn_to_pfn table mapping */
     if ( !(ctx->live_m2p = xc_map_m2p(xch, ctx->max_mfn, PROT_READ, 
&ctx->m2p_mfn0)) )

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

<Prev in Thread] Current Thread [Next in Thread>