xm info
PATCH 1/1 xm info
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 : ubuntuxen_release : 3.0-develxen_compile_by : root@localdomainxen_compiler : gcc version 3.3.5 (Debian 1:3.3.5-8ubuntu2)xen_compile_date : Sun Jul 3 15:26:01 EST 2005dom0_release : 2.6.11.12-xen0dom0_version : #2 Sun Jul 3 15:39:31 EST 2005
machine : i686logical_cpus : 1
sockets : 1cores_per_socket : 1hyperthreads_per_core : 1cpu_mhz : 1094
memory : 511free_memory : 122
--
# 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(-)
tools/libxc/xc.h +20 -0
@@ -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 <[email protected]> */ #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__ */
tools/libxc/xc_misc.c +40 -0
@@ -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 ; +}
tools/python/xen/lowlevel/xc/xc.c +54 -1
81 lines not on this page · raw message
tools/python/xen/xend/XendNode.py +12 -4
@@ -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],
xen/arch/x86/dom0_ops.c +1 -0
@@ -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;
xen/common/kernel.c +23 -23
54 lines not on this page · raw message
xen/include/public/dom0_ops.h +1 -0
@@ -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;
xen/include/public/version.h +3 -0
@@ -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__ */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · aq
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
Quoted 11 lines · Keir Fraser
Quoted 6 lines · aq
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
Quoted 3 lines · aq
Quoted 1 line
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
Quoted 9 lines · Keir Fraser
Quoted 3 lines · aq
Quoted 1 line
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
Quoted 5 lines · aq
Quoted 2 lines
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
Quoted 7 lines · Keir Fraser
Quoted 4 lines · aq
Quoted 3 lines
Yes: that's the only change you made in the file, except for a one-line
change forxen_extraversion_t.
Quoted 6 lines
Quoted 2 lines
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