Bug 612816 - QMP: query commands may return negative values
QMP: query commands may return negative values
Status: CLOSED DUPLICATE of bug 706887
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.0
All Linux
low Severity medium
: beta
: ---
Assigned To: Luiz Capitulino
Virtualization Bugs
:
: 1024215 1039804 1151305 (view as bug list)
Depends On:
Blocks: 559201 580953 1153905
  Show dependency treegraph
 
Reported: 2010-07-09 02:34 EDT by YangFeng
Modified: 2015-04-19 20:26 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-27 11:20:30 EDT
Type: ---
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 YangFeng 2010-07-09 02:34:33 EDT
Description of problem:
Sometimes query-cpus return negative value for pc item.
e.g. 
output for {'execute': 'query-cpus', 'arguments': {}, 'id': '0x4wK9Eg'} is:
{u'current': True, u'pc': -2013119777, u'halted': False, u'CPU': 0, u'thread_id': 10153}, {u'current': False, u'pc': 4645386, u'halted': False, u'CPU': 1, u'thread_id': 10154}

output for info cpus:
* CPU #0: pc=0xffffffff8006b36f (halted) thread_id=10153
  CPU #1: pc=0x000000000046e20a thread_id=10154

Version-Release number of selected component (if applicable):
uname -a in host:
Linux dhcp-65-129.nay.redhat.com.englab.nay.redhat.com 2.6.32-44.el6.x86_64 #1 SMP Wed Jul 7 15:47:50 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

rpm -qa|grep qemu in host:
qemu-kvm-tools-0.12.1.2-2.91.el6.x86_64
qemu-kvm-0.12.1.2-2.91.el6.x86_64
gpxe-roms-qemu-0.9.7-6.2.el6.noarch
qemu-img-0.12.1.2-2.91.el6.x86_64


How reproducible:
Sometimes

Steps to Reproduce:
1. Start a VM with monitor and qmp enable on console 1.
'qemu-kvm -name 'vm1' -monitor /dev/tty -qmp tcp:0:7001,server,nowait -drive file='/usr/RHEL-Server-5.5-64-virtio.qcow2',if=none,id=drive-virtio-disk1,media=disk,cache=none,boot=on,format=qcow2 -device virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1 -net nic,vlan=0,netdev=Ykio,model=e1000,macaddr='02:8F:50:B4:fe:18' -netdev tap,id=Ykio,ifname=e1000_0_8000,script=/usr/qemu-ifup-switch,downscript=no -m 2048 -smp 2 -vnc :0 -spice port=8000,disable-ticketing -rtc base=utc,clock=host -M rhel6.0.0 -usbdevice tablet -cpu qemu64,+sse2 -no-kvm-pit-reinjection'
2. Telnet to 7001 by 'telnet 0.0.0.0 7001' on console 2.
3. Run '{"execute": "qmp_capabilities"}' on console 2.
4. Run '{'execute': 'query-cpus', 'arguments': {}, 'id': '0x4wK9Eg'}' on console 2.
5. Run 'info cpus' on console 1.
  
Actual results:
'query-cpus' return negative value for pc item.

Expected results:
'query-cpus' should not return negative value for pc item.

Additional info:
Output in step 4:
{"return": [{"current": true, "CPU": 0, "pc": -2146991538, "halted": false, "thread_id": 13108}, {"current": false, "CPU": 1, "pc": -2147044497, "halted": true, "thread_id": 13109}], "id": "0x4wK9Eg"}

Output in step 5:
* CPU #0: pc=0xffffffff80079413 thread_id=13108 
  CPU #1: pc=0xffffffff8006b36f (halted) thread_id=13109
Comment 4 RHEL Product and Program Management 2010-07-15 10:01:18 EDT
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **
Comment 5 Luiz Capitulino 2010-07-15 10:47:40 EDT
I appreciate the reporter's attention to detail, but this is not an issue. At least not from qemu's side.

What happens here is that, internally qemu stores values such as the "pc" key as uint64_t (unsigned 64 bits) but our json parser only handles int64_t (signed 64 bits). So, there's a casting going on from uint64_t to int64_t and we put a negative value on the wire.

This is not an issue as long as libvirt does the cast back correctly.

Also note that this is not only about the "pc" key, but most 'big' integers we send to clients, that's, this also applies for query-balloon, query-blockstats and others.

Now, we should address this someway for upstream, we have two options:

1. Just document the behavior

2. Fix our parser to handle uint64_t correctly

According to Anthony the problem is the JSON standard, not the parser itself. But I wonder what other JSON implementations do..

Moving to rhel6.1, anyway.
Comment 8 Luiz Capitulino 2011-05-27 11:20:30 EDT
I'm marking this a duplicate of a newer bug (706887) because it contains more up to date information.

*** This bug has been marked as a duplicate of bug 706887 ***
Comment 9 Laszlo Ersek 2013-12-17 12:14:05 EST
*** Bug 1024215 has been marked as a duplicate of this bug. ***
Comment 10 Laszlo Ersek 2013-12-17 12:30:49 EST
*** Bug 1039804 has been marked as a duplicate of this bug. ***
Comment 11 Luiz Capitulino 2014-10-21 12:08:29 EDT
*** Bug 1151305 has been marked as a duplicate of this bug. ***

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