Bug 1272417 - qmp didnot distinguish the current work cpu when change the cpu in hmp
qmp didnot distinguish the current work cpu when change the cpu in hmp
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.2
All Unspecified
low Severity low
: rc
: ---
Assigned To: Markus Armbruster
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-16 06:59 EDT by Shuang Yu
Modified: 2016-03-28 05:46 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-26 07:01:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Shuang Yu 2015-10-16 06:59:45 EDT
Description of problem:
Check the cpu info in qmp and hmp,reassign the cpu in hmp with "(qemu)cpu $i",then check the cpu info in qmp,the qmp cannot distinguish the work cpu for now.

Version-Release number of selected component (if applicable):
kernel-3.10.0-323.el7.ppc64le
qemu-kvm-rhev-2.3.0-30.el7.ppc64le
SLOF-20150313-5.gitc89b0df.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1.Boot the guest:
# /usr/libexec/qemu-kvm -name qmp-auto -machine pseries,accel=kvm,usb=off -realtime mlock=off -nodefaults -monitor stdio -rtc base=utc -drive id=drive_image1,if=none,cache=none,format=raw,file=RHEL-Server-7.2-ppc64le-virtio.raw -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04,disable-legacy=off,disable-modern=on -m 4096 -smp 4,maxcpus=4,cores=2,threads=1,sockets=2 -vnc :1 -vga std -msg timestamp=on -usb -device usb-tablet,id=tablet1 -netdev tap,id=hostnet1,script=/etc/qemu-ifup,vhost=on -device virtio-net-pci,netdev=hostnet1,id=net1,mac=00:54:5a:5f:54:52 -qmp tcp:0:4444,server,nowait

2.
(qemu) info cpus

3.
{"execute":"query-cpus"}

4.
(qemu) cpu 1
(qemu) info cpus

5.
{"execute":"query-cpus"}

6.
(qemu) cpu 3
(qemu) info cpus

7.
{"execute":"query-cpus"}


Actual results:
After step 2:
(qemu) info cpus
* CPU #0: nip=0xc0000000000946b4 thread_id=33123
  CPU #1: nip=0xc0000000000946b4 thread_id=33124
  CPU #2: nip=0xc0000000000946b4 thread_id=33125
  CPU #3: nip=0xc0000000000946b4 thread_id=33126

After step 3:
{"execute":"query-cpus"}
{"return": [{"current": true, "CPU": 0, "nip": -4611686018426779980, "halted": false, "thread_id": 33123}, {"current": false, "CPU": 1, "nip": -4611686018426779980, "halted": false, "thread_id": 33124}, {"current": false, "CPU": 2, "nip": -4611686018426779980, "halted": false, "thread_id": 33125}, {"current": false, "CPU": 3, "nip": -4611686018426779980, "halted": false, "thread_id": 33126}]}

After step 4:
(qemu) cpu 1
(qemu) info cpus
  CPU #0: nip=0xc0000000000946b4 thread_id=33123
* CPU #1: nip=0xc0000000000946b4 thread_id=33124
  CPU #2: nip=0xc0000000000946b4 thread_id=33125
  CPU #3: nip=0xc0000000000946b4 thread_id=33126

After step 5:
{"return": [{"current": true, "CPU": 0, "nip": -4611686018426779980, "halted": false, "thread_id": 33123}, {"current": false, "CPU": 1, "nip": -4611686018426779980, "halted": false, "thread_id": 33124}, {"current": false, "CPU": 2, "nip": -4611686018426779980, "halted": false, "thread_id": 33125}, {"current": false, "CPU": 3, "nip": -4611686018426779980, "halted": false, "thread_id": 33126}]}

After step 6:
(qemu) cpu 3
(qemu) info cpus
  CPU #0: nip=0xc0000000000946b4 thread_id=33123
  CPU #1: nip=0xc0000000000946b4 thread_id=33124
  CPU #2: nip=0xc0000000000946b4 thread_id=33125
* CPU #3: nip=0xc0000000000946b4 thread_id=33126

After step 7:
{"execute":"query-cpus"}
{"return": [{"current": true, "CPU": 0, "nip": -4611686018426779980, "halted": false, "thread_id": 33123}, {"current": false, "CPU": 1, "nip": -4611686018426779980, "halted": false, "thread_id": 33124}, {"current": false, "CPU": 2, "nip": -4611686018426779980, "halted": false, "thread_id": 33125}, {"current": false, "CPU": 3, "nip": -4611686018426779980, "halted": false, "thread_id": 33126}]}



Expected results:
After the cpu changed by hmp,qmp should recognize the new work cpu,related cpu "current" value should be "true" in qmp query-cpus output.

Additional info:
Retest this issue on x86 platform and hit the same issue.
Comment 3 Markus Armbruster 2015-10-26 07:01:31 EDT
"Current CPU" is monitor-local, i.e. if you have multiple monitors,
each has its own current CPU.

Therefore, your actual results are expected: executing "cpus" in HMP
(steps 4 and 6) affects "info cpus" in the same monitor, but not
"query-cpus", because that's in a different monitor.

Moreover, only HMP monitors have a current CPU.  QMP command "cpu"
actually does nothing, and command "query-cpus" always shows CPU #0 as
current.  Actually an implementation artifact that shouldn't be relied
on; member "current" exists only for backward compatibility, and
should be ignored.  This mess is due to some confused QMP development
history, and can't be changed now.

Closing NOTABUG.  Please don't hesitate to ask if you have further
questions.

Note You need to log in before you can comment on or make changes to this bug.