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-changelog

[Xen-changelog] [xen-unstable] [IA64] Replace mlock()/munlock() in ia64

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] Replace mlock()/munlock() in ia64 libxc with un/lock_pages()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 16 Jun 2007 05:30:07 -0700
Delivery-date: Sat, 16 Jun 2007 05:28:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1179717815 21600
# Node ID 24463758319baf906284c8cd00aae616c8abb0da
# Parent  ac28ee0ee0981a49fe7150e7cd43e14802908312
[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@xxxxxxxxxxxxx>
---
 tools/libxc/ia64/xc_ia64_hvm_build.c     |   14 ++++++++------
 tools/libxc/ia64/xc_ia64_linux_restore.c |    6 ++++--
 tools/libxc/ia64/xc_ia64_linux_save.c    |   14 ++++++++------
 3 files changed, 20 insertions(+), 14 deletions(-)

diff -r ac28ee0ee098 -r 24463758319b 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      Sun May 20 21:23:35 2007 -0600
@@ -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 24463758319b 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  Sun May 20 21:23:35 2007 -0600
@@ -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 24463758319b 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     Sun May 20 21:23:35 2007 -0600
@@ -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);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] Replace mlock()/munlock() in ia64 libxc with un/lock_pages(), Xen patchbot-unstable <=