[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Update the memory_op() hypercall. Add two new subcommands, to



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ff18a169e866cae280b457375127b68666231744
# Parent  bdab22f56efe72943e2bfe57113dacf6cef558f8
Update the memory_op() hypercall. Add two new subcommands, to
query a domain's current and maximum memory reservation. Also,
XENMEM_maximum_ram_page now returns the max_page directly,
rather than writing through a passed-in pointer.

Also, disable PAE in the default config (accidentally checked
in two changesets ago).

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r bdab22f56efe -r ff18a169e866 Config.mk
--- a/Config.mk Mon Nov 21 15:40:16 2005
+++ b/Config.mk Mon Nov 21 15:56:39 2005
@@ -3,7 +3,7 @@
 # Currently supported architectures: x86_32, x86_64
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
-XEN_TARGET_X86_PAE  ?= y
+XEN_TARGET_X86_PAE  ?= n
 
 # Tools to run on system hosting the build
 HOSTCC     = gcc
diff -r bdab22f56efe -r ff18a169e866 
linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c       Mon Nov 21 
15:40:16 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c       Mon Nov 21 
15:56:39 2005
@@ -178,6 +178,8 @@
 void
 swiotlb_init(void)
 {
+       long ram_end;
+
        /* The user can forcibly enable swiotlb. */
        if (swiotlb_force)
                swiotlb = 1;
@@ -187,9 +189,7 @@
          * which we take to mean more than 2GB.
          */
        if (xen_start_info->flags & SIF_INITDOMAIN) {
-               unsigned long ram_end;
-               if (HYPERVISOR_memory_op(XENMEM_maximum_ram_page, &ram_end))
-                       BUG();
+               ram_end = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
                if (ram_end > 0x7ffff)
                        swiotlb = 1;
        }
diff -r bdab22f56efe -r ff18a169e866 
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c        Mon Nov 21 
15:40:16 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c        Mon Nov 21 
15:56:39 2005
@@ -586,7 +586,7 @@
        free_bootmem(__pa(map), PAGE_SIZE);
 
        if (!found) {
-               HYPERVISOR_memory_op(XENMEM_maximum_ram_page, &gapstart);
+               gapstart = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
                gapstart = (gapstart << PAGE_SHIFT) + 1024*1024;
                printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit 
address range\n"
                       KERN_ERR "PCI: Unassigned devices with 32bit resource 
registers may break!\n");
diff -r bdab22f56efe -r ff18a169e866 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Mon Nov 21 15:40:16 2005
+++ b/tools/libxc/xc_private.c  Mon Nov 21 15:56:39 2005
@@ -214,13 +214,6 @@
             goto out1;
         }
         break;
-    case XENMEM_maximum_ram_page:
-        if ( mlock(arg, sizeof(unsigned long)) != 0 )
-        {
-            PERROR("Could not mlock");
-            goto out1;
-        }
-        break;
     }
 
     ret = do_xen_hypercall(xc_handle, &hypercall);
@@ -233,9 +226,6 @@
         if ( reservation->extent_start != NULL )
             safe_munlock(reservation->extent_start,
                          reservation->nr_extents * sizeof(unsigned long));
-        break;
-    case XENMEM_maximum_ram_page:
-        safe_munlock(arg, sizeof(unsigned long));
         break;
     }
 
diff -r bdab22f56efe -r ff18a169e866 tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h     Mon Nov 21 15:40:16 2005
+++ b/tools/libxc/xg_save_restore.h     Mon Nov 21 15:56:39 2005
@@ -64,7 +64,6 @@
 { 
     xen_capabilities_info_t xen_caps = "";
     xen_platform_parameters_t xen_params;
-    
 
     if (xc_version(xc_handle, XENVER_platform_parameters, &xen_params) != 0)
         return 0;
@@ -72,8 +71,7 @@
     if (xc_version(xc_handle, XENVER_capabilities, &xen_caps) != 0)
         return 0;
 
-    if (xc_memory_op(xc_handle, XENMEM_maximum_ram_page, max_mfn) != 0)
-        return 0; 
+    *max_mfn = xc_memory_op(xc_handle, XENMEM_maximum_ram_page, NULL);
     
     *hvirt_start = xen_params.virt_start;
 
diff -r bdab22f56efe -r ff18a169e866 xen/common/memory.c
--- a/xen/common/memory.c       Mon Nov 21 15:40:16 2005
+++ b/xen/common/memory.c       Mon Nov 21 15:56:39 2005
@@ -136,6 +136,7 @@
     struct domain *d;
     int rc, start_extent, op, flags = 0, preempted = 0;
     struct xen_memory_reservation reservation;
+    domid_t domid;
 
     op = cmd & ((1 << START_EXTENT_SHIFT) - 1);
 
@@ -191,9 +192,26 @@
         break;
 
     case XENMEM_maximum_ram_page:
-        if ( put_user(max_page, (unsigned long *)arg) )
+        rc = max_page;
+        break;
+
+    case XENMEM_current_reservation:
+    case XENMEM_maximum_reservation:
+        if ( get_user(domid, (domid_t *)arg) )
             return -EFAULT;
-        rc = 0;
+
+        if ( likely((domid = (unsigned long)arg) == DOMID_SELF) )
+            d = current->domain;
+        else if ( !IS_PRIV(current->domain) )
+            return -EPERM;
+        else if ( (d = find_domain_by_id(domid)) == NULL )
+            return -ESRCH;
+
+        rc = (op == XENMEM_current_reservation) ? d->tot_pages : d->max_pages;
+
+        if ( unlikely(domid != DOMID_SELF) )
+            put_domain(d);
+
         break;
 
     default:
diff -r bdab22f56efe -r ff18a169e866 xen/include/public/memory.h
--- a/xen/include/public/memory.h       Mon Nov 21 15:40:16 2005
+++ b/xen/include/public/memory.h       Mon Nov 21 15:56:39 2005
@@ -9,15 +9,13 @@
 #ifndef __XEN_PUBLIC_MEMORY_H__
 #define __XEN_PUBLIC_MEMORY_H__
 
-/* arg == addr of struct xen_memory_reservation. */
+/*
+ * Increase or decrease the specified domain's memory reservation. Returns a
+ * -ve errcode on failure, or the # extents successfully allocated or freed.
+ * arg == addr of struct xen_memory_reservation.
+ */
 #define XENMEM_increase_reservation 0
-
-/* arg == addr of struct xen_memory_reservation. */
 #define XENMEM_decrease_reservation 1
-
-/* arg == addr of unsigned long. */
-#define XENMEM_maximum_ram_page     2
-
 typedef struct xen_memory_reservation {
 
     /*
@@ -47,6 +45,21 @@
 
 } xen_memory_reservation_t;
 
+/*
+ * Returns the maximum machine frame number of mapped RAM in this system.
+ * This command always succeeds (it never returns an error code).
+ * arg == NULL.
+ */
+#define XENMEM_maximum_ram_page     2
+
+/*
+ * Returns the current or maximum memory reservation, in pages, of the
+ * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
+ * arg == addr of domid_t.
+ */
+#define XENMEM_current_reservation  3
+#define XENMEM_maximum_reservation  4
+
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
 /*

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.