Skip to contentSkip to conversation

dom0 vcpu set problem

DISCUSSION Dietmar Hahn 3 participants 5 messages May 11, 2010 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

Hi list,

I have installed latest xen-4.0-testing.hg and have a problem with setting number of vcpus in dom0.
On boot all phys cpus are used in dom0

# xm vcpu-list
Name                                ID  VCPU   CPU State   Time(s) CPU Affinity
Domain-0                             0     0     0   r--      31.3 any cpu
Domain-0                             0     1     1   -b-      15.7 any cpu
# xm vcpu-set 0 1
# xm vcpu-list
Name                                ID  VCPU   CPU State   Time(s) CPU Affinity
Domain-0                             0     0     0   r--      32.1 any cpu
Domain-0                             0     1     -   --p      16.4 any cpu
And setting back to 2 vcpus:
# xm vcpu-set 0 2
# xm vcpu-list
Name                                ID  VCPU   CPU State   Time(s) CPU Affinity
Domain-0                             0     0     0   r--      32.1 any cpu
Domain-0                             0     1     -   --p      16.4 any cpu

But in xenstore I can see:
tool = ""
xenstored = ""
vm = ""
00000000-0000-0000-0000-000000000000 = ""
on_xend_stop = "ignore"
shadow_memory = "0"
uuid = "00000000-0000-0000-0000-000000000000"
on_reboot = "restart"
image = "(linux (kernel ) (superpages 0) (nomigrate 0) (tsc_mode 0))"
ostype = "linux"
kernel = ""
cmdline = ""
ramdisk = ""
on_poweroff = "destroy"
bootloader_args = ""
on_xend_start = "ignore"
on_crash = "restart"
xend = ""
restart_count = "0"
vcpus = "2"
vcpu_avail = "3"
bootloader = ""
name = "Domain-0"
local = ""
domain = ""
0 = ""
vm = "/vm/00000000-0000-0000-0000-000000000000"
device = ""
control = ""
platform-feature-multiprocessor-suspend = "1"
error = ""
memory = ""

    target = "3639236"

guest = ""
hvmpv = ""
data = ""
cpu = ""
1 = ""
availability = "online"
0 = ""
availability = "online"
description = ""
console = ""
limit = "1048576"
type = "xenconsoled"
domid = "0"
name = "Domain-0"

And "xm log" says
[2010-05-11 07:32:31 5406] INFO (XendDomainInfo:1987) Set VCPU count on domain Domain-0 to 2

Can anybody point me where in the code the acpi cpu hotplug gets triggered to add the vcpu again to the dom0 kernel after setting the xenstore! Thanks!

Dietmar.

# xm info
host                   : amur
release                : 2.6.31.13-xen-hahn
version                : #3 SMP Fri May 7 09:32:24 CEST 2010
machine                : x86_64
nr_cpus                : 2
nr_nodes               : 1
cores_per_socket       : 2
threads_per_core       : 1
cpu_mhz                : 3166
hw_caps                : bfebfbff:20100800:00000000:00000940:0408e3fd:00000000:00000001:00000000
virt_caps              : hvm
total_memory           : 3735
free_memory            : 131
node_to_cpu            : node0:0-1
node_to_memory         : node0:131
node_to_dma32_mem      : node0:65
max_node_id            : 0
xen_major              : 4
xen_minor              : 0
xen_extra              : .1-rc1-pre
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 
xen_scheduler          : credit
xen_pagesize           : 4096
platform_params        : virt_start=0xffff800000000000
xen_changeset          : Fri Apr 23 08:45:16 2010 +0100 21122:7d1d4abd8b44
xen_commandline        : iommu=off loglvl=all guest_loglvl=all console=vga
cc_compiler            : gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux)
cc_compile_by          : hahn
cc_compile_domain      : mch.fsc.net
cc_compile_date        : Mon Apr 26 10:29:16 CEST 2010
xend_config_format     : 4
Signature · 1 line
Company details: http://ts.fujitsu.com/imprint.html
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Dietmar Hahn <[email protected]> 11.05.10 08:19 >>>

Can anybody point me where in the code the acpi cpu hotplug gets triggered to add the vcpu again to the dom0 kernel after setting the xenstore!

No, ACPI hotplug code is not involved in pv domains' vCPU adding or removal. Instead, the pv kernels create a xenstore watch on their domain's "cpu" node, reading cpu/<id>/availability when the watch fires. See drivers/xen/core/cpu_hotplug.c (for the forward ported kernels) or drivers/xen/cpu_hotplug.c (for the pv-ops ones).

Jan

#2 lore raw

Am 11.05.2010 schrieb Jan Beulich:

