From: Kevin Wolf <kwolf@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: stefanha@redhat.com, marcandre.lureau@gmail.com,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH v3 1/4] qapi: Add a 'coroutine' flag for commands
Date: Fri, 17 Jan 2020 10:40:50 +0100 [thread overview]
Message-ID: <20200117094050.GA7394@dhcp-200-226.str.redhat.com> (raw)
In-Reply-To: <87o8v2o6r2.fsf@dusky.pond.sub.org>
Am 17.01.2020 um 08:57 hat Markus Armbruster geschrieben:
> Kevin Wolf <kwolf@redhat.com> writes:
>
> > Am 16.01.2020 um 14:00 hat Markus Armbruster geschrieben:
> >> Kevin Wolf <kwolf@redhat.com> writes:
> >> > I have no idea if we will eventually get a case where the command wants
> >> > to behave different between the two modes and actually has use for a
> >> > coroutine. I hope not.
> >> >
> >> > But using two bools rather than a single enum keeps the code simple and
> >> > leaves us all options open if it turns out that we do have a use case.
> >>
> >> I can buy the argument "the two are conceptually orthogonal, although we
> >> don't haven't found a use for one of the four cases".
> >>
> >> Let's review the four combinations of the two flags once more:
> >>
> >> * allow-oob: false, coroutine: false
> >>
> >> Handler runs in main loop, outside coroutine context. Okay.
> >>
> >> * allow-oob: false, coroutine: true
> >>
> >> Handler runs in main loop, in coroutine context. Okay.
> >>
> >> * allow-oob: true, coroutine: false
> >>
> >> Handler may run in main loop or in iothread, outside coroutine
> >> context. Okay.
> >>
> >> * allow-oob: true, coroutine: true
> >>
> >> Handler may run (in main loop, in coroutine context) or (in iothread,
> >> outside coroutine context). This "in coroutine context only with
> >> execute, not with exec-oob" behavior is a bit surprising.
> >>
> >> We could document it, noting that it may change to always run in
> >> coroutine context. Or we simply reject this case as "not
> >> implemented". Since we have no uses, I'm leaning towards reject. One
> >> fewer case to test then.
> >
> > What would be the right mode of rejecting it?
> >
> > I assume we should catch it somewhere in the QAPI generator (where?) and
>
> check_flags() in expr.py?
Looks like the right place, thanks.
> > then just assert in the C code that both flags aren't set at the same
> > time?
>
> I think you already do, in do_qmp_dispatch():
>
> assert(!(oob && qemu_in_coroutine()));
>
> Not sure that's the best spot. Let's see when I review PATCH 3.
This asserts that exec-oob handlers aren't executed in coroutine
context. It doesn't assert that the handler doesn't have QCO_COROUTINE
and QCO_ALLOW_OOB set at the same time.
> >> >> > @@ -194,8 +195,9 @@ out:
> >> >> > return ret
> >> >> >
> >> >> >
> >> >> > -def gen_register_command(name, success_response, allow_oob, allow_preconfig):
> >> >> > - options = []
> >> >> > +def gen_register_command(name: str, success_response: bool, allow_oob: bool,
> >> >> > + allow_preconfig: bool, coroutine: bool) -> str:
> >> >> > + options = [] # type: List[str]
> >>
> >> One more: this is a PEP 484 type hint. With Python 3, we can use PEP
> >> 526 instead:
> >>
> >> options: List[str] = []
> >>
> >> I think we should.
> >
> > This requires Python 3.6, unfortunately. The minimum requirement for
> > building QEMU is 3.5.
>
> *Sigh*
One of the reasons why I would have preferred 3.6 as the minimum, but
our policy says that Debian oldstabe is still relevant for another two
years. *shrug*
Kevin
next prev parent reply other threads:[~2020-01-17 9:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 12:23 [PATCH v3 0/4] qmp: Optionally run handlers in coroutines Kevin Wolf
2020-01-15 12:23 ` [PATCH v3 1/4] qapi: Add a 'coroutine' flag for commands Kevin Wolf
2020-01-15 14:59 ` Markus Armbruster
2020-01-15 15:58 ` Kevin Wolf
2020-01-16 13:00 ` Markus Armbruster
2020-01-16 15:02 ` Kevin Wolf
2020-01-17 7:57 ` Markus Armbruster
2020-01-17 9:40 ` Kevin Wolf [this message]
2020-01-17 10:43 ` Markus Armbruster
2020-01-17 11:08 ` Kevin Wolf
2020-01-17 7:50 ` Markus Armbruster
2020-01-15 12:23 ` [PATCH v3 2/4] vl: Initialise main loop earlier Kevin Wolf
2020-01-15 16:26 ` Markus Armbruster
2020-01-15 12:23 ` [PATCH v3 3/4] qmp: Move dispatcher to a coroutine Kevin Wolf
2020-01-17 12:20 ` Markus Armbruster
2020-01-17 14:03 ` Kevin Wolf
2020-01-15 12:23 ` [PATCH v3 4/4] block: Mark 'block_resize' as coroutine Kevin Wolf
2020-01-16 9:45 ` Markus Armbruster
2020-01-16 10:13 ` Kevin Wolf
2020-01-16 15:13 ` Markus Armbruster
2020-01-16 15:23 ` Kevin Wolf
2020-01-17 5:44 ` Markus Armbruster
2020-01-17 9:24 ` Kevin Wolf
2020-01-17 10:46 ` Markus Armbruster
2020-01-17 8:13 ` Markus Armbruster
2020-01-17 9:13 ` Kevin Wolf
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=20200117094050.GA7394@dhcp-200-226.str.redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).