mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[IA64] Replace mlock()/munlock() in ia64 libxc with un/lock_pages()
For Consistency. Also add some missing unlock_pages(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
This commit is contained in:
1 parent
8ffb0fb8fe
commit
fc073c9c01
3 files changed
+18
-12
No files matched your search
@@ -39,11 +39,11 @@ xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value)
|
||||
arg.index = param;
|
||||
arg.value = value;
|
||||
|
||||
if (mlock(&arg, sizeof(arg)) != 0)
|
||||
if (lock_pages(&arg, sizeof(arg)) != 0)
|
||||
return -1;
|
||||
|
||||
rc = do_xen_hypercall(handle, &hypercall);
|
||||
safe_munlock(&arg, sizeof(arg));
|
||||
unlock_pages(&arg, sizeof(arg));
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -62,11 +62,11 @@ xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value)
|
||||
arg.domid = dom;
|
||||
arg.index = param;
|
||||
|
||||
if (mlock(&arg, sizeof(arg)) != 0)
|
||||
if (lock_pages(&arg, sizeof(arg)) != 0)
|
||||
return -1;
|
||||
|
||||
rc = do_xen_hypercall(handle, &hypercall);
|
||||
safe_munlock(&arg, sizeof(arg));
|
||||
unlock_pages(&arg, sizeof(arg));
|
||||
|
||||
*value = arg.value;
|
||||
return rc;
|
||||
@@ -723,8 +723,8 @@ xc_hvm_build(int xc_handle, uint32_t domid, int memsize, const char *image_name)
|
||||
|
||||
image_size = (image_size + PAGE_SIZE - 1) & PAGE_MASK;
|
||||
|
||||
if (mlock(&st_ctxt, sizeof(st_ctxt))) {
|
||||
PERROR("Unable to mlock ctxt");
|
||||
if (lock_pages(&st_ctxt, sizeof(st_ctxt))) {
|
||||
PERROR("Unable to lock_pages ctxt");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -748,10 +748,12 @@ xc_hvm_build(int xc_handle, uint32_t domid, int memsize, const char *image_name)
|
||||
|
||||
launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
|
||||
rc = do_domctl(xc_handle, &launch_domctl);
|
||||
unlock_pages(&st_ctxt, sizeof(st_ctxt));
|
||||
return rc;
|
||||
|
||||
error_out:
|
||||
free(image);
|
||||
unlock_pages(&st_ctxt, sizeof(st_ctxt));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,9 +106,9 @@ xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (mlock(&ctxt, sizeof(ctxt))) {
|
||||
if (lock_pages(&ctxt, sizeof(ctxt))) {
|
||||
/* needed for build domctl, but might as well do early */
|
||||
ERROR("Unable to mlock ctxt");
|
||||
ERROR("Unable to lock_pages ctxt");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -318,6 +318,8 @@ xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
|
||||
if (page_array != NULL)
|
||||
free(page_array);
|
||||
|
||||
unlock_pages(&ctxt, sizeof(ctxt));
|
||||
|
||||
DPRINTF("Restore exit with rc=%d\n", rc);
|
||||
|
||||
return rc;
|
||||
|
||||
@@ -281,12 +281,12 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
|
||||
/* Initially all the pages must be sent. */
|
||||
memset(to_send, 0xff, bitmap_size);
|
||||
|
||||
if (mlock(to_send, bitmap_size)) {
|
||||
ERROR("Unable to mlock to_send");
|
||||
if (lock_pages(to_send, bitmap_size)) {
|
||||
ERROR("Unable to lock_pages to_send");
|
||||
goto out;
|
||||
}
|
||||
if (mlock(to_skip, bitmap_size)) {
|
||||
ERROR("Unable to mlock to_skip");
|
||||
if (lock_pages(to_skip, bitmap_size)) {
|
||||
ERROR("Unable to lock_pages to_skip");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -492,7 +492,9 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
|
||||
}
|
||||
|
||||
free(page_array);
|
||||
unlock_pages(to_send, bitmap_size);
|
||||
free(to_send);
|
||||
unlock_pages(to_skip, bitmap_size);
|
||||
free(to_skip);
|
||||
if (live_shinfo)
|
||||
munmap(live_shinfo, PAGE_SIZE);
|
||||
|
||||