From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>,
Gerd Hoffmann <kraxel@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] qapi, audio: respect build time conditions in audio schema
Date: Thu, 11 Mar 2021 11:04:36 +0000 [thread overview]
Message-ID: <YEn5RCpPbszAb/x1@redhat.com> (raw)
In-Reply-To: <87czwd50oi.fsf@dusky.pond.sub.org>
On Fri, Mar 05, 2021 at 11:56:13AM +0100, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
>
> > On Wed, Mar 03, 2021 at 08:00:59AM +0100, Gerd Hoffmann wrote:
> >> On Tue, Mar 02, 2021 at 05:55:23PM +0000, Daniel P. Berrangé wrote:
> >> > Currently the -audiodev accepts any audiodev type regardless of what is
> >> > built in to QEMU. An error only occurs later at runtime when a sound
> >> > device tries to use the audio backend.
> >> >
> >> > With this change QEMU will immediately reject -audiodev args that are
> >> > not compiled into the binary. The QMP schema will also be introspectable
> >> > to identify what is compiled in.
> >>
> >> Note that audio backends are modularized, so "compiled with
> >> CONFIG_AUDIO_ALSA" doesn't imply "alsa support is available".
> >
> > AFAIK, there's no way to handle this with QAPI schema reporting. We
> > can only conditionalize based on what's available at compile time,
> > not what's installed at runtime.
>
> Correct. The schema is fixed at compile-time. query-qmp-schema
> reflects what we compiled into the binary or modules we built along with
> the binary. It cannot tell which of the modules the binary can load.
>
> I'd like the commit message to discuss how the patch interacts with
> modules, because my own memory of the details is rather uncertain :)
>
> I guess we can configure which audio backends to build, and whether to
> build them as modules.
>
> When not building them as modules, the patch compiles out some useless
> code. Correct?
Yes.
> When building them as modules, the patch compiles out code for modules
> we don't build. Correct?
Yes.
> Such code is useless, unless you somehow manage to supply the resulting
> binary with working modules from another build. Which is probably a bad
> idea. Compiling out the code stops this (questionable) usage cold. No
> objection, but the commit message should at least hint at it.
>
> > To get runtime info, we would have to introduce an explicit
> > "query-audiodev-types" command where just report the backends
> > that have been installed.
>
> TTOCTOU. Harmless one. Still, the robust check for "can module M be
> loaded?" is to try loading it.
Ultimately from libvirt's POV, the introspection is merely used to
let libvirt report errors about unsupported configurations earlier.
So if we don't deal with compiled-but-not-installed modules, then
the effect is that libvirt won't report errors if user requests
'alsa', but QEMU will eventually report such an error when it
starts. So I'm not too worried about optimizing to cope with
modules.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-03-11 11:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 17:55 [PATCH 0/3] audio: make audiodev introspectable by mgmt apps Daniel P. Berrangé
2021-03-02 17:55 ` [PATCH 1/3] qapi, audio: add query-audiodev command Daniel P. Berrangé
2021-03-02 19:03 ` Eric Blake
2021-03-02 21:10 ` Philippe Mathieu-Daudé
2021-03-02 21:12 ` Philippe Mathieu-Daudé
2021-03-03 10:07 ` Daniel P. Berrangé
2021-03-03 10:08 ` Daniel P. Berrangé
2021-03-05 13:01 ` Markus Armbruster
2021-03-11 11:00 ` Daniel P. Berrangé
2021-03-02 17:55 ` [PATCH 2/3] qapi, audio: respect build time conditions in audio schema Daniel P. Berrangé
2021-03-02 19:05 ` Eric Blake
2021-03-03 10:09 ` Daniel P. Berrangé
2021-03-03 7:00 ` Gerd Hoffmann
2021-03-03 10:11 ` Daniel P. Berrangé
2021-03-05 10:56 ` Markus Armbruster
2021-03-11 11:04 ` Daniel P. Berrangé [this message]
2021-03-05 12:12 ` Markus Armbruster
2022-12-12 16:53 ` Thomas Huth
2022-12-14 11:28 ` Daniel P. Berrangé
2021-03-02 17:55 ` [PATCH 3/3] qapi: provide a friendly string representation of QAPI classes Daniel P. Berrangé
2021-03-02 19:06 ` Eric Blake
2021-03-02 21:02 ` Philippe Mathieu-Daudé
2021-03-05 13:18 ` Markus Armbruster
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=YEn5RCpPbszAb/x1@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=michael.roth@amd.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).