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] Move the translation from pages to MiB out of XendNode a

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Move the translation from pages to MiB out of XendNode and into the xc layer.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 30 Nov 2005 21:50:09 +0000
Delivery-date: Wed, 30 Nov 2005 21:50:29 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID e33f8d664e2d3575a6160b06ec3e67b2d2c8dca6
# Parent  341c56e34b0df02035b02b086070a810525e3d0a
Move the translation from pages to MiB out of XendNode and into the xc layer.
xc has access to the page size for the platform and the Python layer does not,
so there was a hardcoded "/ 256" in there.

Rename the "memory" physinfo parameter to "total_memory", to match the usage
elsewhere.

Tidy the code generating the SXP for xm info.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 341c56e34b0d -r e33f8d664e2d tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Nov 30 18:38:48 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Wed Nov 30 18:43:00 2005
@@ -575,6 +575,13 @@
     return PyString_FromStringAndSize(str, count);
 }
 
+
+static unsigned long pages_to_mb(unsigned long pages)
+{
+    return (pages * (XC_PAGE_SIZE / 1024) + 1023) / 1024;
+}
+
+
 static PyObject *pyxc_physinfo(XcObject *self)
 {
     xc_physinfo_t info;
@@ -599,8 +606,8 @@
                          "cores_per_socket", info.cores_per_socket,
                          "sockets_per_node", info.sockets_per_node,
                          "nr_nodes",         info.nr_nodes,
-                         "total_pages",      info.total_pages,
-                         "free_pages",       info.free_pages,
+                         "total_memory",     pages_to_mb(info.total_pages),
+                         "free_memory",      pages_to_mb(info.free_pages),
                          "cpu_khz",          info.cpu_khz,
                          "hw_caps",          cpu_cap);
 }
diff -r 341c56e34b0d -r e33f8d664e2d tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Wed Nov 30 18:38:48 2005
+++ b/tools/python/xen/xend/XendNode.py Wed Nov 30 18:43:00 2005
@@ -57,30 +57,45 @@
                 ['machine', mch]]
 
     def physinfo(self):
-        pinfo = self.xc.physinfo()
-        info = [['nr_cpus',          
pinfo['nr_nodes']*pinfo['sockets_per_node']*pinfo['cores_per_socket']*pinfo['threads_per_core']],
-                ['nr_nodes',         pinfo['nr_nodes']],
-                ['sockets_per_node', pinfo['sockets_per_node']],
-                ['cores_per_socket', pinfo['cores_per_socket']],
-                ['threads_per_core', pinfo['threads_per_core']],
-                ['cpu_mhz',          pinfo['cpu_khz']/1000],
-                ['hw_caps',          pinfo['hw_caps']],
-                ['memory',           pinfo['total_pages']/256],
-                ['free_memory',      pinfo['free_pages']/256]]
-        return info
-        
+        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
+
+        ITEM_ORDER = ['nr_cpus',
+                      'nr_nodes',
+                      'sockets_per_node',
+                      'cores_per_socket',
+                      'threads_per_core',
+                      'cpu_mhz',
+                      'hw_caps',
+                      'total_memory',
+                      'free_memory',
+                      ]
+
+        return [[k, info[k]] for k in ITEM_ORDER]
+
+
     def xeninfo(self):
-        xinfo = self.xc.xeninfo()
-        return [['xen_major', xinfo['xen_major']],
-                ['xen_minor', xinfo['xen_minor']],
-                ['xen_extra', xinfo['xen_extra']],
-                ['xen_caps',  xinfo['xen_caps']],
-                ['platform_params',xinfo['platform_params']],
-                ['xen_changeset', xinfo['xen_changeset']],
-                ['cc_compiler', xinfo['cc_compiler']],
-                ['cc_compile_by', xinfo['cc_compile_by']],
-                ['cc_compile_domain', xinfo['cc_compile_domain']],
-                ['cc_compile_date', xinfo['cc_compile_date']]]
+        info = self.xc.xeninfo()
+
+        ITEM_ORDER = ['xen_major',
+                      'xen_minor',
+                      'xen_extra',
+                      'xen_caps',
+                      'platform_params',
+                      'xen_changeset',
+                      'cc_compiler',
+                      'cc_compile_by',
+                      'cc_compile_domain',
+                      'cc_compile_date',
+                      ]
+
+        return [[k, info[k]] for k in ITEM_ORDER]
+
 
 def instance():
     global inst
diff -r 341c56e34b0d -r e33f8d664e2d tools/xm-test/lib/XmTestReport/OSReport.py
--- a/tools/xm-test/lib/XmTestReport/OSReport.py        Wed Nov 30 18:38:48 2005
+++ b/tools/xm-test/lib/XmTestReport/OSReport.py        Wed Nov 30 18:43:00 2005
@@ -97,7 +97,7 @@
                      "cores_per_socket" : "Unknown",
                      "threads_per_core" : "Unknown",
                      "cpu_mhz"          : "Unknown",
-                     "memory"           : "Unknown"}
+                     "total_memory"     : "Unknown"}
 
         xen = self.__getXenInfo(xenValues)
         cpu = self.__getCpuInfo(cpuValues)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Move the translation from pages to MiB out of XendNode and into the xc layer., Xen patchbot -unstable <=