All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1/4] hvm: NUMA guest: extend memops hypercall
Date: Fri, 4 Jul 2008 09:57:23 +0200	[thread overview]
Message-ID: <486DD7E3.3060502@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

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@amd.com>

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

[-- Attachment #2: 01_numa_guest.patch --]
[-- Type: text/plain, Size: 3535 bytes --]

# HG changeset patch
# User Andre Przywara <andre.przywara@amd.com>
# 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.

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

             reply	other threads:[~2008-07-04  7:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-04  7:57 Andre Przywara [this message]
2008-07-04  9:52 ` [PATCH 1/4] hvm: NUMA guest: extend memops hypercall Keir Fraser
2008-07-04 11:14   ` Andre Przywara
2008-07-04 11:59     ` Keir Fraser
2008-07-04 12:48       ` Andre Przywara
2008-07-04 14:54         ` Keir Fraser
2008-07-04 15:28           ` Andre Przywara
2008-07-04 15:34             ` Keir Fraser
2008-07-04 23:12               ` Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486DD7E3.3060502@amd.com \
    --to=andre.przywara@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.