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

[Xen-devel] [PATCH 1/4] hvm: NUMA guest: extend memops hypercall

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/4] hvm: NUMA guest: extend memops hypercall
From: Andre Przywara <andre.przywara@xxxxxxx>
Date: Fri, 4 Jul 2008 09:57:23 +0200
Delivery-date: Fri, 04 Jul 2008 00:58:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070409)
This patch extends the memops hypercall in a compatible way to transport
a desired NUMA node number. The address_bits field will be limited to 8
bits and is now embedded in the mem_flags member, which additionally
contains the node number (limited to 8 bit). Passing a node number of
'0' (currently the default) will revert to automatic node selection
(based on currently scheduled node).

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>

--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
# HG changeset patch
# User Andre Przywara <andre.przywara@xxxxxxx>
# Date 1215082871 -7200
# Node ID e308bd4e9179493e3897143bf6e5841c14b4f357
# Parent  20215b87d0f3587ed5e928c31b1df2596b15ae79
made memops hypercall NUMA capable

diff -r 20215b87d0f3 -r e308bd4e9179 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Thu Jul 03 10:44:13 2008 +0100
+++ b/tools/libxc/xc_domain.c   Thu Jul 03 13:01:11 2008 +0200
@@ -445,7 +445,7 @@
     struct xen_memory_reservation reservation = {
         .nr_extents   = nr_extents,
         .extent_order = extent_order,
-        .address_bits = address_bits,
+        .mem_flags    = XENMEM_addr_bits(address_bits),
         .domid        = domid
     };
 
@@ -478,7 +478,7 @@
     struct xen_memory_reservation reservation = {
         .nr_extents   = nr_extents,
         .extent_order = extent_order,
-        .address_bits = 0,
+        .mem_flags    = 0,
         .domid        = domid
     };
 
@@ -517,7 +517,7 @@
     struct xen_memory_reservation reservation = {
         .nr_extents   = nr_extents,
         .extent_order = extent_order,
-        .address_bits = address_bits,
+        .mem_flags    = XENMEM_addr_bits(address_bits),
         .domid        = domid
     };
     set_xen_guest_handle(reservation.extent_start, extent_start);
diff -r 20215b87d0f3 -r e308bd4e9179 xen/common/memory.c
--- a/xen/common/memory.c       Thu Jul 03 10:44:13 2008 +0100
+++ b/xen/common/memory.c       Thu Jul 03 13:01:11 2008 +0200
@@ -344,8 +344,8 @@
     }
     d = current->domain;
 
-    memflags |= MEMF_bits(domain_clamp_alloc_bitsize(
-        d, exch.out.address_bits ? : (BITS_PER_LONG+PAGE_SHIFT)));
+    memflags |= MEMF_bits(domain_clamp_alloc_bitsize( d,
+       XENMEM_addr_bits(exch.out.mem_flags) ? : (BITS_PER_LONG+PAGE_SHIFT)));
     memflags |= MEMF_node(domain_to_node(d));
 
     for ( i = (exch.nr_exchanged >> in_chunk_order);
@@ -521,14 +521,16 @@
         args.preempted    = 0;
         args.memflags     = 0;
 
-        if ( (reservation.address_bits != 0) &&
-             (reservation.address_bits <
+        if ( (XENMEM_addr_bits(reservation.mem_flags) != 0) &&
+             (XENMEM_addr_bits(reservation.mem_flags) <
               (get_order_from_pages(max_page) + PAGE_SHIFT)) )
         {
-            if ( reservation.address_bits <= PAGE_SHIFT )
+            if ( XENMEM_addr_bits(reservation.mem_flags) <= PAGE_SHIFT )
                 return start_extent;
-            args.memflags = MEMF_bits(reservation.address_bits);
+            args.memflags = MEMF_bits(XENMEM_addr_bits(reservation.mem_flags));
         }
+
+        args.memflags |= MEMF_node(XENMEM_get_node(reservation.mem_flags));
 
         if ( likely(reservation.domid == DOMID_SELF) )
         {
diff -r 20215b87d0f3 -r e308bd4e9179 xen/include/public/memory.h
--- a/xen/include/public/memory.h       Thu Jul 03 10:44:13 2008 +0100
+++ b/xen/include/public/memory.h       Thu Jul 03 13:01:11 2008 +0200
@@ -35,6 +35,11 @@
 #define XENMEM_increase_reservation 0
 #define XENMEM_decrease_reservation 1
 #define XENMEM_populate_physmap     6
+
+#define XENMEM_addr_bits(f) ((f)&0xFF)
+#define XENMEM_get_node(f) (((((f)&0xFF00)>>8)-1)&0xFF)
+#define XENMEM_set_node(n) (((((n)&0xFF)+1)&0xFF)<<8)
+
 struct xen_memory_reservation {
 
     /*
@@ -59,7 +64,7 @@
      * zero then the user has no addressing restriction.
      * This field is not used by XENMEM_decrease_reservation.
      */
-    unsigned int   address_bits;
+    unsigned int   mem_flags;
 
     /*
      * Domain whose reservation is being changed.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel