diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-10-22 15:14:51 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-10-22 15:14:51 +0100 |
commit | f36c8d0c957ba7f971d992f104b9984547e8429b (patch) | |
tree | 8b4e1bcddf35ac360a42bae069ccf09544b41456 /tools/libxc/xc_domain_restore.c | |
parent | 254b93fd04733b0bb9fd6cea9b29db61e816a424 (diff) | |
download | xen-f36c8d0c957ba7f971d992f104b9984547e8429b.tar.gz xen-f36c8d0c957ba7f971d992f104b9984547e8429b.tar.bz2 xen-f36c8d0c957ba7f971d992f104b9984547e8429b.zip |
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@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_restore.c')
-rw-r--r-- | tools/libxc/xc_domain_restore.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c index 047cd774a7..5ac2de5445 100644 --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -1172,10 +1172,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, 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) ) @@ -1190,18 +1188,6 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, 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; domctl.domain = (domid_t)dom; |