Bug 735084

Summary: HMP passthrough command processing does not honour the monitor current CPU
Product: Red Hat Enterprise Linux 6 Reporter: Daniel Berrangé <berrange>
Component: qemu-kvmAssignee: Luiz Capitulino <lcapitulino>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0CC: juzhang, mkenneth, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-27 14:04:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fix HMP passthrough to honour current monitor CPU none

Description Daniel Berrangé 2011-09-01 11:52:18 UTC
Description of problem:

Several monitor commands rely on the monitor current CPU. eg, 'info registers'. The current CPU is changed by running 'cpu NN'. Doing this works fine in a traditional HMP monitor, but fails if doing it via QMP with HMP passthrough.

eg

# virsh start f14i686
Domain f14i686 started

# virsh qemu-monitor-command --hmp f14i686 'info cpus'
* CPU #0: pc=0x00000000000fe4e4 thread_id=2828 
  CPU #1: pc=0x00000000000ff0a2 (halted) thread_id=2828 
  CPU #2: pc=0x00000000000ff0a2 (halted) thread_id=2828 
  CPU #3: pc=0x00000000000ff0a2 (halted) thread_id=2828 

# virsh qemu-monitor-command --hmp f14i686 'cpu 2'

# virsh qemu-monitor-command --hmp f14i686 'info cpus'
* CPU #0: pc=0x00000000c06669ea thread_id=2828 
  CPU #1: pc=0x00000000c042849b (halted) thread_id=2828 
  CPU #2: pc=0x00000000c042849b (halted) thread_id=2828 
  CPU #3: pc=0x00000000c042849b (halted) thread_id=2828 

In this example the '*' should have moved to CPU #2.


This is a big problem, because being able to run 'info registers' and similar commands via HMP passthrough is  critical for troubleshooting / debugging running QEMU instances under libvirt

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.180.el6

How reproducible:
Always

Steps to Reproduce:
1. See above example, or alternatively:

  $  qemu-kvm -cdrom ~/boot.iso -qmp stdio -smp 4
 {"QMP": {"version": {"qemu": {"micro": 50, "minor": 15, "major": 0}, "package": ""}, "capabilities": []}}
 {"execute":"qmp_capabilities"}
 {"return": {}}
 {"execute":"human-monitor-command","arguments":{"command-line":"info cpus"}}
 {"return": "* CPU #0: pc=0x000000000010017c (halted) thread_id=2570 \r\n  CPU #1: pc=0x00000000000ff0a2 (halted) thread_id=2570 \r\n  CPU #2: pc=0x00000000000ff0a2 (halted) thread_id=2570 \r\n  CPU #3: pc=0x00000000000ff0a2 (halted) thread_id=2570 \r\n"}
 {"execute":"human-monitor-command","arguments":{"command-line":"cpu 2"}}
 {"return": {}}
 {"execute":"human-monitor-command","arguments":{"command-line":"info cpus"}}
 {"return": "* CPU #0: pc=0x000000000010017c (halted) thread_id=2570 \r\n  CPU #1: pc=0x00000000000ff0a2 (halted) thread_id=2570 \r\n  CPU #2: pc=0x00000000000ff0a2 (halted) thread_id=2570 \r\n  CPU #3: pc=0x00000000000ff0a2 (halted) thread_id=2570 \r\n"}

Notice the '*' did not update to CPU #2.

Comment 1 Daniel Berrangé 2011-09-01 11:58:59 UTC
Created attachment 520998 [details]
Fix HMP passthrough to honour current monitor CPU

This patch is against QEMU GIT master, but can almost certainly be re-diffed to RHEL-6  trees without much (if any) difficulty

Comment 2 Dor Laor 2011-09-12 07:06:25 UTC
Luiz, can you please follow up Daniel's patch?

Comment 3 Luiz Capitulino 2011-09-12 13:12:53 UTC
Daniel, as discussed on qemu-devel, you can use the "cpu-index" argument for the passthrough command.

Does it solve the issue for you?

Comment 4 Luiz Capitulino 2011-09-27 14:04:09 UTC
I believe this has been settled already in the following upstream thread:

 http://lists.gnu.org/archive/html/qemu-devel/2011-09/msg00064.html

Closing as not a bug.