[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] QMP event missed during startup

From: Markus Armbruster
Subject: Re: [Qemu-devel] QMP event missed during startup
Date: Thu, 09 Nov 2017 15:14:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

"Dr. David Alan Gilbert" <address@hidden> writes:

> * Ross Lagerwall (address@hidden) wrote:
>> Hi,
>> I have found an issue where QEMU emits the RESUME event during startup when
>> it starts VM execution, but it is not possible to receive this event.
>> To repro this, run:
>> qemu-system-i386 -m 256 -trace
>> enable=monitor_protocol_event_emit,file=/tmp/out -qmp
>> unix:/tmp/qmp,server,wait
>> QEMU will not start execution of the VM until something connects to the QMP
>> socket (e.g. qmp-shell). Once connected, no event is received on the QMP
>> connection but the tracepoint is hit indicating that an event has been
>> emitted. I suspect that the event is emitted while the QMP client is doing
>> the initial negotiation.
>> The reason I want to receive this event is that QEMU currently uses xenstore
>> to communicate this information to the Xen toolstack (see
>> xen-common.c:xen_change_state_handler) but we want to move to using QMP
>> rather than xenstore for this kind of thing.
>> Is this a known issue or just a bug that should be fixed?
> I'll leave it to Markus to say if it's a bug or not, but can't
> you work around this by starting qemu with -S which leaves the guest
> paused, and then continuing the guest when you have your QMP ?

You can:

<-- {"QMP": {"version": {"qemu": {"micro": 50, "minor": 10, "major": 2}, 
"package": " (v2.10.0-613-g10656079e1-dirty)"}, "capabilities": []}}
--> { "execute": "qmp_capabilities" }
<-- {"return": {}}
--> { "execute": "cont" }
<-- {"timestamp": {"seconds": 1510235984, "microseconds": 108550}, "event": 
<-- {"return": {}}

RESUME is sent in vm_prepare_start(), called from main() via vm_start(),
but only if @autostart, i.e. no -S.

The "wait" in the argument of -qmp makes QEMU wait for a QMP client to
connect to the QMP socket, long before vm_start() gets called.  However,
having connected is not sufficient for receiving events, you also have
to exit capabilities negotiation mode.  Not possible until QEMU is
running the main loop, which runs after the vm_start() quoted above.

If QMP monitors became usable before entering main_loop(), we'd have a
race condition instead.  The only reliable way to get the RESUME event
is -S.

This adds one minor item to the long list of reasons why management
software should pass -S.

All clear now?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]