Quoted 11 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Dietmar Hahn <[email protected]> 11.05.10 08:19 >>>

Can anybody point me where in the code the acpi cpu hotplug gets triggered to add the vcpu again to the dom0 kernel after setting the xenstore!

No, ACPI hotplug code is not involved in pv domains' vCPU adding or removal. Instead, the pv kernels create a xenstore watch on their domain's "cpu" node, reading cpu/<id>/availability when the watch fires. See drivers/xen/core/cpu_hotplug.c (for the forward ported kernels) or drivers/xen/cpu_hotplug.c (for the pv-ops ones).

Jan

It's the pv-ops kernel from within the xen-4.0-testing.hg tree. Thanks, Jan ;-)
Pointing to the right place I found a missing cpu_up() call in the vcpu_hotplug() function.
Now all my vcpus are back again on my machine ;-) Thanks.

Dietmar.

drivers/xen/cpu_hotplug.c +1 -0
index bdfd584..f3f0c1e 100644
@@ -49,6 +49,7 @@ static void vcpu_hotplug(unsigned int cpu)
        switch (vcpu_online(cpu)) {
        case 1:
                enable_hotplug_cpu(cpu);
+               (void)cpu_up(cpu);
                break;
        case 0:
                (void)cpu_down(cpu);
Signature · 1 line
Company details: http://ts.fujitsu.com/imprint.html
#3 lore raw
Quoted 31 lines · Dietmar Hahn

Am 11.05.2010 schrieb Jan Beulich:

Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Dietmar Hahn <[email protected]> 11.05.10 08:19 >>>

Can anybody point me where in the code the acpi cpu hotplug gets triggered to add the vcpu again to the dom0 kernel after setting the xenstore!

Quoted 7 lines

No, ACPI hotplug code is not involved in pv domains' vCPU adding or removal. Instead, the pv kernels create a xenstore watch on their domain's "cpu" node, reading cpu/<id>/availability when the watch fires. See drivers/xen/core/cpu_hotplug.c (for the forward ported kernels) or drivers/xen/cpu_hotplug.c (for the pv-ops ones).

Jan

It's the pv-ops kernel from within the xen-4.0-testing.hg tree. Thanks, Jan ;-)
Pointing to the right place I found a missing cpu_up() call in the vcpu_hotplug() function.
Now all my vcpus are back again on my machine ;-) Thanks.

Dietmar.

drivers/xen/cpu_hotplug.c +0 -0
index bdfd584..f3f0c1e 100644

drivers/xen/cpu_hotplug.c static void vcpu_hotplug(unsigned int cpu) · line 55

Quoted 7 lines
drivers/xen/cpu_hotplug.c +1 -0
@@ -49,6 +49,7 @@ static void vcpu_hotplug(unsigned int cpu)
        switch (vcpu_online(cpu)) {
        case 1:
                enable_hotplug_cpu(cpu);
+               (void)cpu_up(cpu);
                break;
        case 0:
                (void)cpu_down(cpu);

No, I don't think you need update pv-ops kernel so.
vcpu-add just set it to cpu present map, not online map.
It provide user chance to echo 1 > /sys/devices/system/cpux/online to make cpu work (means, to add cpu to online map).

The original pv-ops vcpu hotplug logic is right.

Thanks,
Jinosng

#4 lore raw
In reply to Jan Beulich

Yes, acpi hotplug is for hvm vcpu hotplug.

To get more xenstore refer, you can access
http://wiki.xensource.com/xenwiki/XenStore?highlight=%28xenstore%29
http://wiki.xensource.com/xenwiki/XenStoreReference?highlight=%28xenstore%29

Attached is the tool to dump xenstore, with it, you can get info for dom0 vcpu add/remove, like:
xm vcpu-set 0 1
/local/domain/0/cpu/1/availability=offline /local/domain/0/cpu/0/availability=online

xm vcpu-set 0 2
/local/domain/0/cpu/1/availability=online
/local/domain/0/cpu/0/availability=online

pv vcpu hotplug code is as what Jan said.

Thanks,
Jinsong

Quoted 11 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Dietmar Hahn <[email protected]> 11.05.10 08:19 >>>

Can anybody point me where in the code the acpi cpu hotplug gets triggered to add the vcpu again to the dom0 kernel after setting the xenstore!

No, ACPI hotplug code is not involved in pv domains' vCPU adding or removal. Instead, the pv kernels create a xenstore watch on their domain's "cpu" node, reading cpu/<id>/availability when the watch fires. See drivers/xen/core/cpu_hotplug.c (for the forward ported kernels) or drivers/xen/cpu_hotplug.c (for the pv-ops ones).

Quoted 7 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel