aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_save.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-10-22 15:14:51 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-10-22 15:14:51 +0100
commitf36c8d0c957ba7f971d992f104b9984547e8429b (patch)
tree8b4e1bcddf35ac360a42bae069ccf09544b41456 /tools/libxc/xc_domain_save.c
parent254b93fd04733b0bb9fd6cea9b29db61e816a424 (diff)
downloadxen-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_save.c')
-rw-r--r--tools/libxc/xc_domain_save.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index 8dc08e0003..1f3022cd43 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -1071,8 +1071,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
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) )
@@ -1084,12 +1083,6 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
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)) )
{