From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"John Johnson" <john.g.johnson@oracle.com>,
"thuth@redhat.com" <thuth@redhat.com>,
pkrempa@redhat.com, "Jag Raman" <jag.raman@oracle.com>,
"swapnil.ingle@nutanix.com" <swapnil.ingle@nutanix.com>,
"john.levon@nutanix.com" <john.levon@nutanix.com>,
"alex.bennee@linaro.org" <alex.bennee@linaro.org>,
qemu-devel <qemu-devel@nongnu.org>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"thanos.makatos@nutanix.com" <thanos.makatos@nutanix.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"philmd@redhat.com" <philmd@redhat.com>
Subject: Re: [PATCH v3 03/12] vfio-user: define vfio-user-server object
Date: Sat, 06 Nov 2021 07:34:25 +0100 [thread overview]
Message-ID: <87fss9vlla.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <YYUvZjg0lmaWE223@redhat.com> (Kevin Wolf's message of "Fri, 5 Nov 2021 14:19:34 +0100")
Kevin Wolf <kwolf@redhat.com> writes:
> Am 05.11.2021 um 11:08 hat Markus Armbruster geschrieben:
>> Kevin Wolf <kwolf@redhat.com> writes:
>>
>> > Am 04.11.2021 um 13:13 hat Markus Armbruster geschrieben:
>> >> The old syntax almost always has its quirks. Ideally, we'd somehow get
>> >> from quirky old to boring new in an orderly manner. Sadly, we still
>> >> don't have good solutions for that. To make progress, we commonly
>> >> combine JSON new with quirky old.
>> >>
>> >> qemu-system-FOO -object works that way. object_option_parse() parses
>> >> either JSON or QemuOpts. It wraps the former in a QObject visitor, and
>> >> the latter in an opts visitor.
>> >>
>> >> QemuOpts is flat by design[*], so the opts visitor parses flat QemuOpts
>> >> from a (possibly non-flat) QAPI type. How exactly it flattens, and how
>> >> it handles clashes I don't remember.
>> >>
>> >> Sadly, this means that we get quirky old even for new object types.
>> >
>> > For -object in the system emulator (the tools all use the keyval
>> > visitor, so there it would work as expected), the only reason that we
>> > need to keep the quirky old code path around is the list handling in
>> > memory-backend.host-nodes.
>> >
>> > The main difficulty there is that the old QemuOpts based code path
>> > allows specifying the option twice and both of them would effectively be
>> > combined. Do we have any idea how to replicate this in a keyval parser
>> > based world?
>>
>> I can see just two clean solutions, but both involve upending a lot of
>> code.
>>
>> We can fuse keyval parser and visitor to get a schema-directed parser.
>>
>> We can change the abstract keyval syntax to permit repeated keys. This
>> means replacing QDict in in the abstract syntax tree, with fallout in
>> the visitor.
>>
>> Even if we find a practical solution, I don't like the combination of
>> "you may give the same parameter multiple times, and the last one wins"
>> and "for a list-valued parameter, the values of repeated parameters are
>> collected into a list". Each makes sense on its own. The combination
>> not so much. Inheriting "last one wins" from QemuOpts may have been a
>> mistake.
>>
>> The keyval way of doing lists (inherited from the block layer's usage of
>> dotted keys? I don't remember) requires the user to count, which isn't
>> exactly nice, either.
>
> Yes. If we didn't have to maintain compatibility (or actually as soon as
> we degrade non-JSON option lists to HMP-level support), I would
> introduce [] and {} syntax for lists and dicts, even if that means that
> use of these characters in strings doesn't work any more or only in a
> limited way. I think this would be the best compromise for usability.
>
> Anyway, this doesn't help us with the compatibility problem we're
> discussing here.
>
>> > If not, do we want to use the remaining time until 6.2 to deprecate
>> > this? The nasty part is that the only syntax that works both now and in
>> > the future is JSON. We can't easily accept the new keyval syntax while
>> > still using the QemuOpts based code.
>>
>> What exactly do you propose to deprecate?
>
> We can deprecate on two different levels. I think it's useful to do
> both:
>
> 1. Broad deprecation: Stable non-JSON interfaces are degraded to
> a HMP-like compatibility promise.
Calling it "deprecation" might be confusing. HMP isn't deprecated, it's
merely not a stable interface. That's kind of like "deprecated when you
need stable", but saying "not a stable interface" is clearer.
When I write "deprecate" below, I mean something like "go use something
else (no conditions)". When I mean "use something else when you need
stable", I write "degrade" (short for "degrade to an HMP-like
compatibility promise").
> Obviously, this can only be done
> for options that support JSON.
We can also degrade or even deprecate sugar options in favor of the real
ones. Case by case, I guess.
> Peter Maydell also wants to do this
> only after a big user (read: libvirt) has implemented and is
> using JSON, basically as a proof that the alternative is working.
>
> So this can certainly be done for -object. I believe libvirt also
> uses JSON for -device now, so this should be fine now, too.
The non-sugar options supporting JSON are -audiodev, -blockdev, -compat,
-display (partially), -machine (I think), -object.
-netdev is QAPIfied, but still uses QemuOpts. Too late for 6.2, I'm
afraid.
> Possibly
> -drive (in favour of -blockdev), though I'm not completely sure if we
> have gotten rid of the final users of -drive. (CCing Peter Krempa for
> details.)
The problem with deprecating -drive is configuring onboard block
devices. We need a stable interface for that, and it must be usable
together with -blockdev.
We provided such an interface (machine properties) for some onboard
block devices starting with commit ebc29e1bea "pc: Support firmware
configuration with -blockdev". Many more remain, I believe.
> This degradation of the compatibility promise doesn't tell users what
> exactly is going to change, which is why doing the second one, too,
> might be nice.
>
> 2. Narrow deprecation: We can just deprecate the non-JSON form, or
> certain aspects of it, of memory-backend.host-nodes. This is the
> specific things that stops us from switching -object to keyval.
>
> a. Deprecate the whole option. If you want to use it and need a
> stable interface, you have to use JSON. We'll just switch the
> non-JSON form on a flag day. Before it, you need to use QemuOpts +
> OptsVisitor syntax for the list; after it, you need to use keyval
> syntax.
I parse "the whole option" as "-object with dotted keys argument".
Correct?
> b. Deprecate only repeating the option. memory-backend is changed to
> first try visiting a list, and if that fails, it visits a string
> and goes through a string visitor locally to keep supporting the
> integer range syntax.
Possible problem: integer range syntax must not leak into the JSON form.
> c. Deprecate all list values, but keep supporting a single integer
> value by using an alternate between list and int.
Single int should also not leak into JSON.
> Picking one of these four options is enough to convert -object to
> keyval. I would suggest doing both 1. and one of the options in 2.
I'm grateful for your analysis.
next prev parent reply other threads:[~2021-11-06 6:37 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 5:31 [PATCH v3 00/12] vfio-user server in QEMU Jagannathan Raman
2021-10-11 5:31 ` [PATCH v3 01/12] configure, meson: override C compiler for cmake Jagannathan Raman
2021-10-12 10:44 ` Paolo Bonzini
2021-10-11 5:31 ` [PATCH v3 02/12] vfio-user: build library Jagannathan Raman
2021-10-27 15:17 ` Stefan Hajnoczi
2021-10-29 14:17 ` Jag Raman
2021-11-01 9:56 ` Stefan Hajnoczi
2021-10-11 5:31 ` [PATCH v3 03/12] vfio-user: define vfio-user-server object Jagannathan Raman
2021-10-27 15:40 ` Stefan Hajnoczi
2021-10-29 14:42 ` Jag Raman
2021-11-01 10:34 ` Stefan Hajnoczi
2021-11-04 12:13 ` Markus Armbruster
2021-11-04 14:39 ` Kevin Wolf
2021-11-05 10:08 ` Markus Armbruster
2021-11-05 13:19 ` Kevin Wolf
2021-11-05 13:54 ` Peter Krempa
2021-11-06 6:34 ` Markus Armbruster [this message]
2021-11-08 12:05 ` Kevin Wolf
2021-11-08 12:54 ` Peter Krempa
2021-11-04 16:48 ` Stefan Hajnoczi
2021-10-11 5:31 ` [PATCH v3 04/12] vfio-user: instantiate vfio-user context Jagannathan Raman
2021-10-27 15:59 ` Stefan Hajnoczi
2021-10-29 14:59 ` Jag Raman
2021-11-01 10:35 ` Stefan Hajnoczi
2021-10-11 5:31 ` [PATCH v3 05/12] vfio-user: find and init PCI device Jagannathan Raman
2021-10-27 16:05 ` Stefan Hajnoczi
2021-10-29 15:58 ` Jag Raman
2021-11-01 10:38 ` Stefan Hajnoczi
2021-10-11 5:31 ` [PATCH v3 06/12] vfio-user: run vfio-user context Jagannathan Raman
2021-10-27 16:21 ` Stefan Hajnoczi
2021-10-28 21:55 ` John Levon
2021-10-11 5:31 ` [PATCH v3 07/12] vfio-user: handle PCI config space accesses Jagannathan Raman
2021-10-27 16:35 ` Stefan Hajnoczi
2021-10-11 5:31 ` [PATCH v3 08/12] vfio-user: handle DMA mappings Jagannathan Raman
2021-10-11 5:31 ` [PATCH v3 09/12] vfio-user: handle PCI BAR accesses Jagannathan Raman
2021-10-27 16:38 ` Stefan Hajnoczi
2021-10-11 5:31 ` [PATCH v3 10/12] vfio-user: handle device interrupts Jagannathan Raman
2021-10-11 5:31 ` [PATCH v3 11/12] vfio-user: register handlers to facilitate migration Jagannathan Raman
2021-10-27 18:30 ` Stefan Hajnoczi
2021-12-15 15:49 ` Jag Raman
2021-10-11 5:31 ` [PATCH v3 12/12] vfio-user: acceptance test Jagannathan Raman
2021-10-11 22:26 ` Philippe Mathieu-Daudé
2021-10-27 16:42 ` Stefan Hajnoczi
2021-10-27 18:33 ` [PATCH v3 00/12] vfio-user server in QEMU Stefan Hajnoczi
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=87fss9vlla.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=elena.ufimtseva@oracle.com \
--cc=jag.raman@oracle.com \
--cc=john.g.johnson@oracle.com \
--cc=john.levon@nutanix.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=swapnil.ingle@nutanix.com \
--cc=thanos.makatos@nutanix.com \
--cc=thuth@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.