# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1178609087 -32400 # Node ID 16c51e377085815906c49413f46bae6877f0a645 # Parent ac28ee0ee0981a49fe7150e7cd43e14802908312 replace mlock()/munlock() in ia64 libxc with un/lock_pages() for consistency. add some missing unlock_pages(). PATCHNAME: lock_pages_unlock_pages Signed-off-by: Isaku Yamahata diff -r ac28ee0ee098 -r 16c51e377085 tools/libxc/ia64/xc_ia64_hvm_build.c --- a/tools/libxc/ia64/xc_ia64_hvm_build.c Wed May 16 11:38:48 2007 -0600 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Tue May 08 16:24:47 2007 +0900 @@ -39,11 +39,11 @@ xc_set_hvm_param(int handle, domid_t dom 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 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 dom 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 dom 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; } diff -r ac28ee0ee098 -r 16c51e377085 tools/libxc/ia64/xc_ia64_linux_restore.c --- a/tools/libxc/ia64/xc_ia64_linux_restore.c Wed May 16 11:38:48 2007 -0600 +++ b/tools/libxc/ia64/xc_ia64_linux_restore.c Tue May 08 16:24:47 2007 +0900 @@ -106,9 +106,9 @@ xc_domain_restore(int xc_handle, int io_ 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_ if (page_array != NULL) free(page_array); + unlock_pages(&ctxt, sizeof(ctxt)); + DPRINTF("Restore exit with rc=%d\n", rc); return rc; diff -r ac28ee0ee098 -r 16c51e377085 tools/libxc/ia64/xc_ia64_linux_save.c --- a/tools/libxc/ia64/xc_ia64_linux_save.c Wed May 16 11:38:48 2007 -0600 +++ b/tools/libxc/ia64/xc_ia64_linux_save.c Tue May 08 16:24:47 2007 +0900 @@ -281,12 +281,12 @@ xc_domain_save(int xc_handle, int io_fd, /* 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"); - goto out; - } - if (mlock(to_skip, bitmap_size)) { - ERROR("Unable to mlock to_skip"); + if (lock_pages(to_send, bitmap_size)) { + ERROR("Unable to lock_pages to_send"); + goto out; + } + 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, } 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);