Re: cpu hotplug issue

Gleb Natapov
2011-07-20T08:35:10Z

On Tue, Jul 19, 2011 at 07:40:55PM +0200, Vasilis Liaskovitis wrote:
> Hello,
>
> I have encountered a problem trying to hotplug a CPU in my x86_64 guest setup.
>
You do everything right. It's qemu who is buggy. Since qemu need a patch
for cpu hotplug to not crash it nobody tests it, so code bit rots.

> host os: x86_64 debian-squeeze (2.6.32-5-amd64 kernel)
> qemu-kvm: 0.14.1 or latest, both with the following (not-accepted)
> patch to allow hotplug on the main_system_bus applied:
> http://lists.gnu.org/archive/html/qemu-devel/2010-08/msg00850.html
> guest os: x86_64 debian-testing with 2.6.39-2-amd64 kernel or debian
> stable-squeeze with 2.6.32-5-amd64.
>
> example qemu-kvm command line (others have also been tried, this is
> the simplest):
> /opt/qemu-kvm/bin/qemu-system-x86_64 -enable-kvm -M pc -smp
> 1,maxcpus=2 -drive file=/opt/images/wheezy.qcow2 -monitor stdio
>
> My first issue is regarding the acpi event delivery: I am running
> "udevadm monitor" in my guest OS.
> When I issue the cpu-hotplug on my qemu-monitor:
>
> qemu_monitor: cpu_set 1 online
>
> No udev-acpi event appears in the udevadm monitor of the guest.
>
> if i issue a pci-device hotplug command afterwards e.g. adding a NIC:
>
> qemu_monitor: pci_add auto nic
>
> then the cpu-hotplug acpi/udev events appear in the udev monitor:
>
> KERNEL[1311086666.114132] add
> /devices/LNXSYSTM:00/device:00/LNXCPU:01 (acpi)
> KERNEL[1311086666.119475] add /devices/system/cpu/cpu1 (cpu)
> KERNEL[1311086666.120699] add
> /devices/virtual/thermal/cooling_device1 (thermal)
> UDEV [1311086666.158445] add /devices/system/cpu/cpu1 (cpu)
> UDEV [1311086666.159925] add
> /devices/virtual/thermal/cooling_device1 (thermal)
> UDEV [1311086666.174848] add
> /devices/LNXSYSTM:00/device:00/LNXCPU:01 (acpi)
>
> So only then is the./sys/devices/system/cpu/cpu1/ directory created.
>
> Is the acpi event supposed to be delivered to the guest OS immediately
> after the cpu_set command? Or is what I
> described expected behaviour? I am probably missing something, as
> issuing a pci_add device command seems
> irrelevant for the purpose of a CPU-hotplug acpi event.
>
> My second issue: after the successful creation of the cpu1 directory I
> try to online the cpu:
>
> echo 1 > /sys/devices/system/cpu/cpu1/online
> bash: echo: write error: Input/output error
>
> in the guest, dmesg reports:
>
> [ 2325.376355] Booting Node 0 Processor 1 APIC 0x1
> [ 2325.376357] smpboot cpu 1: start_ip = 9a000
> [ 2330.821306] CPU1: Not responding.
>
> and subsequent writes to /sys/devices/system/cpu/cpu1/online return
> invalid argument.
> Is there an obvious problem with the setup I have described?
>
> The same problem was observed with other -smp,maxcpus options as well
> e.g. -smp 2,macpus=4 and trying to online cpu3.
> I have also tried to specify "-cpu phenom" in the qemu command line,
> with no effect.
>
> qemu-0.14.1 has seabios-0.6.1 or 0.6.2 I believe, both of which
> include cpu hotplug support. I have also tried the newest
> seabios (from repository) to be on the safe side with the same result,
> so this doesn't seem to be a bios problem.
>
> thanks for any help,
>
> - Vasilis
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Gleb.