From: John Snow <jsnow@redhat.com>
To: "Markus Armbruster" <armbru@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,
qemu-devel@nongnu.org,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 00/20] monitor: add asynchronous command type
Date: Tue, 21 May 2019 16:50:25 -0400 [thread overview]
Message-ID: <c8682e06-76de-6fa9-8a81-72a6d70c3f15@redhat.com> (raw)
In-Reply-To: <87sgt7sxhy.fsf@dusky.pond.sub.org>
On 5/21/19 10:17 AM, Markus Armbruster wrote:
> Marc-André, before you invest your time to answer my questions below: my
> bandwidth for non-trivial QAPI features like this one is painfully
> limited. To get your QAPI conditionals in, I had to postpone other QAPI
> projects. I don't regret doing that, I'm rather pleased with how QAPI
> conditionals turned out. But I can't keep postponing all other QAPI
> projects. Because of that, this one will be slow going, at best. Sorry
> about that.
>
> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
>> Hi,
>>
>> HMP and QMP commands are handled synchronously in qemu today. But
>> there are benefits allowing the command handler to re-enter the main
>> loop if the command cannot be handled synchronously, or if it is
>> long-lasting. Some bugs such as rhbz#1230527 are difficult to solve
>> without it.
>>
>> The common solution is to use a pair of command+event in this case.
>
> In particular, background jobs (qapi/jobs.json). They grew out of block
> jobs, and are still used only for "blocky" things. Using them more
> widely would probably make sense.
> >> But this approach has a number of issues:
>> - you can't "fix" an existing command: you need a new API, and ad-hoc
>> documentation for that command+signal association, and old/broken
>> command deprecation
>
> Making a synchronous command asynchronous is an incompatible change. We
> need to let the client needs opt in. How is that done in this series?
>
>> - since the reply event is broadcasted and 'id' is used for matching the
>> request, it may conflict with other clients request 'id' space
>
> Any event that does that now is broken and needs to be fixed. The
> obvious fix is to include a monitor ID with the command ID. For events
> that can only ever be useful in the context of one particular monitor,
> we could unicast to that monitor instead; see below.
>
> Corollary: this is just a fixable bug, not a fundamental advantage of
> the async feature.
>
>> - it is arguably less efficient and elegant (weird API, useless return
>> in most cases, broadcast reply, no cancelling on disconnect etc)
>
> The return value is useful for synchronously reporting failure to start
> the background task. I grant you that background tasks may exist that
> won't ever fail to start. I challenge the idea that it's most of them.
>
> Broadcast reply could be avoided by unicasting events. If I remember
> correctly, Peter Xu even posted patches some time ago. We ended up not
> using them, because we found a better solution for the problem at hand.
> My point is: this isn't a fundamental problem, it's just the way we
> coded things up.
>
> What do you mean by "no cancelling on disconnect"?
>
> I'm ignoring "etc" unless you expand it into something specific.
>
> I'm also not taking the "weird" bait :)
>
>> The following series implements an async command solution instead. By
>> introducing a session context and a command return handler, it can:
>> - defer the return, allowing the mainloop to reenter
>> - return only to the caller (instead of broadcast events for reply)
>> - optionnally allow cancellation when the client is gone
>> - track on-going qapi command(s) per client/session
>>
>> and without introduction of new QMP APIs or client visible change.
>
> What do async commands provide that jobs lack?
>
> Why do we want both?
>
> I started to write a feature-by-feature comparison, but realized I don't
> have the time to figure out either jobs or async from their (rather
> sparse) documentation, let alone from code.
>
Sorry about that. I still have a todo item from you in my inbox to
improve the documentation there, but I've been focusing on bitmaps
documentation lately instead, but I hope to branch it out as part of my
caring a bit more about docs lately.
I'll keep an eye out here. I don't really want to prohibit things on the
sole basis that they aren't jobs, but I do want to make sure that adding
a new lifecycle paradigm for commands doesn't complicate the jobs code
in accidental ways.
I'll try to look this over too, but I have a bit of a backlog right now.
>> Existing qemu commands can be gradually replaced by async:true
>> variants when needed, while carefully reviewing the concurrency
>> aspects. The async:true commands marshaller helpers are splitted in
>> half, the calling and return functions. The command is called with a
>> QmpReturn context, that can return immediately or later, using the
>> generated return helper, which allows for a step-by-step conversion.
>>
>> The screendump command is converted to an async:true version to solve
>> rhbz#1230527. The command shows basic cancellation (this could be
>> extended if needed). It could be further improved to do asynchronous
>> IO writes as well.
>
> What is "basic cancellation"?
>
> What extension(s) do you have in mind?
>
> What's the impact of screendump writing synchronously?
>
prev parent reply other threads:[~2019-05-21 20:53 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 16:09 [Qemu-devel] [PATCH v4 00/20] monitor: add asynchronous command type Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 01/20] qmp: constify QmpCommand and list Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 02/20] json-lexer: make it safe to call destroy multiple times Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 03/20] qmp: add QmpSession Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 04/20] QmpSession: add a return callback Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 05/20] QmpSession: add json parser and use it in qga Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 06/20] monitor: use qmp session to parse json feed Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 07/20] qga: simplify dispatch_return_cb Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 08/20] QmpSession: introduce QmpReturn Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 09/20] qmp: simplify qmp_return_error() Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:09 ` [Qemu-devel] [PATCH v4 10/20] QmpSession: keep a queue of pending commands Marc-André Lureau
2019-04-09 16:09 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 11/20] QmpSession: return orderly Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 12/20] qmp: introduce asynchronous command type Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 13/20] scripts: learn 'async' qapi commands Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 14/20] qmp: add qmp_return_is_cancelled() Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 15/20] monitor: add qmp_return_get_monitor() Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 16/20] console: add graphic_hw_update_done() Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-10 8:43 ` Gerd Hoffmann
2019-04-10 8:43 ` Gerd Hoffmann
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 17/20] console: make screendump asynchronous Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-10 8:48 ` Gerd Hoffmann
2019-04-10 8:48 ` Gerd Hoffmann
2019-07-15 19:09 ` Marc-André Lureau
2019-07-30 11:23 ` Gerd Hoffmann
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 18/20] monitor: start making qmp_human_monitor_command() asynchronous Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 19/20] monitor: teach HMP about asynchronous commands Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 16:10 ` [Qemu-devel] [PATCH v4 20/20] hmp: call the asynchronous QMP screendump to fix outdated/glitches Marc-André Lureau
2019-04-09 16:10 ` Marc-André Lureau
2019-04-09 19:05 ` [Qemu-devel] [PATCH v4 00/20] monitor: add asynchronous command type no-reply
2019-04-09 19:05 ` no-reply
2019-04-09 19:07 ` no-reply
2019-04-09 19:07 ` no-reply
2019-05-17 22:21 ` Marc-André Lureau
2019-05-21 14:17 ` Markus Armbruster
2019-05-21 14:50 ` Marc-André Lureau
2019-05-23 7:52 ` Markus Armbruster
2019-05-25 12:12 ` Marc-André Lureau
2019-05-27 8:18 ` Markus Armbruster
2019-05-27 9:07 ` Gerd Hoffmann
2019-05-27 13:23 ` Markus Armbruster
2019-05-27 15:17 ` Marc-André Lureau
2019-05-28 6:09 ` Gerd Hoffmann
2019-05-31 9:15 ` Kevin Wolf
2019-05-21 20:50 ` John Snow [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c8682e06-76de-6fa9-8a81-72a6d70c3f15@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).