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/
Home Products Support Community News


[Xen-devel] RE: [PATCH] Add hypercall to expose physical CPU in xen hype

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: [Xen-devel] RE: [PATCH] Add hypercall to expose physical CPU in xen hypervisor
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Sun, 8 Nov 2009 09:59:45 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sat, 07 Nov 2009 18:03:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C719FFAD.19683%keir.fraser@xxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E2263E4A5B2284449EEBD0AAB751098418E4775B99@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C719FFAD.19683%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acpeuf300Ickgz5OTDS79L9uDNqAKgARHqPMAEMJijA=
Thread-topic: [PATCH] Add hypercall to expose physical CPU in xen hypervisor
This patch 

Keir Fraser wrote:
> On 06/11/2009 08:20, "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx> wrote:
>> This patch add hypercall to xen hypervisor to expose physical CPU
>> information. It also make some changes to current cpu online/offline
>> logic: 1) Firstly, cpu online/offline will trigger a vIRQ to dom0
>> for status changes notification. 2) It also add an interface to
>> platform operation to online/offline physical CPU. Currently the cpu
>> online/offline interface is in sysctl, which can't be triggered in
>> kernel. With this change, it is possible to trigger cpu
>> online/offline in dom0 through sysfs interface. 
> Is this and the accompanying Linux patch something that people
> really want?

The Linux patch is initially part of patch for CPU hotplug. As stated when 
discussion with Jeremy before 
(http://lists.xensource.com/archives/html/xen-devel/2009-09/msg01111.html), we 
decided to take two step method for CPU hot-add. The first step, xen will set 
the CPU as present after get notification from dom0, in the second step, Xen 
will set the CPU online and put it to schedule. Through the sysfs interface, 
the step 2 is quite easy, simple echo "1" to an xen_pcpu entry in sysfs, which 
can be used by udev rules easily.

I assume Jeremy have agreed for the interface in sysfs for pcpu , as he stated 
"Yes, that makes sense.  Would it eventually be worth mirroring the normal cpu 
heirarchy as much as possible to add an interface for stats and power 
management?" in 

When I split the original CPU hotplug patch according to Jeremy's suggestion, I 
think this part is not related to CPU hotplug so much and in fact can be 
generalized.  The issue of this method is, the sysfs interface is async, so the 
tools may miss latest change. I assume it should be accptable since even with 
directly hypercall , the information may be changed still.

As for usefulness of the patch, I'd get more input from community. For Linux 
kernel patch, an central sysfs entry will be helpful IMO. 
For the hypercall patch, currently there are several methods to expose the 
physical CPU information to administrative tools or dom0, at least including: 
XEN_SYSCTL_getcpuinfo, XEN_SYSCTL_pm_op_get_cputopo, XEN_MC_physcpuinfo (The 
XEN_MC_physcpuinfo includes MCA information also), but none of them can meet my 
requirement, and none of them can be extended easily, so I have to create a new 
one. I tihnk if there is a central hypercall to provide all physical CPU 
information, it will be helpful.  

BTW, I really can't tell why XEN_SYSCTL_getcpuinfo will only provide idle_time 
while comments stated as "Get physical CPU information".

> The new platform hypercall will never be changeable for compatibility
> reasons and looks kinda... arbitrary.

Yes, current interface is not flexible, and is only for CPU hotplug support. If 
needed and agreed, I'd happy to extent it as a general interface to fetch 
physical CPU information, including: 
1) Basic information like vendor/model/capability
2) Topo info, like initial APIC ID, the cores_per_package, thread_per_core etc.
3) CPU stat information,like online stat, idle_time etc.

As for make it extensible, I'd have a version number and leave space for future 
extenstion, how about it?

Yunhong Jiang

> Personally I'd rather not take it.
> -- Keir
Xen-devel mailing list