From: Peter Xu <peterx@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] your mail
Date: Fri, 29 Jun 2018 17:57:18 +0800 [thread overview]
Message-ID: <20180629095718.GJ2455@xz-mi> (raw)
In-Reply-To: <20180628120044.GF3513@redhat.com>
On Thu, Jun 28, 2018 at 01:00:44PM +0100, Daniel P. Berrangé wrote:
> On Thu, Jun 28, 2018 at 10:31:42AM +0200, Markus Armbruster wrote:
> > Peter Xu <peterx@redhat.com> writes:
> >
> > > On Tue, Jun 26, 2018 at 07:21:49PM +0200, Markus Armbruster wrote:
> > >> I fooled around a bit, and I think there are a few lose ends.
> > [...]
> > >> Talking to a QMP monitor that supports OOB:
> > >>
> > >> $ socat UNIX:test-qmp READLINE,history=$HOME/.qmp_history,prompt='QMP> '
> > >> {"QMP": {"version": {"qemu": {"micro": 50, "minor": 12, "major": 2}, "package": "v2.12.0-1703-gb909799463"}, "capabilities": ["oob"]}}
> > >> QMP> { "execute": "qmp_capabilities", "arguments": { "oob": true } }
> > >> {"error": {"class": "GenericError", "desc": "Parameter 'oob' is unexpected"}}
> > >> QMP> { "execute": "qmp_capabilities", "arguments": { "enable": ["oob"] } }
> > >> {"return": {}}
> > >> QMP> { "execute": "query-qmp-schema" }
> > >> {"error": {"class": "GenericError", "desc": "Out-Of-Band capability requires that every command contains an 'id' field"}}
> > >>
> > >> Why does every command require 'id'?
> >
> > Why am I asking? Requiring 'id' is rather onerous when you play with
> > QMP by hand.
> >
> > > The COMMAND_DROPPED event is one reason, as you mentioned in the other
> > > thread. Meanwhile as long as we have OOB command it means that we can
> > > have more than one commands running in parallel, then it's a must that
> > > we can mark that out in the response to mark out which command we are
> > > replying to.
> >
> > Without OOB, the client can match response to command, because it'll
> > receive responses in command issue order.
> >
> > Example 1: after sending
> >
> > { "execute": "cmd1", ... }
> > { "execute": "cmd2", ... }
> > { "execute": "cmd3", ... }
> >
> > the client will receive three responses, first one is cmd1's, second one
> > is cmd2's, third one is cmd3's.
> >
> > With OOB, we have to independent command streams, in-band and
> > out-of-band. Each separate stream's responses arrive in-order, but the
> > two streams may be interleaved.
> >
> > Example 2: after sending
> >
> > { "execute": "cmd1", ... }
> > { "execute": "cmd2", ... }
> > { "execute": "cmd3", ... }
> > { "execute": "oob1", "control": { "run-oob": true }, ... }
> > { "execute": "oob2", "control": { "run-oob": true }, ... }
> > { "execute": "oob3", "control": { "run-oob": true }, ... }
> >
> > the client will receive six responses: cmd1's before cmd2's before
> > cmd3's, and oob1's before oob2's before oob3's.
>
> I thought the intention was that oob1, oob2, and oob3 are defined
> to return in any order. It just happens that we only hve a single
> oob processing stream right now, but we may have more in future.
Exactly.
>
> > If the client sends "id" with each command, it can match responses to
> > commands by id.
> >
> > But that's not the only way to match. Imagine the client had a perfect
> > oracle to tell it whether a response is in-band or out-of-band. Then
> > matching can work pretty much as in example 1: the first in-band
> > response is cmd1's, the second one is cmd2's, and the third one is
> > cmd3's; the first out-of-band response is oob1's, the second one is
> > oob2's and the third one is oob3's.
>
> Not if oob1/2/3 can retunr in any order in future, which I think we
> should be allowing fore.
>
> IMHO 'id' should be mandatory for oob usage.
>
> > Possible solutions other than requiring "id":
> >
> > 1. Make out-of-band responses recognizable
> >
> > Just like we copy "id" to the response, we could copy "run-oob", or
> > maybe "control".
> >
> > Solves the "match response to command" problem, doesn't solve the
> > "match COMMAND_DROPPED event to command" problem.
> >
> > Permit me a digression. "control": { "run-oob": true } is awfully
> > verbose. Back when we hashed out the OOB design, I proposed to use
> > "exec-oob" instead of "execute" to run a command OOB. I missed when
> > that morphed into flag "run-oob" wrapped in object "control". Was it
> > in response to reviewer feedback? Can you give me a pointer?
It's me who proposed this, not from any reviewer's feedback. It just
happened that no one was against it.
> >
> > The counterpart to "exec-oob" would be "return-oob" and "error-oob".
> > Hmm.
>
> I do prefer the less verbose proposal too.
But frankly speaking I still prefer current way. QMP is majorly for
clients (computer programs) rather than users to use it. Comparing to
verbosity, I would care more about coherency for how we define the
interface. Say, OOB execution is still one way to execute a command,
so naturally it should still be using the same way that we execute a
QMP command, we just need some extra fields to tell the server that
"this message is more urgent than the other ones".
If we are discussing HMP interfaces, I'll have the same preference
with both of you to consider more about whether it's user-friendly or
not. But now we are talking about QMP, then I'll prefer "control".
In the future, it's also possible to add some more sub-fields into the
"control" field. When that happens, do we want to introduce another
standalone wording for that? I would assume the answer is no.
>
> > 2. Do nothing; it's the client's problem
> >
> > If the client needs to match responses and events to commands, it
> > should use the feature that was expressly designed for helping with
> > that: "id".
> >
> > Note that QMP's initial design assumed asynchronous commands,
> > i.e. respones that may arrive in any order. Nevertheless, it did not
> > require "id". Same reasoning: if the client needs to match, it can
> > use "id".
>
> IMHO we should just mandate 'id' when using "exec-oob", as it is
> conceptually broken to use OOB without a way to match responses.
> We don't want clients relying on all OOB replies coming in sequence
> now, and then breaking when we allow multiple OOB processing threads.
> That would require us to add a eec-oob-no-really-i-mean-it command
> to allow overlapping OOB responses later.
Agreed, again.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2018-06-29 9:57 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 7:32 [Qemu-devel] [PATCH v5 0/7] monitor: enable OOB by default Peter Xu
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 1/7] chardev: comment details for CLOSED event Peter Xu
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 2/7] monitor: rename *_pop_one to *_pop_any Peter Xu
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 3/7] monitor: flush qmp responses when CLOSED Peter Xu
2018-06-20 8:33 ` Markus Armbruster
2018-06-20 8:38 ` Peter Xu
2018-06-20 9:50 ` Markus Armbruster
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 4/7] tests: iotests: drop some stderr line Peter Xu
2018-06-20 8:35 ` Markus Armbruster
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 5/7] docs: mention shared state protect for OOB Peter Xu
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 6/7] monitor: remove "x-oob", turn oob on by default Peter Xu
2018-06-20 7:32 ` [Qemu-devel] [PATCH v5 7/7] Revert "tests: Add parameter to qtest_init_without_qmp_handshake" Peter Xu
2018-06-26 17:21 ` [Qemu-devel] (no subject) Markus Armbruster
2018-06-27 7:38 ` [Qemu-devel] monitor: enable OOB by default Markus Armbruster
2018-06-27 8:41 ` Markus Armbruster
2018-06-27 10:20 ` Daniel P. Berrangé
2018-06-27 11:23 ` Markus Armbruster
2018-06-27 12:07 ` Peter Xu
2018-06-27 12:37 ` Eric Blake
2018-06-28 7:04 ` Markus Armbruster
2018-06-29 7:20 ` Peter Xu
2018-06-28 6:55 ` Markus Armbruster
2018-06-28 11:43 ` Eric Blake
2018-06-29 8:18 ` Peter Xu
2018-06-27 13:13 ` Markus Armbruster
2018-06-27 13:28 ` Daniel P. Berrangé
2018-06-28 13:02 ` Markus Armbruster
2018-06-27 13:34 ` Peter Xu
2018-06-28 13:20 ` Markus Armbruster
2018-06-29 9:01 ` Peter Xu
2018-07-18 15:08 ` Markus Armbruster
2018-07-19 13:00 ` Peter Xu
2018-06-27 7:40 ` Markus Armbruster
2018-06-27 8:35 ` Markus Armbruster
2018-06-27 12:32 ` Peter Xu
2018-06-28 9:29 ` Markus Armbruster
2018-06-29 9:42 ` Peter Xu
2018-06-27 13:36 ` Peter Xu
2018-06-27 11:59 ` [Qemu-devel] your mail Peter Xu
2018-06-28 8:31 ` Markus Armbruster
2018-06-28 11:51 ` Eric Blake
2018-06-28 12:00 ` Daniel P. Berrangé
2018-06-29 9:57 ` Peter Xu [this message]
2018-06-29 15:40 ` Eric Blake
2018-07-02 5:43 ` [Qemu-devel] monitor: enable OOB by default Markus Armbruster
2018-07-04 5:44 ` Peter Xu
2018-07-04 7:03 ` Markus Armbruster
2018-06-30 16:26 ` [Qemu-devel] [PATCH v5 0/7] " Markus Armbruster
-- strict thread matches above, loose matches on Subject: below --
2016-11-16 19:41 [Qemu-devel] (no subject) Christopher Oliver
2016-11-17 10:35 ` [Qemu-devel] your mail Kevin Wolf
2014-12-06 10:54 [Qemu-devel] (no subject) Jun Li
2014-12-06 11:17 ` [Qemu-devel] your mail Jun Li
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=20180629095718.GJ2455@xz-mi \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.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).