<div class="zcontentRow"> <p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>On Wed, Jul 19, 2017 at 08:17:49PM +0100, Dr. David Alan Gilbert wrote:</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> * Eduardo Habkost (address@hidden) wrote:</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > On Wed, Jul 19, 2017 at 10:17:36AM -0500, Eric Blake wrote:</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > On 07/19/2017 10:07 AM, Daniel P. Berrange wrote:</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > >> It doesn't.  Perhaps we should add that as a future libvirt-qemu.so API</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > >> addition, although it's probably easier to just use QMP than HMP when</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > >> using 'virsh qemu-monitor-command' if HMP doesn't do what you want.</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > > </span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > > Or special case the "cpu 1" command - ie notice that it is being</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > > requested and don't execute 'human-montor-command'. Instead just</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > > record the CPU index, and use that for future "human-monitor-command"</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > > invokations, so we get full compat with the (dubious) stateful HMP</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > > semantics that traditionally existed.</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > </span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > Is 'cpu' (and the followup commands affected by it) the only stateful</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > HMP command pairing?  Is there a way to specify multiple HMP commands in</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > a single human-monitor-command QMP call?</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > </span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > Indeed, tweaking qemu's human-monitor-command call to track the state</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > might be cleaner than having libvirt have to tweak API to work around</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > > this wart of HMP.</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > </span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > The CPU index was the only state kept by the human monitor, and I</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > think it's by design that it stopped being considered "monitor</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > state" to be tracked, and became just an argument to</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > human-monitor-command.</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > </span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > It's true that it broke compatibility of</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> >   "virsh qemu-monitor-command <domain> --hmp 'cpu <n>'",</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > when we moved to QMP, but this happened years ago, and it looks</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > like nobody was relying on it.  I don't see the point of trying</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> > to emulate the previous stateful interface.</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> </span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> IMHO Yi's fix (once reworked) is the right fix - it removes the</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> use of that piece of state, when the optional parameter is used.</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> (OK, so it needs rework not to change that state and to</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> come to some agreement as to what to use instead of cpu index number</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>> etc).</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">></span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>Agreed, as it helps us to keep the "virsh qemu-monitor-command"</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>interface simpler.  But we have 8 commands that use</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">>mon_get_cpu(), we shouldn't fix only "info lapic".</span></p><p><br></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">Thank you all!</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">I will rework this patch in this way:</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">  - extend 'info registers' with apic id value instead of current, like this:</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">      CPU#1 (socket-id: a, core-id: b, thread-id: c, apic-id: d)</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">  - add parameter 'apic id' for 'info lapic'</span></p><p><br></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">As to other commands, I want to send some other patches 'cause in my opinion not</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">all commands need 'apic-id' as index.</span></p><p><br></p><div><div><div><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">---</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">Best wishes</span></p><p><span style="font-size: 12px; font-family: arial, helvetica, sans-serif;">Yi Wang</span></p></div></div></div><p><br></p></div>