* RE: [PATCH] xm info
@ 2005-07-03 19:27 Ian Pratt
2005-07-03 22:16 ` David Hopwood
2005-07-04 0:42 ` aq
0 siblings, 2 replies; 12+ messages in thread
From: Ian Pratt @ 2005-07-03 19:27 UTC (permalink / raw)
To: aq, xen-devel
While we're at it, I'd suggest we add an extra level of hierarchy ,
'nodes', for NUMA, even if we have nodes hardwired to 1 at present e.g.:
> logical_cpus : 1
> nodes : 1
> sockets_per_node : 1
> cores_per_socket : 1
> hyperthreads_per_core : 1
Thanks,
Ian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 19:27 [PATCH] xm info Ian Pratt
@ 2005-07-03 22:16 ` David Hopwood
2005-07-04 0:42 ` aq
1 sibling, 0 replies; 12+ messages in thread
From: David Hopwood @ 2005-07-03 22:16 UTC (permalink / raw)
To: xen-devel
Ian Pratt wrote:
> While we're at it, I'd suggest we add an extra level of hierarchy ,
> 'nodes', for NUMA, even if we have nodes hardwired to 1 at present e.g.:
>
>>logical_cpus : 1
>>nodes : 1
>>sockets_per_node : 1
>>cores_per_socket : 1
>>hyperthreads_per_core : 1
Is sockets_per_node always the same for each node (similarly for
cores_per_socket and hyperthreads_per_core)?
--
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 19:27 [PATCH] xm info Ian Pratt
2005-07-03 22:16 ` David Hopwood
@ 2005-07-04 0:42 ` aq
1 sibling, 0 replies; 12+ messages in thread
From: aq @ 2005-07-04 0:42 UTC (permalink / raw)
To: Ian Pratt; +Cc: xen-devel
On 7/4/05, Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk> wrote:
>
> While we're at it, I'd suggest we add an extra level of hierarchy ,
> 'nodes', for NUMA, even if we have nodes hardwired to 1 at present e.g.:
>
> > logical_cpus : 1
> > nodes : 1
> > sockets_per_node : 1
> > cores_per_socket : 1
> > hyperthreads_per_core : 1
ok, but from where should we extract the value of "nodes"? should we
extend hypercall or just put it straightly into libxc?
regards,
aq
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] xm info
@ 2005-07-04 9:04 Ian Pratt
0 siblings, 0 replies; 12+ messages in thread
From: Ian Pratt @ 2005-07-04 9:04 UTC (permalink / raw)
To: aq; +Cc: xen-devel
> > > logical_cpus : 1
> > > nodes : 1
> > > sockets_per_node : 1
> > > cores_per_socket : 1
> > > hyperthreads_per_core : 1
>
> ok, but from where should we extract the value of "nodes"?
> should we extend hypercall or just put it straightly into libxc?
We should definitely extend the hypercall.
Best,
Ian
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] xm info
@ 2005-07-03 22:32 Ian Pratt
0 siblings, 0 replies; 12+ messages in thread
From: Ian Pratt @ 2005-07-03 22:32 UTC (permalink / raw)
To: david.nospam.hopwood, xen-devel
> Ian Pratt wrote:
> > While we're at it, I'd suggest we add an extra level of hierarchy ,
> > 'nodes', for NUMA, even if we have nodes hardwired to 1 at
> present e.g.:
> >
> >>logical_cpus : 1
> >>nodes : 1
> >>sockets_per_node : 1
> >>cores_per_socket : 1
> >>hyperthreads_per_core : 1
>
> Is sockets_per_node always the same for each node (similarly
> for cores_per_socket and hyperthreads_per_core)?
In systems where this wan't the case we'd just have the 'missing cores'
permanently marked down.
Ian
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] xm info
@ 2005-07-03 7:13 aq
2005-07-03 8:26 ` Keir Fraser
0 siblings, 1 reply; 12+ messages in thread
From: aq @ 2005-07-03 7:13 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 1524 bytes --]
This patch makes "xm info" show information on xen version, compile
info, number of socket/core, etc...
In order to do that, it extends physinfo hypercall to return number of
socket, adds few functions to libxc and extends python wrapper
correspondingly.
Here is the output of new "xm info":
--
system : Linux
host : ubuntu
xen_release : 3.0-devel
xen_compile_by : root@localdomain
xen_compiler : gcc version 3.3.5 (Debian 1:3.3.5-8ubuntu2)
xen_compile_date : Sun Jul 3 15:26:01 EST 2005
dom0_release : 2.6.11.12-xen0
dom0_version : #2 Sun Jul 3 15:39:31 EST 2005
machine : i686
logical_cpus : 1
sockets : 1
cores_per_socket : 1
hyperthreads_per_core : 1
cpu_mhz : 1094
memory : 511
free_memory : 122
--
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
# diffstat xminfo8.patch
tools/libxc/xc.h | 20 +++++++++++++
tools/libxc/xc_misc.c | 40 +++++++++++++++++++++++++++
tools/python/xen/lowlevel/xc/xc.c | 55 +++++++++++++++++++++++++++++++++++++-
tools/python/xen/xend/XendNode.py | 16 ++++++++---
xen/arch/x86/dom0_ops.c | 1
xen/common/kernel.c | 46 +++++++++++++++----------------
xen/include/public/dom0_ops.h | 1
xen/include/public/version.h | 3 ++
8 files changed, 154 insertions(+), 28 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xminfo8.patch --]
[-- Type: text/x-patch; name="xminfo8.patch", Size: 10042 bytes --]
diff -r fc4e10d0455a tools/libxc/xc.h
--- a/tools/libxc/xc.h Sat Jul 2 22:37:55 2005
+++ b/tools/libxc/xc.h Sun Jul 3 16:05:52 2005
@@ -4,6 +4,7 @@
* A library for low-level access to the Xen control interfaces.
*
* Copyright (c) 2003-2004, K A Fraser.
+ * Copyright (c) 2005, Nguyen Anh Quynh <aquynh@gmail.com>
*/
#ifndef __XC_H__
@@ -26,6 +27,7 @@
#include <xen/event_channel.h>
#include <xen/sched_ctl.h>
#include <xen/acm.h>
+#include <xen/version.h>
/*
* DEFINITIONS FOR CPU BARRIERS
@@ -506,4 +508,22 @@
/* Execute a privileged dom0 operation. */
int xc_dom0_op(int xc_handle, dom0_op_t *op);
+/* These structs are for libxc to get xen version and extra stuffs. */
+typedef xen_compile_info_t xc_xen_compile_info_t;
+typedef xen_extraversion_t xc_xen_extraversion_t;
+
+/**
+ * Get xen version
+ *
+ * @return a long value which encodes XEN_VERSION and XEN_SUBVERSION on success, -1 on failure.
+ */
+long xc_xen_version(int xc_handle, xc_xen_extraversion_t extraversion);
+
+/**
+ * Get xen compile info
+ *
+ * @return 0 on success, -1 on failure.
+ */
+int xc_xen_compile_info(int xc_handle, xc_xen_compile_info_t *version);
+
#endif /* __XC_H__ */
diff -r fc4e10d0455a tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c Sat Jul 2 22:37:55 2005
+++ b/tools/libxc/xc_misc.c Sun Jul 3 16:05:52 2005
@@ -130,3 +130,43 @@
return rc;
}
+
+long xc_xen_version(int xc_handle, xc_xen_extraversion_t extraversion)
+{
+ long ret;
+ privcmd_hypercall_t hypercall;
+
+ hypercall.op = __HYPERVISOR_xen_version;
+ hypercall.arg[0] = XENVER_version;
+ ret = do_xen_hypercall(xc_handle, &hypercall);
+
+ hypercall.arg[0] = XENVER_extraversion;
+ hypercall.arg[1] = (unsigned long)extraversion;
+
+ if (do_xen_hypercall(xc_handle, &hypercall) < 0)
+ {
+ if (errno == EACCES)
+ PERROR("Could not obtain xen version");
+ return -1;
+ }
+
+ return ret;
+}
+
+int xc_xen_compile_info(int xc_handle, xc_xen_compile_info_t *info)
+{
+ privcmd_hypercall_t hypercall;
+
+ hypercall.op = __HYPERVISOR_xen_version;
+ hypercall.arg[0] = XENVER_compile_info;
+ hypercall.arg[1] = (unsigned long)info;
+
+ if (do_xen_hypercall(xc_handle, &hypercall) < 0)
+ {
+ if (errno == EACCES)
+ PERROR("Could not obtain xen compile information");
+ return -1;
+ }
+
+ return 0;
+}
diff -r fc4e10d0455a tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Sat Jul 2 22:37:55 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Sun Jul 3 16:05:52 2005
@@ -2,6 +2,7 @@
* Xc.c
*
* Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
+ * Copyright (c) 2005, Nguyen Anh Quynh <aquynh@gmail.com>
*/
#include <Python.h>
@@ -686,9 +687,10 @@
if ( xc_physinfo(xc->xc_handle, &info) != 0 )
return PyErr_SetFromErrno(xc_error);
- return Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}",
+ return Py_BuildValue("{s:i,s:i,s:i,s:l,s:l,s:l}",
"ht_per_core", info.ht_per_core,
"cores", info.cores,
+ "sockets", info.sockets,
"total_pages", info.total_pages,
"free_pages", info.free_pages,
"cpu_khz", info.cpu_khz);
@@ -806,6 +808,45 @@
return zero;
}
+static PyObject *pyxc_xen_version(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ xc_xen_extraversion_t v;
+ long ret;
+ XcObject *xc = (XcObject *)self;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ if ((ret = xc_xen_version(xc->xc_handle, v)) == -1)
+ return PyErr_SetFromErrno(xc_error);
+
+ return Py_BuildValue("{s:i,s:i,s:s}",
+ "version", ret >> 16,
+ "subversion", ret & 0xFFFF,
+ "extraversion", v);
+}
+
+static PyObject *pyxc_xen_compile_info(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ xc_xen_compile_info_t v;
+ XcObject *xc = (XcObject *)self;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ if (xc_xen_compile_info(xc->xc_handle, &v) == -1)
+ return PyErr_SetFromErrno(xc_error);
+
+ return Py_BuildValue("{s:s,s:s,s:s,s:s}",
+ "compile_by", v.compile_by,
+ "compile_domain", v.compile_domain,
+ "compiler", v.compiler,
+ "compile_date", v.compile_date);
+}
static PyMethodDef pyxc_methods[] = {
{ "handle",
@@ -1081,6 +1122,18 @@
" mem_kb [long]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
+ { "xen_version",
+ (PyCFunction)pyxc_xen_version,
+ METH_KEYWORDS, "\n"
+ "Get Xen version\n"
+ "Returns: [dict] xen version and extraversion on success; empty list on error.\n" },
+
+ { "xen_compile_info",
+ (PyCFunction)pyxc_xen_compile_info,
+ METH_KEYWORDS, "\n"
+ "Get Xen compile information\n"
+ "Returns: [dict] xen compile information on success; empty list on error.\n" },
+
{ NULL, NULL, 0, NULL }
};
diff -r fc4e10d0455a tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Sat Jul 2 22:37:55 2005
+++ b/tools/python/xen/xend/XendNode.py Sun Jul 3 16:05:52 2005
@@ -35,15 +35,23 @@
def nodeinfo(self):
(sys, host, rel, ver, mch) = os.uname()
+ xen_ver = self.xc.xen_version()
+ xen_info = self.xc.xen_compile_info()
return [['system', sys],
- ['host', host],
- ['release', rel],
- ['version', ver],
+ ['host', host],
+ ['xen_release', "%i.%i%s" %(xen_ver['version'], xen_ver['subversion'], xen_ver['extraversion'])],
+ ['xen_compile_by', "%s@%s" %(xen_info['compile_by'], xen_info['compile_domain'])],
+ ['xen_compiler', xen_info['compiler']],
+ ['xen_compile_date', xen_info['compile_date']],
+ ['dom0_release', rel],
+ ['dom0_version', ver],
['machine', mch]]
def physinfo(self):
pinfo = self.xc.physinfo()
- info = [['cores', pinfo['cores']],
+ info = [['logical_cpus', pinfo['cores'] * pinfo['ht_per_core'] * pinfo['sockets']],
+ ['sockets', pinfo['sockets']],
+ ['cores_per_socket', pinfo['cores']],
['hyperthreads_per_core', pinfo['ht_per_core']],
['cpu_mhz', pinfo['cpu_khz']/1000],
['memory', pinfo['total_pages']/256],
diff -r fc4e10d0455a xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c Sat Jul 2 22:37:55 2005
+++ b/xen/arch/x86/dom0_ops.c Sun Jul 3 16:05:52 2005
@@ -181,6 +181,7 @@
pi->ht_per_core = smp_num_siblings;
pi->cores = boot_cpu_data.x86_num_cores;
+ pi->sockets = num_online_cpus();
pi->total_pages = max_page;
pi->free_pages = avail_domheap_pages();
pi->cpu_khz = cpu_khz;
diff -r fc4e10d0455a xen/common/kernel.c
--- a/xen/common/kernel.c Sat Jul 2 22:37:55 2005
+++ b/xen/common/kernel.c Sun Jul 3 16:05:52 2005
@@ -85,31 +85,31 @@
{
switch ( cmd )
{
- case XENVER_version:
- {
- return (XEN_VERSION<<16) | (XEN_SUBVERSION);
- }
+ case XENVER_version:
+ {
+ return (XEN_VERSION<<16) | (XEN_SUBVERSION);
+ }
- case XENVER_extraversion:
- {
- char extraversion[16];
- safe_strcpy(extraversion, XEN_EXTRAVERSION);
- if ( copy_to_user(arg, extraversion, sizeof(extraversion)) )
- return -EFAULT;
- return 0;
- }
+ case XENVER_extraversion:
+ {
+ xen_extraversion_t extraversion;
+ safe_strcpy(extraversion, XEN_EXTRAVERSION);
+ if ( copy_to_user(arg, extraversion, sizeof(extraversion)) )
+ return -EFAULT;
+ return 0;
+ }
- case XENVER_compile_info:
- {
- struct xen_compile_info info;
- safe_strcpy(info.compiler, XEN_COMPILER);
- safe_strcpy(info.compile_by, XEN_COMPILE_BY);
- safe_strcpy(info.compile_domain, XEN_COMPILE_DOMAIN);
- safe_strcpy(info.compile_date, XEN_COMPILE_DATE);
- if ( copy_to_user(arg, &info, sizeof(info)) )
- return -EFAULT;
- return 0;
- }
+ case XENVER_compile_info:
+ {
+ struct xen_compile_info info;
+ safe_strcpy(info.compiler, XEN_COMPILER);
+ safe_strcpy(info.compile_by, XEN_COMPILE_BY);
+ safe_strcpy(info.compile_domain, XEN_COMPILE_DOMAIN);
+ safe_strcpy(info.compile_date, XEN_COMPILE_DATE);
+ if ( copy_to_user(arg, &info, sizeof(info)) )
+ return -EFAULT;
+ return 0;
+ }
}
return -ENOSYS;
diff -r fc4e10d0455a xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h Sat Jul 2 22:37:55 2005
+++ b/xen/include/public/dom0_ops.h Sun Jul 3 16:05:52 2005
@@ -208,6 +208,7 @@
typedef struct {
u32 ht_per_core;
u32 cores;
+ u32 sockets;
u32 cpu_khz;
memory_t total_pages;
memory_t free_pages;
diff -r fc4e10d0455a xen/include/public/version.h
--- a/xen/include/public/version.h Sat Jul 2 22:37:55 2005
+++ b/xen/include/public/version.h Sun Jul 3 16:05:52 2005
@@ -20,6 +20,7 @@
/* arg == xenversion_compile_info_t. */
#define XENVER_compile_info 2
+
typedef struct xen_compile_info {
char compiler[64];
char compile_by[16];
@@ -27,4 +28,6 @@
char compile_date[32];
} xen_compile_info_t;
+typedef char xen_extraversion_t[16];
+
#endif /* __XEN_PUBLIC_VERSION_H__ */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] xm info
2005-07-03 7:13 aq
@ 2005-07-03 8:26 ` Keir Fraser
2005-07-03 8:35 ` aq
0 siblings, 1 reply; 12+ messages in thread
From: Keir Fraser @ 2005-07-03 8:26 UTC (permalink / raw)
To: aq; +Cc: xen-devel
On 3 Jul 2005, at 08:13, aq wrote:
> This patch makes "xm info" show information on xen version, compile
> info, number of socket/core, etc...
>
> In order to do that, it extends physinfo hypercall to return number of
> socket, adds few functions to libxc and extends python wrapper
> correspondingly.
Why does the patch hideously reformat xen/common/kernel.c?
-- Keir
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 8:26 ` Keir Fraser
@ 2005-07-03 8:35 ` aq
2005-07-03 8:34 ` Keir Fraser
0 siblings, 1 reply; 12+ messages in thread
From: aq @ 2005-07-03 8:35 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel
On 7/3/05, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:
>
> On 3 Jul 2005, at 08:13, aq wrote:
>
> > This patch makes "xm info" show information on xen version, compile
> > info, number of socket/core, etc...
> >
> > In order to do that, it extends physinfo hypercall to return number of
> > socket, adds few functions to libxc and extends python wrapper
> > correspondingly.
>
> Why does the patch hideously reformat xen/common/kernel.c?
do you mention the indentation i made for block of code in a switch()?
regards,
aq
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 8:35 ` aq
@ 2005-07-03 8:34 ` Keir Fraser
2005-07-03 8:49 ` aq
0 siblings, 1 reply; 12+ messages in thread
From: Keir Fraser @ 2005-07-03 8:34 UTC (permalink / raw)
To: aq; +Cc: xen-devel
On 3 Jul 2005, at 09:35, aq wrote:
>> Why does the patch hideously reformat xen/common/kernel.c?
>
> do you mention the indentation i made for block of code in a switch()?
Yes: that's the only change you made in the file, except for a one-line
change for xen_extraversion_t.
-- Keir
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 8:34 ` Keir Fraser
@ 2005-07-03 8:49 ` aq
2005-07-03 8:50 ` Keir Fraser
0 siblings, 1 reply; 12+ messages in thread
From: aq @ 2005-07-03 8:49 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel
On 7/3/05, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:
>
> On 3 Jul 2005, at 09:35, aq wrote:
>
> >> Why does the patch hideously reformat xen/common/kernel.c?
> >
> > do you mention the indentation i made for block of code in a switch()?
>
> Yes: that's the only change you made in the file, except for a one-line
> change for xen_extraversion_t.
i always think that code inside a switch() should be indented. that is
a standard coding style, no?
regards,
aq
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 8:49 ` aq
@ 2005-07-03 8:50 ` Keir Fraser
2005-07-03 12:30 ` aq
0 siblings, 1 reply; 12+ messages in thread
From: Keir Fraser @ 2005-07-03 8:50 UTC (permalink / raw)
To: aq; +Cc: xen-devel
On 3 Jul 2005, at 09:49, aq wrote:
>> Yes: that's the only change you made in the file, except for a
>> one-line
>> change for xen_extraversion_t.
>
> i always think that code inside a switch() should be indented. that is
> a standard coding style, no?
The code is indented, of course, as it is already -- but neither Xen
nor Linux indent the braces enclosing switch or case statements, and
then indent the code one tab more.
-- Keir
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] xm info
2005-07-03 8:50 ` Keir Fraser
@ 2005-07-03 12:30 ` aq
0 siblings, 0 replies; 12+ messages in thread
From: aq @ 2005-07-03 12:30 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel
On 7/3/05, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:
>
> On 3 Jul 2005, at 09:49, aq wrote:
>
> >> Yes: that's the only change you made in the file, except for a
> >> one-line
> >> change for xen_extraversion_t.
> >
> > i always think that code inside a switch() should be indented. that is
> > a standard coding style, no?
>
> The code is indented, of course, as it is already -- but neither Xen
> nor Linux indent the braces enclosing switch or case statements, and
> then indent the code one tab more.
ok, so please unindent that part.
regards,
aq
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-07-04 9:04 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-03 19:27 [PATCH] xm info Ian Pratt
2005-07-03 22:16 ` David Hopwood
2005-07-04 0:42 ` aq
-- strict thread matches above, loose matches on Subject: below --
2005-07-04 9:04 Ian Pratt
2005-07-03 22:32 Ian Pratt
2005-07-03 7:13 aq
2005-07-03 8:26 ` Keir Fraser
2005-07-03 8:35 ` aq
2005-07-03 8:34 ` Keir Fraser
2005-07-03 8:49 ` aq
2005-07-03 8:50 ` Keir Fraser
2005-07-03 12:30 ` aq
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.