qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: Artificially target-dependend compiles
Date: Mon, 8 Nov 2021 16:38:57 +0100	[thread overview]
Message-ID: <837be094-8a70-b364-3f85-5e6af8c05304@redhat.com> (raw)
In-Reply-To: <87ilx3nk5p.fsf@dusky.pond.sub.org>

On 08/11/2021 09.09, Markus Armbruster wrote:
> Markus Armbruster <armbru@redhat.com> writes:
> 
> [...]
> 
>> I just ran into an instance that may be clearer.
>>
>> The "rocker" device is target-independent (hw/net/meson.build adds it to
>> softmmu_ss), but linked only for selected targets (hw/net/Kconfig has
>> depends on PCI && MSI_NONBROKEN).
>>
>> This makes our build machinery put CONFIG_ROCKER in
>> $TARGET-softmmu-config-devices.h, and poison it in config-poison.h.
>> Feels uncalled for.
> 
> Hmm, maybe not.
> 
> Our build process links the rocker stuff for selected targets.
> 
> The QAPI schema provides rocker definitions unconditionally.
> QAPI-generated rocker code gets linked for all targets.  The
> command handlers resolve to the real ones when on the selected targets,
> else to stubs.
> 
> This works and is fairly simple.  We link a bit of useless code
> (QAPI-generated and stubs).  query-qmp-schema can't tell us whether
> rocker is present, which is sad, but there's a work-around:
> qom-list-types.
> 
> We may still run into cases where we really want query-qmp-schema to
> tell, say because there is no easy work-around.
> 
> Making the QAPI schema definitions properly conditional does the trick,
> but makes code artificially target-dependent, slowing down the build.
> It can also lead to extra #ifdeffery, because now useless code doesn't
> compile anymore.
> 
> Simply not poisoning the CONFIG_FOO when the FOO code is actually
> target-independent avoids the target-dependency, but also messes up
> introspection: new the FOO stuff is present for all targets when *any*
> of them has it.  This cure feels worse than the disease.
> 
> Needs more thought.

Hmm, we used to have a config-all-devices.mak file in the past (see commit 
a98006bc798169e which removed it), maybe we could re-introduce something 
similar again, but producing a config-all.h header file instead? So that 
this header file contains switches like CONFIG_ANY_ACPI_VMGENID and 
CONFIG_ANY_ROCKER that are set if any of the targets uses the device ... and 
these switches would not get poisoned in common code... ?

  Thomas




  parent reply	other threads:[~2021-11-08 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 13:45 Artificially target-dependend compiles Markus Armbruster
2021-11-05 16:15 ` Paolo Bonzini
2021-11-06  7:40   ` Markus Armbruster
2021-11-08  8:09     ` Markus Armbruster
2021-11-08 10:27       ` Paolo Bonzini
2021-11-08 15:38       ` Thomas Huth [this message]
2021-11-08 16:23         ` Paolo Bonzini
2021-11-08 16:30           ` Thomas Huth

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=837be094-8a70-b364-3f85-5e6af8c05304@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=pbonzini@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).