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 5/6][RESEND] xen: Add NUMA support to Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 5/6][RESEND] xen: Add NUMA support to Xen
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Fri, 12 May 2006 10:12:54 -0500
Cc: Ryan Grimm <grimm@xxxxxxxxxx>
Delivery-date: Fri, 12 May 2006 08:16:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060501215915.GY16776@xxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060501215915.GY16776@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
* Ryan Harper <ryanh@xxxxxxxxxx> [2006-05-01 17:01]:
> This patch adds a nr_cpu field into the physinfo structure.  With numa
> enabled, and nr_nodes being properly calculated (rather than hard-coded
> to 1), the current mechanism for calculating the total number of
> cpus that Xen sees is incorrect.  Rather than calculate, just use the
> actual value from num_online_cpus().  In addition to the change to the
> physinfo structure, all users have been updated to using nr_cpus.

Updated for CONFIG_NUMA ifdef removal.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 tools/python/xen/lowlevel/xc/xc.c      |    3 ++-
 tools/python/xen/xend/XendNode.py      |    4 ----
 tools/xenmon/xenbaked.c                |    5 +----
 tools/xenstat/libxenstat/src/xenstat.c |    4 +---
 tools/xentrace/xentrace.c              |    5 +----
 xen/arch/ia64/xen/dom0_ops.c           |    1 +
 xen/arch/x86/dom0_ops.c                |    2 +-
 xen/include/public/dom0_ops.h          |    1 +
 8 files changed, 8 insertions(+), 17 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
Signed-off-by: Ryan Grimm <grimm@xxxxxxxxxx>
---
# HG changeset patch
# User Ryan Harper <ryanh@xxxxxxxxxx>
# Node ID c4496884af8c0ab7a81cbbe692f2562a6bd30064
# Parent  b13712d6a6154d4610b894adab7f89ee7b3683d4
This patch adds a nr_cpus field into the physinfo structure.  On multi-node
machines and nr_nodes being properly calculated (rather than hard-coded to 1),
the current mechanism for calculating the total number of cpus that Xen sees is
incorrect.  Rather than calculate, just use the actual value from
num_online_cpus().  In addition to the change to the physinfo structure, all
users have been updated to using nr_cpus.

diff -r b13712d6a615 -r c4496884af8c tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu May 11 21:01:06 2006
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 11 21:04:38 2006
@@ -631,10 +631,11 @@
     if(q>cpu_cap)
         *(q-1)=0;
     
-    ret_obj = Py_BuildValue("{s:i,s:i,s:i,s:l,s:l,s:i,s:s}",
+    ret_obj = Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i,s:s}",
                          "threads_per_core", info.threads_per_core,
                          "cores_per_socket", info.cores_per_socket,
                          "sockets_per_node", info.sockets_per_node,
+                         "nr_cpus"         , info.nr_cpus,
                          "total_memory",     pages_to_mb(info.total_pages),
                          "free_memory",      pages_to_mb(info.free_pages),
                          "cpu_khz",          info.cpu_khz,
diff -r b13712d6a615 -r c4496884af8c tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Thu May 11 21:01:06 2006
+++ b/tools/python/xen/xend/XendNode.py Thu May 11 21:04:38 2006
@@ -122,10 +122,6 @@
     def physinfo(self):
         info = self.xc.physinfo()
 
-        info['nr_cpus'] = (info['nr_nodes'] *
-                           info['sockets_per_node'] *
-                           info['cores_per_socket'] *
-                           info['threads_per_core'])
         info['cpu_mhz'] = info['cpu_khz'] / 1000
         info['mem_chunks'] = self.format_memchunks(info)
         info['node_to_cpu'] = self.format_node_to_cpu(info)
diff -r b13712d6a615 -r c4496884af8c tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c   Thu May 11 21:01:06 2006
+++ b/tools/xenmon/xenbaked.c   Thu May 11 21:04:38 2006
@@ -520,10 +520,7 @@
     xc_interface_close(xc_handle);
     opts.cpu_freq = (double)op.u.physinfo.cpu_khz/1000.0;
 
-    return (op.u.physinfo.threads_per_core *
-            op.u.physinfo.cores_per_socket *
-            op.u.physinfo.sockets_per_node *
-            op.u.physinfo.nr_nodes);
+    return op.u.physinfo.nr_cpus;
 }
 
 
diff -r b13712d6a615 -r c4496884af8c tools/xenstat/libxenstat/src/xenstat.c
--- a/tools/xenstat/libxenstat/src/xenstat.c    Thu May 11 21:01:06 2006
+++ b/tools/xenstat/libxenstat/src/xenstat.c    Thu May 11 21:04:38 2006
@@ -205,9 +205,7 @@
        }
 
        node->cpu_hz = ((unsigned long long)physinfo.cpu_khz) * 1000ULL;
-       node->num_cpus =
-           (physinfo.threads_per_core * physinfo.cores_per_socket *
-            physinfo.sockets_per_node * physinfo.nr_nodes);
+       node->num_cpus = physinfo.nr_cpus;
        node->tot_mem = ((unsigned long long)physinfo.total_pages)
            * handle->page_size;
        node->free_mem = ((unsigned long long)physinfo.free_pages)
diff -r b13712d6a615 -r c4496884af8c tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Thu May 11 21:01:06 2006
+++ b/tools/xentrace/xentrace.c Thu May 11 21:04:38 2006
@@ -272,10 +272,7 @@
 
     xc_interface_close(xc_handle);
 
-    return (physinfo.threads_per_core *
-            physinfo.cores_per_socket *
-            physinfo.sockets_per_node *
-            physinfo.nr_nodes);
+    return physinfo.nr_cpus;
 }
 
 
diff -r b13712d6a615 -r c4496884af8c xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Thu May 11 21:01:06 2006
+++ b/xen/arch/ia64/xen/dom0_ops.c      Thu May 11 21:04:38 2006
@@ -215,6 +215,7 @@
             cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
         pi->sockets_per_node = 
             num_online_cpus() / cpus_weight(cpu_core_map[0]);
+        pi->nr_cpus          = (u32)num_online_cpus();
         pi->nr_nodes         = 1;
         pi->total_pages      = total_pages; 
         pi->free_pages       = avail_domheap_pages();
diff -r b13712d6a615 -r c4496884af8c xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c   Thu May 11 21:01:06 2006
+++ b/xen/arch/x86/dom0_ops.c   Thu May 11 21:04:38 2006
@@ -193,7 +193,7 @@
             cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
         pi->sockets_per_node = 
             num_online_cpus() / cpus_weight(cpu_core_map[0]);
-
+        pi->nr_cpus          = (u32)num_online_cpus();
         pi->total_pages      = total_pages;
         pi->free_pages       = avail_domheap_pages();
         pi->cpu_khz          = cpu_khz;
diff -r b13712d6a615 -r c4496884af8c xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Thu May 11 21:01:06 2006
+++ b/xen/include/public/dom0_ops.h     Thu May 11 21:04:38 2006
@@ -216,6 +216,7 @@
     uint32_t cores_per_socket;
     uint32_t sockets_per_node;
     uint32_t nr_nodes;
+    uint32_t nr_cpus;
     uint32_t cpu_khz;
     unsigned long total_pages;
     unsigned long free_pages;

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

<Prev in Thread] Current Thread [Next in Thread>