From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/8] convert libqemuutil to meson
Date: Mon, 29 Jul 2019 10:51:33 +0200 [thread overview]
Message-ID: <41165962-2d61-697f-d17a-d5fa7516e8cc@redhat.com> (raw)
In-Reply-To: <87ftmptiyq.fsf@dusky.pond.sub.org>
On 29/07/19 09:09, Markus Armbruster wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
>
>> On Sat, 27 Jul 2019 at 13:24, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>
>>> On 27/07/19 09:16, Markus Armbruster wrote:
>>>> We started with a single trace-events. That wasn't good, so we split it
>>>> up into one per directory. That isn't good, so what about splitting it
>>>> up into one per source file? Pass -DTRACE_HEADER='"trace-DIR-FOO.h"
>>>> instead of -DTRACE_HEADER='"trace-DIR.h"' when compiling DIR/FOO.c.
>>>
>>> For Make this would all work great, however not for Meson because it
>>> doesn't allow per-file compile flags.
>>
>> Apologies for randomly parachuting into this email thread, but if
>> Meson doesn't support per-file compile flags then what's the plan
>> for handling the cases where we currently need per-file compile flags ?
>> (This is one of the things that I thought was quite a nice move
>> forward in our make infrastructure -- we now have clean syntax
>> for saying "these files need to be built with these warnings disabled
>> or these extra include paths or whatever" and also "these files
>> imply we're going to need to link against library X".)
>
> I vaguely remember from my review that Meson lets us express "these
> files imply we're going to need to link against library X" even more
> clearly. I can't point you to an example, though.
Yes, you can do just
common_ss.add(when: curl, if_true: files('curl.c'))
as a replacement for
common-obj-$(CONFIG_CURL) += curl.c
curl.c-cflags = $(CURL_CFLAGS)
curl.c-libs = $(CURL_LIBS)
If conditional compilation is handled inside the file, i.e the same but
with common-obj-y, you can instead do
common_ss.add(files('vl.c'), sdl)
In both cases, the cflags from the dependency are applied to the whole
target, rather than just to repectively curl.c and vl.c. So you do lose
the possibility of specifying cflags only for a file.
There is no case where we're using per-.o file CFLAGS for anything other
than dependencies. I was using per-file -f... options in the
(not-yet-applied) CET series though. I would have to check whether
pragmas work in that case (if they do, I feel they are superior to
specifying CFLAGS in the Makefile).
>>> Meson maintainers suggest building a static library for each special set
>>> of compile flags; we could do that automatically per-directory(*) but it
>>> would be harder to scale that to per-file.
>
> This is clearly not "minimal fuss", not even per directory, let alone
> per file.
>
> It's pretty lame even for the large sets we have (per target,
> target-independent): I guess we'd either throw away the .a unused, or
> link with --wholearchive.
> For me, forwarding headers are just fine for a PoC, quite tolerable
> while a conversion is in progress, and perhaps even tolerable as a
> permanent work-around. My *actual* question is how we could do per-file
> rather than per-directory trace.h with Meson. Quoting myself:
>
> We have trace-events with hundreds of tracepoints for tens of source
> files. The generated trace.h clock in at hundreds of KiB for me.
> Messing with tracepoints in one source file recompiles most of the
> directory. This is so much better than it used to be, but clearly not
> as good as it could be.
>
> The worst of the lot is trace-root.h, which gets included for >1300 .o
> in my "build everything" tree, mostly because it contains tracepoints
> for static inline functions in widely included headers. See also
> "[PATCH 07/28] trace: Do not include qom/cpu.h into generated trace.h",
> Message-Id: <20190726120542.9894-8-armbru@redhat.com>.
>
> We started with a single trace-events. That wasn't good, so we split it
> up into one per directory. That isn't good, so what about splitting it
> up into one per source file?
>
> Any ideas?
Per-file (really per-device) would really be easier than per-directory,
I think, because with fine-grained trace-events there is a point in
including a specific header like
#include "trace-mptsas.h"
or even
#include "trace/trace-mptsas.h"
(possibly generated from trace-events-mptsas). The only constraint
would be that the subsystem names would have to be global across all of
QEMU. If it's per-directory as it is now, instead, you'd have something
like
#include "trace/trace-hw_scsi.h"
which is really ugly and then forwarding headers look better.
Paolo
next prev parent reply other threads:[~2019-07-29 8:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 16:14 [Qemu-devel] [RFC PATCH v2 0/8] Proof of concept for Meson integration Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 1/8] configure: do not include $(...) variables in config-host.mak Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 2/8] configure: set $PYTHON to a full path Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 3/8] configure: integrate Meson in the build system Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 4/8] convert libqemuutil to meson Paolo Bonzini
2019-07-13 14:15 ` Markus Armbruster
2019-07-13 21:26 ` Paolo Bonzini
2019-07-27 7:16 ` Markus Armbruster
2019-07-27 12:23 ` Paolo Bonzini
2019-07-27 18:20 ` Peter Maydell
2019-07-29 7:09 ` Markus Armbruster
2019-07-29 8:51 ` Paolo Bonzini [this message]
2019-07-29 9:21 ` Peter Maydell
2019-07-29 9:29 ` Paolo Bonzini
2019-07-29 9:32 ` Peter Maydell
2019-07-29 9:36 ` Paolo Bonzini
2019-07-29 11:12 ` Markus Armbruster
2019-07-29 8:21 ` Daniel P. Berrangé
2019-07-29 9:19 ` Peter Maydell
2019-07-29 12:41 ` Alex Bennée
2019-07-29 14:08 ` Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 5/8] libvhost-user: convert to Meson Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 6/8] vhost-user-blk: " Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 7/8] vhost-user-scsi: " Paolo Bonzini
2019-07-10 16:14 ` [Qemu-devel] [PATCH 8/8] rdmacm-mux: " Paolo Bonzini
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=41165962-2d61-697f-d17a-d5fa7516e8cc@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.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).