Skip to contentSkip to conversation

Improving CPU hotplug for 4.3 with qemu-xen

RFC Anthony PERARD 4 participants 5 messages Jul 19, 2013 – Aug 7, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

The cpu hotplug that have been backported from QEMU to qemu-xen (1.5 to 1.3) is incomplete. Especially, there is no way to know if a CPU is already marked as online by qemu. This result by those error messages from libxl:

libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 0, it already exists
libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 1, it already exists

So I tried to backport more patches so it will become possible for libxl to get the list of online cpu.

But this result in *a lot* of patches.

Here is the git tree and see the list of patches at the end of the mail:
git://xenbits.xen.org/people/aperard/qemu-dm.git backport-cpu-device

There is still some work to be done like making sure everything is working properly and making some patches to use it with libxl.

So George, is it worth getting those patches into Xen 4.3 to get ride of the error message ?

cpu: Change parent type to Device
qdev: Fold state enum into bool realized
qdev: Prepare "realized" property
cpu: Prepare QOM realizefn
target-i386: Update X86CPU to QOM realizefn
cpu: Introduce cpu_resume(), for single CPU
target-i386: Split out CPU creation and features parsing
cpu: Resume CPU from DeviceClass::realize() if hot-plugged Revert "xen: Implement hot_add_cpu hook."
Revert "acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest"
cpu: Introduce CPU hot-plug notifier
cpu: Add helper cpu_exists(), to check if CPU with specified id exists
acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest
target-i386: Introduce feat2prop() for CPU properties
target-i386: Introduce apic-id CPU property
target-i386: Do not allow to set apic-id once CPU is realized
target-i386: Replace MSI_SPACE_SIZE with APIC_SPACE_SIZE qapi/qmp-registry.c: Include headers it needs qga/channel-posix.c: Include headers it needs
user: Move *-user/qemu-types.h to main directory
user: Rename qemu-types.h to qemu-user-types.h
Create qemu-types.h for struct typedefs
qlist.h: Do not include qemu-common.h
sysbus: make SysBusDeviceClass::init optional
target-i386: Introduce ICC bus/device/bridge
target-i386: Attach ICC bus to CPU on its creation
a fix for cpu_x86_create
fix machine initialization.
extract/unify the constant 0xfee00000 as APIC_DEFAULT_ADDRESS
kvmvapic: Make dependency on sysbus.h explicit
target-i386: Move APIC to ICC bus
pc: Implement QEMUMachine::hot_add_cpu hook

Signature · 1 line
Anthony PERARD
#1 lore raw
Quoted 48 lines · Anthony PERARD

Hi,

The cpu hotplug that have been backported from QEMU to qemu-xen (1.5 to 1.3) is incomplete. Especially, there is no way to know if a CPU is already marked as online by qemu. This result by those error messages from libxl:

libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 0, it already exists
libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 1, it already exists

So I tried to backport more patches so it will become possible for libxl to get the list of online cpu.

But this result in *a lot* of patches.

Here is the git tree and see the list of patches at the end of the mail:
git://xenbits.xen.org/people/aperard/qemu-dm.git backport-cpu-device

There is still some work to be done like making sure everything is working properly and making some patches to use it with libxl.

So George, is it worth getting those patches into Xen 4.3 to get ride of the error message ?

cpu: Change parent type to Device
qdev: Fold state enum into bool realized
qdev: Prepare "realized" property
cpu: Prepare QOM realizefn
target-i386: Update X86CPU to QOM realizefn
cpu: Introduce cpu_resume(), for single CPU
target-i386: Split out CPU creation and features parsing
cpu: Resume CPU from DeviceClass::realize() if hot-plugged Revert "xen: Implement hot_add_cpu hook."
Revert "acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest"
cpu: Introduce CPU hot-plug notifier
cpu: Add helper cpu_exists(), to check if CPU with specified id exists
acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest
target-i386: Introduce feat2prop() for CPU properties
target-i386: Introduce apic-id CPU property
target-i386: Do not allow to set apic-id once CPU is realized
target-i386: Replace MSI_SPACE_SIZE with APIC_SPACE_SIZE qapi/qmp-registry.c: Include headers it needs qga/channel-posix.c: Include headers it needs
user: Move *-user/qemu-types.h to main directory

