From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
Laurent Vivier <laurent@vivier.eu>,
Michael Roth <michael.roth@amd.com>
Subject: Re: [RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation
Date: Fri, 5 Apr 2024 10:43:04 +0200 [thread overview]
Message-ID: <90c54fc3-29e6-48d8-995b-0fa449498353@linaro.org> (raw)
In-Reply-To: <87il0w74oh.fsf@pond.sub.org>
Hi Markus,
On 5/4/24 07:35, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>
>> User emulation requires the QAPI types. Due to the command
>> line processing, some visitor code is also used. The rest
>> is irrelevant (no QMP socket).
>>
>> Add an option to the qapi-gen script to allow generating
>> the minimum when only user emulation is being built.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> RFC: Quick PoC for Markus. It is useful for user-only builds.
>> ---
>> qapi/meson.build | 6 +++++-
>> scripts/qapi/main.py | 16 +++++++++++-----
>> 2 files changed, 16 insertions(+), 6 deletions(-)
>> @@ -50,9 +51,10 @@ def generate(schema_file: str,
>> schema = QAPISchema(schema_file)
>> gen_types(schema, output_dir, prefix, builtins)
>> gen_visit(schema, output_dir, prefix, builtins)
>> - gen_commands(schema, output_dir, prefix, gen_tracing)
>> - gen_events(schema, output_dir, prefix)
>> - gen_introspect(schema, output_dir, prefix, unmask)
>> + if not gen_types_only:
>> + gen_commands(schema, output_dir, prefix, gen_tracing)
>> + gen_events(schema, output_dir, prefix)
>> + gen_introspect(schema, output_dir, prefix, unmask)
>
> This is the behavior change, everything else is plumbing. You suppress
> generation of source code for commands, events, and introspection, i.e.
>
> qapi-commands*.[ch]
> qapi-init-commands.[ch]
> qapi-events*[ch]
> qapi-introspect.[ch]
>
> and the associated .trace-events.
>
> But none of these .c get compiled for a user-only build.
>
> So, all we save is a bit of build time and disk space: less than 0.1s on
> my machine, ~1.6MiB in ~220 files. My linux-user-only build tree clocks
> in at 317MiB in ~4900 files, a full build takes me around 30s (real
> time, -j 14 with ccache), so we're talking about 0.5% in disk space and
> 0.3% in build time.
What I want to catch is invalid uses of these headers in user-only
units.
See for example:
https://lore.kernel.org/qemu-devel/20240404194757.9343-5-philmd@linaro.org/
(Actually I have this patch based on that series).
> Moreover, the patch needs work:
>
> FAILED: tests/unit/test-qobject-input-visitor.p/test-qobject-input-visitor.c.o
> cc [...] -c ../tests/unit/test-qobject-input-visitor.c
> ../tests/unit/test-qobject-input-visitor.c:27:10: fatal error: qapi/qapi-introspect.h: No such file or directory
> 27 | #include "qapi/qapi-introspect.h"
> | ^~~~~~~~~~~~~~~~~~~~~~~~
I'd simply skip these tests on user-only builds.
> FAILED: libqemuutil.a.p/stubs_monitor-core.c.o
> cc [...] -c ../stubs/monitor-core.c
> ../stubs/monitor-core.c:3:10: fatal error: qapi/qapi-emit-events.h: No such file or directory
> 3 | #include "qapi/qapi-emit-events.h"
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
Doh, this is
https://lore.kernel.org/qemu-devel/20240404194757.9343-4-philmd@linaro.org/,
again I forgot:
Based-on: <20240404194757.9343-1-philmd@linaro.org>
>
> I don't think it's worth the bother.
OK, I'll keep it locally until I finish my full exec/ rework then.
Regards,
Phil.
prev parent reply other threads:[~2024-04-05 8:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 19:55 [RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation Philippe Mathieu-Daudé
2024-04-05 5:35 ` Markus Armbruster
2024-04-05 8:43 ` Philippe Mathieu-Daudé [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=90c54fc3-29e6-48d8-995b-0fa449498353@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=laurent@vivier.eu \
--cc=michael.roth@amd.com \
--cc=mjt@tls.msk.ru \
--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).