All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Daniel P. Berrange" <berrange@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/8] convert libqemuutil to meson
Date: Mon, 29 Jul 2019 09:09:49 +0200	[thread overview]
Message-ID: <87ftmptiyq.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA8J5AsEC+p3vAQ0H1emN-GS3T5GSj579tS=qC76WjkTVQ@mail.gmail.com> (Peter Maydell's message of "Sat, 27 Jul 2019 19:20:15 +0100")

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.

Aside: I can't apply this series anymore.  I tried master, failed, tried
a merge commit shortly before its posting date, failed, gave up.  Can I
git-pull it from somewhere?

Losing the ability to add compiler flags per file with minimal fuss
would be regrettable.  How regrettable?  I append results of a quick
grep.

>> 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.

The grep below shows multiple instances of per-file.

We should explore how to handle typical instances before we commit to
the conversion project.

>> (*) Still, I'd rather go on with the forwarding headers and look into
>> that later, to ease review.

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?


$ git-grep -F o-cflags
Makefile.objs:bt-host.o-cflags := $(BLUEZ_CFLAGS)
Makefile.objs:vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS)
Makefile.objs:qemu-seccomp.o-cflags := $(SECCOMP_CFLAGS)
Makefile.objs:vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
audio/Makefile.objs:sdl.mo-cflags := $(SDL_CFLAGS)
block/Makefile.objs:iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
block/Makefile.objs:curl.o-cflags      := $(CURL_CFLAGS)
block/Makefile.objs:rbd.o-cflags       := $(RBD_CFLAGS)
block/Makefile.objs:gluster.o-cflags   := $(GLUSTERFS_CFLAGS)
block/Makefile.objs:ssh.o-cflags       := $(LIBSSH_CFLAGS)
block/Makefile.objs:parallels.o-cflags := $(LIBXML2_CFLAGS)
chardev/Makefile.objs:baum.o-cflags := $(SDL_CFLAGS)
contrib/vhost-user-gpu/Makefile.objs:main.o-cflags := $(PIXMAN_CFLAGS) $(GBM_CFLAGS)
contrib/vhost-user-gpu/Makefile.objs:virgl.o-cflags := $(VIRGL_CFLAGS) $(GBM_CFLAGS)
contrib/vhost-user-gpu/Makefile.objs:vugbm.o-cflags := $(GBM_CFLAGS)
disas/Makefile.objs:arm-a64.o-cflags := -I$(libvixldir) -Wno-sign-compare
docs/devel/build-system.txt:  curl.o-cflags      := $(CURL_CFLAGS)
docs/devel/build-system.txt:  iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
docs/devel/build-system.txt:  curl.o-cflags      := $(CURL_CFLAGS)
hw/display/Makefile.objs:milkymist-tmu2.o-cflags := $(X11_CFLAGS) $(OPENGL_CFLAGS)
hw/display/Makefile.objs:virtio-gpu.o-cflags := $(VIRGL_CFLAGS)
hw/display/Makefile.objs:virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS)
hw/usb/Makefile.objs:smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
hw/usb/Makefile.objs:redirect.o-cflags = $(USB_REDIR_CFLAGS)
hw/usb/Makefile.objs:host-libusb.o-cflags := $(LIBUSB_CFLAGS)
hw/usb/Makefile.objs:xen-usb.o-cflags := $(LIBUSB_CFLAGS)
net/Makefile.objs:slirp.o-cflags := $(SLIRP_CFLAGS)
rules.mak:            $(if $($o-cflags), $o-cflags $(eval save-vars-$o-cflags := $($o-cflags))$(eval $o-cflags := )) \
rules.mak:            $(if $($o-cflags),
rules.mak:                $(eval $1$o-cflags := $($o-cflags)))
rules.mak:        # Pass the .mo-cflags and .mo-libs along to its member objects
rules.mak:                $(if $($o-cflags), $(eval $p-cflags += $($o-cflags)))
target/unicore32/Makefile.objs:helper.o-cflags := $(CURSES_CFLAGS)
tests/Makefile.include:tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
tests/Makefile.include:tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
tests/Makefile.include:tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
tests/Makefile.include:tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
ui/Makefile.objs:sdl.mo-cflags := $(SDL_CFLAGS)
ui/Makefile.objs:gtk.mo-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
ui/Makefile.objs:x_keymap.o-cflags := $(X11_CFLAGS)
ui/Makefile.objs:curses.mo-cflags := $(CURSES_CFLAGS) $(ICONV_CFLAGS)
ui/Makefile.objs:spice-app.mo-cflags := $(GIO_CFLAGS)
$ git-grep ':[^=].*CFLAGS'
Makefile:qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
Makefile:qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
configure:# Note: the prototype is needed since QEMU_CFLAGS
pc-bios/s390-ccw/netboot.mak:$(NETOBJS): QEMU_CFLAGS += $(LIBC_INC) $(LIBNET_INC)
rules.mak:module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
rules.mak:# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
rules.mak:                   $(eval $($o-objs): CFLAGS += $(DSO_OBJ_CFLAGS))
target/nios2/Makefile.objs:$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
tests/tcg/aarch64/Makefile.softmmu-target:memory: CFLAGS+=-DCHECK_UNALIGNED=1
tests/tcg/alpha/Makefile.softmmu-target:memory: CFLAGS+=-DCHECK_UNALIGNED=0
tests/tcg/alpha/Makefile.target:test-cmov: EXTRA_CFLAGS=-DTEST_CMOV
tests/tcg/arm/Makefile.softmmu-target:test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0
tests/tcg/arm/Makefile.target:hello-arm: CFLAGS+=-marm -ffreestanding
tests/tcg/arm/Makefile.target:test-arm-iwmmxt: CFLAGS+=-marm -march=iwmmxt -mabi=aapcs -mfpu=fpv4-sp-d16
tests/tcg/arm/Makefile.target:# fcvt: CFLAGS+=-march=armv8.2-a+fp16 -mfpu=neon-fp-armv8
tests/tcg/i386/Makefile.softmmu-target:memory: CFLAGS+=-DCHECK_UNALIGNED=1
tests/tcg/i386/Makefile.target:hello-i386: CFLAGS+=-ffreestanding
tests/tcg/mips/Makefile.target:hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -mabi=32


  reply	other threads:[~2019-07-29  7:10 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 [this message]
2019-07-29  8:51               ` Paolo Bonzini
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=87ftmptiyq.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@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 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.