Quoted 8 lines

user: Rename qemu-types.h to qemu-user-types.h Create qemu-types.h for struct typedefs qlist.h: Do not include qemu-common.h
sysbus: make SysBusDeviceClass::init optional
target-i386: Introduce ICC bus/device/bridge
target-i386: Attach ICC bus to CPU on its creation a fix for cpu_x86_create
fix machine initialization.

These two commits worry me.
I have a vague recollection that we hit both issues at some point in the past and we fixed them properly. I would rather have the proper fix than these two hacks if it's possible.

Quoted 4 lines

extract/unify the constant 0xfee00000 as APIC_DEFAULT_ADDRESS
kvmvapic: Make dependency on sysbus.h explicit
target-i386: Move APIC to ICC bus
pc: Implement QEMUMachine::hot_add_cpu hook

#2 lore raw
In reply to Anthony PERARD
Quoted 17 lines · Anthony PERARD

Hi,

The cpu hotplug that have been backported from QEMU to qemu-xen (1.5 to 1.3) is incomplete. Especially, there is no way to know if a CPU is already marked as online by qemu. This result by those error messages from libxl:

libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 0, it already exists
libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 1, it already exists

So I tried to backport more patches so it will become possible for libxl to get the list of online cpu.

But this result in *a lot* of patches.

Quoted 8 lines

Here is the git tree and see the list of patches at the end of the mail:
git://xenbits.xen.org/people/aperard/qemu-dm.git backport-cpu-device

There is still some work to be done like making sure everything is working properly and making some patches to use it with libxl.

So George, is it worth getting those patches into Xen 4.3 to get ride of the error message ?

I think updates to the stable tree are now IanJ's decision. It seems like this is an awful lot to backport.

-George

#3 lore raw

George Dunlap writes ("Re: [Xen-devel] [RFC] Improving CPU hotplug for 4.3 with qemu-xen"):

Quoted 12 lines
Quoted 10 lines · Anthony PERARD

The cpu hotplug that have been backported from QEMU to qemu-xen (1.5 to 1.3) is incomplete. Especially, there is no way to know if a CPU is already marked as online by qemu. This result by those error messages from libxl:

libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 0, it already exists
libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 1, it already exists

Quoted 7 lines
Quoted 7 lines

So I tried to backport more patches so it will become possible for libxl to get the list of online cpu.

But this result in *a lot* of patches.

Here is the git tree and see the list of patches at the end of the mail:
git://xenbits.xen.org/people/aperard/qemu-dm.git backport-cpu-device

Blimey.

Quoted 2 lines

I think updates to the stable tree are now IanJ's decision. It seems like this is an awful lot to backport.

I agree. I don't think this is really backport material. Stefano, do you have an opinion ?

Ian.

#4 lore raw
Quoted 21 lines · Ian Jackson

George Dunlap writes ("Re: [Xen-devel] [RFC] Improving CPU hotplug for 4.3 with qemu-xen"):

Quoted 12 lines
Quoted 10 lines · Anthony PERARD

The cpu hotplug that have been backported from QEMU to qemu-xen (1.5 to 1.3) is incomplete. Especially, there is no way to know if a CPU is already marked as online by qemu. This result by those error messages from libxl:

libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 0, it already exists
libxl: error: libxl_qmp.c:289:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 1, it already exists

Quoted 7 lines
Quoted 7 lines

So I tried to backport more patches so it will become possible for libxl to get the list of online cpu.

But this result in *a lot* of patches.

Here is the git tree and see the list of patches at the end of the mail:
git://xenbits.xen.org/people/aperard/qemu-dm.git backport-cpu-device

Quoted 7 lines

Blimey.

Quoted 2 lines

I think updates to the stable tree are now IanJ's decision. It seems like this is an awful lot to backport.

I agree. I don't think this is really backport material. Stefano, do you have an opinion ?

I would prefer to avoid backporting all those patches.

Especially if the errors above only show if a user asks for a vcpu to be plugged in when it's actually already present.