Bug 1000354

Summary: the cpu-add qmp command succeeds on a guest with --no-acpi
Product: Red Hat Enterprise Linux 7 Reporter: Wayne Sun <gsun>
Component: qemu-kvmAssignee: Igor Mammedov <imammedo>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, flang, gsun, hhuang, honzhang, juzhang, mzhan, pkrempa, qzhang, rbalakri, virt-maint, xfu, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1000357 (view as bug list) Environment:
Last Closed: 2014-11-04 14:43:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1000357    
Attachments:
Description Flags
setvcpus libvirtd log none

Description Wayne Sun 2013-08-23 09:20:13 UTC
Description of problem:
Without <acpi> feature, virsh setvcpus not fail and xml/vcpucount/vcpuinfo updated.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-2.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1. edit domain
...
   <features>
     <apic/>
     <pae/>
   </features>
...
<vcpu current='1'>3</vcpu>
...

No <acpi> feature and current as 1.

2.  start domain

# virsh start rhel7
Domain rhel7 started

Login the guest and check

# cat /proc/cpuinfo|grep processor|wc -l
1


3. Hotplug the vcpu

# virsh setvcpus rhel7 2

# echo $?
0

# virsh dumpxml rhel7

...
   <vcpu placement='static' current='2'>4</vcpu>
...

# virsh vcpucount rhel7
maximum      config        32
maximum      live          32
current      config         1
current      live           2

# virsh vcpuinfo rhel7
VCPU:           0
CPU:            8
State:          running
CPU time:       12.9s
CPU Affinity:   yyyyyyyyyyyyyyyy

VCPU:           1
CPU:            12
State:          running
CPU Affinity:   yyyyyyyyyyyyyyyy


Login the guest and check

# cat /proc/cpuinfo|grep processor|wc -l
1


Actual results:
hotplug fail but vcpu info updated

Expected results:
xml not updated

Additional info:

Comment 2 Peter Krempa 2013-09-02 10:13:03 UTC
What version of qemu did you use in the host? What is the guest OS? Could you please attach the libvirtd debug log?

Comment 3 Wayne Sun 2013-09-02 10:27:46 UTC
Created attachment 792793 [details]
setvcpus libvirtd log

(In reply to Peter Krempa from comment #2)
> What version of qemu did you use in the host? What is the guest OS? Could
> you please attach the libvirtd debug log?

pkgs:
libvirt-1.1.1-3.el7.x86_64
qemu-kvm-1.5.2-3.el7.x86_64
kernel-3.10.0-3.el7.x86_64

the guest os is rhel7.0 with:
kernel-3.10.0-2.el7.x86_64

the libvirtd log is attached

Comment 4 Peter Krempa 2013-09-02 12:24:08 UTC
According to libvirt's log qemu adds the CPU successfully:

2013-09-02 10:23:32.197+0000: 24649: debug : qemuMonitorIOWrite:465 : QEMU_MONITOR_IO_WRITE: mon=0x7f1a00003370 buf={"execute":"cpu-add","arguments":{"id":2},"id":"libvirt-9"} len=61 ret=61 errno=11

and the reply is:

2013-09-02 10:23:32.210+0000: 24649: debug : qemuMonitorIOProcess:357 : QEMU_MONITOR_IO_PROCESS: mon=0x7f1a00003370 buf={"return": {}, "id": "libvirt-9"} len=35

If you then list the vcpu threads in qemu you get the following info:

2013-09-02 10:23:32.213+0000: 24649: debug : qemuMonitorIOWrite:465 : QEMU_MONITOR_IO_WRITE: mon=0x7f1a00003370 buf={"execute":"query-cpus","id":"libvirt-10"}
 len=44 ret=44 errno=11
2013-09-02 10:23:32.223+0000: 24649: debug : qemuMonitorIOProcess:357 : QEMU_MONITOR_IO_PROCESS: mon=0x7f1a00003370 buf={"return": [{"current": true, "CPU": 0, "pc": -2130440442, "halted": true, "thread_id": 28843}, {"current": false, "CPU": 1, "pc": 4294967280, "halted": false, "thread_id": 28858}, {"current": false, "CPU": 2, "pc": 4294967280, "halted": false, "thread_id": 28864}], "id": "libvirt-10"}
 len=288

Thus qemu correctly adds a second CPU thread and initializes it. This means that we don't detect any problem and update the count in the guest XML.

The main problem is that qemu doesn't complain about ACPI not being present. Libvirt unfortunately can't forbid cpu-hotplug on non-ACPI guests as the ACPI factor is platform specific and might not represent the state on other platforms.

Moving to qemu-kvm to investigate if the "cpu-add" QMP command should return success if ACPI is disabled on a x86-64 guest.

Comment 6 Igor Mammedov 2014-11-04 14:43:20 UTC
CPU is hotplugged even without ACPI but guest is not notified about it due to
lack of ACPI hardware component. Hence guest will see hotplugged CPU only after reboot, without shutting VM down.

Issue not critical, so won't fix for RHEL7 and RHEV7.1
for RHEV7.2 there will be an extra check for ACPI introduced by upstream commit:
5279569e pc: add cpu hotplug handler to PC_MACHINE