RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 612816 - QMP: query commands may return negative values
Summary: QMP: query commands may return negative values
Keywords:
Status: CLOSED DUPLICATE of bug 706887
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: beta
: ---
Assignee: Luiz Capitulino
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1024215 1039804 1151305 (view as bug list)
Depends On:
Blocks: 559201 580953 1153905
TreeView+ depends on / blocked
 
Reported: 2010-07-09 06:34 UTC by YangFeng
Modified: 2015-04-20 00:26 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-27 15:20:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description YangFeng 2010-07-09 06:34:33 UTC
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 Program Management 2010-07-15 14:01:18 UTC
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 14:47:40 UTC
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 15:20:30 UTC
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 17:14:05 UTC
*** Bug 1024215 has been marked as a duplicate of this bug. ***

Comment 10 Laszlo Ersek 2013-12-17 17:30:49 UTC
*** Bug 1039804 has been marked as a duplicate of this bug. ***

Comment 11 Luiz Capitulino 2014-10-21 16:08:29 UTC
*** 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.