Skip to contentSkip to conversation

buildsys: Do not build various objects if not necessary

PATCH Applied Philippe Mathieu-Daudé 6 participants 31 messages Jan 22, 2021 – Jan 29, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v2 cover buildsys: Do not build various objects if not necessary

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Philippe Mathieu-Daudé (12):
configure: Only check for audio drivers if system-mode is selected tests/meson: Only build softfloat objects if TCG is selected pc-bios/meson: Only install EDK2 blob firmwares with system emulation
meson: Do not build optional libraries by default
meson: Restrict block subsystem processing
meson: Merge trace_events_subdirs array
meson: Restrict some trace event directories to user/system emulation
meson: Restrict emulation code
qapi/meson: Restrict qdev code to system-mode emulation qapi/meson: Remove QMP from user-mode emulation qapi/meson: Restrict system-mode specific modules qapi/meson: Restrict UI module to system emulation and tools

 configure           |  6 +++++
 meson.build         | 55 ++++++++++++++++++++++++++-------------------
 stubs/qdev.c        | 23 +++++++++++++++++++
 MAINTAINERS         |  1 +
 pc-bios/meson.build |  1 +
 qapi/meson.build    | 34 +++++++++++++++++++---------
 stubs/meson.build   |  2 ++
 tests/meson.build   | 11 +++++++--
 8 files changed, 97 insertions(+), 36 deletions(-)
 create mode 100644 stubs/qdev.c
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/12 configure: Only check for audio drivers if system-mode is selected

---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index 6f6a319c2f6..a4476d457e0 100755
@@ -2324,6 +2324,12 @@ if test -z "$want_tools"; then
     fi
 fi
 
+##########################################
+# Disable features only meaningful for system-mode emulation
+if test "$softmmu" = "no"; then
+    audio_drv_list=""
+fi
+
 ##########################################
 # Some versions of Mac OS X incorrectly define SIZE_MAX
 cat > $TMPC << EOF
Signature · 1 line
2.26.2
Reviewed-by on v2 1/12
#2 lore raw

Re: [PATCH v2 01/12] configure: Only check for audio drivers if system-mode is selected

Quoted 2 lines · Philippe Mathieu-Daudé
Quoted 21 lines
---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index 6f6a319c2f6..a4476d457e0 100755
@@ -2324,6 +2324,12 @@ if test -z "$want_tools"; then
     fi
 fi
 
+##########################################
+# Disable features only meaningful for system-mode emulation
+if test "$softmmu" = "no"; then
+    audio_drv_list=""
+fi
+
 ##########################################
 # Some versions of Mac OS X incorrectly define SIZE_MAX
 cat > $TMPC << EOF
Signature · 1 line
Alex Bennée
#3 lore raw

PATCH v2 2/12 tests/meson: Only build softfloat objects if TCG is selected

In reply to Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>
Cc: Alex Bennée <[email protected]>
Cc: Emilio G. Cota <[email protected]>

---
 tests/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/meson.build +3 -1
index 29ebaba48d2..6f1ff926d26 100644
@@ -276,7 +276,9 @@
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
-subdir('fp')
+if 'CONFIG_TCG' in config_all
+  subdir('fp')
+endif
 
 if not get_option('tcg').disabled()
   if 'CONFIG_PLUGIN' in config_host
Signature · 1 line
2.26.2
#4 lore raw

Re: [PATCH v2 02/12] tests/meson: Only build softfloat objects if TCG is selected

Quoted 16 lines · Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>
Cc: Alex Bennée <[email protected]>
Cc: Emilio G. Cota <[email protected]>

---
 tests/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/meson.build +0 -0
index 29ebaba48d2..6f1ff926d26 100644

tests/meson.build line 284

Quoted 10 lines
tests/meson.build +3 -1
@@ -276,7 +276,9 @@
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
-subdir('fp')
+if 'CONFIG_TCG' in config_all
+  subdir('fp')
+endif
 
 if not get_option('tcg').disabled()
   if 'CONFIG_PLUGIN' in config_host

Hi Philippe,

just looking at the context of this hunk,
is there a reason why we have different ways to say "tcg disabled",

ie CONFIG_TCG
and "get_option('tcg').disabled()"?

otherwise appears ok,
I am just thinking about what the next steps should be, ie how to encompass everything tcg-related in a loadable module,

but it's still too early I guess to worry about that.

Thanks,

Claudio

Reviewed-by on v2 2/12
#5 lore raw

Re: [PATCH v2 02/12] tests/meson: Only build softfloat objects if TCG is selected

In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>
Cc: Alex Bennée <[email protected]>
Cc: Emilio G. Cota <[email protected]>

Signature · 1 line
Alex Bennée
#6 lore raw

PATCH v2 3/12 pc-bios/meson: Only install EDK2 blob firmwares with system emulation

In reply to Philippe Mathieu-Daudé
---
 pc-bios/meson.build | 1 +
 1 file changed, 1 insertion(+)
pc-bios/meson.build +1 -0
index fab323af84e..68705d405ce 100644
@@ -16,6 +16,7 @@
 
   foreach f : fds
     custom_target(f,
+                  build_by_default: have_system,
                   output: f,
                   input: '@[email protected]'.format(f),
                   capture: true,
Signature · 1 line
2.26.2
#7 lore raw

PATCH v2 4/12 meson: Do not build optional libraries by default

In reply to Philippe Mathieu-Daudé

The following libraries will be selected if a feature requires it:

- capstone
- fdt
- SLiRP

---
Cc: Marc-André Lureau <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Samuel Thibault <[email protected]>

---
 meson.build | 3 +++
 1 file changed, 3 insertions(+)
meson.build +3 -0
index a1e1eb318a5..61cbb89cd44 100644
@@ -1446,6 +1446,7 @@
   ]
 
   libcapstone = static_library('capstone',
+                               build_by_default: false,
                                sources: capstone_files,
                                c_args: capstone_cargs,
                                include_directories: 'capstone/include')
@@ -1523,6 +1524,7 @@
 
     slirp_inc = include_directories('slirp', 'slirp/src')
     libslirp = static_library('slirp',
+                              build_by_default: false,
                               sources: slirp_files,
                               c_args: slirp_cargs,
                               include_directories: slirp_inc)
@@ -1568,6 +1570,7 @@
 
     fdt_inc = include_directories('dtc/libfdt')
     libfdt = static_library('fdt',
+                            build_by_default: false,
                             sources: fdt_files,
                             include_directories: fdt_inc)
     fdt = declare_dependency(link_with: libfdt,
Signature · 1 line
2.26.2
#8 lore raw

PATCH v2 5/12 meson: Restrict block subsystem processing

In reply to Philippe Mathieu-Daudé

Avoid generating module_block.h and block-gen.c if we are not going to use them.

---
Cc: [email protected]

---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meson.build +3 -1
index 61cbb89cd44..181f8795f5a 100644
@@ -1829,7 +1829,9 @@
 
 subdir('nbd')
 subdir('scsi')
-subdir('block')
+if have_block
+  subdir('block')
+endif
 
 blockdev_ss.add(files(
   'blockdev.c',
Signature · 1 line
2.26.2
#9 lore raw

Re: [PATCH v2 05/12] meson: Restrict block subsystem processing

Am 22.01.2021 um 21:44 hat Philippe Mathieu-Daudé geschrieben:

Quoted 15 lines

Avoid generating module_block.h and block-gen.c if we are not going to use them.

---
Cc: [email protected]

---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meson.build +0 -0
index 61cbb89cd44..181f8795f5a 100644

meson.build line 1837

Quoted 10 lines
meson.build +3 -1
@@ -1829,7 +1829,9 @@
 
 subdir('nbd')
 subdir('scsi')
-subdir('block')
+if have_block
+  subdir('block')
+endif
 
 blockdev_ss.add(files(
   'blockdev.c',

It feels odd to have a random have_block check in the middle of a whole bunch of lines that all deal with block layer functionality, especially when unconditional ones depend on the conditional one. (nbd, scsi and blockdev.c present in the context here certainly all can't work without block)

So should this if block become a bit longer and include all block layer related things nearby?

If not, at least a comment explaining why we're doing this would be nice.

Kevin

#10 lore raw

Re: [PATCH v2 05/12] meson: Restrict block subsystem processing

Another possibility is to place the if in block/meson.build, using subdir_done() to stop the processing of the directory.

Paolo

Il lun 25 gen 2021, 13:15 Kevin Wolf <[email protected]> ha scritto:

Quoted 42 lines

Am 22.01.2021 um 21:44 hat Philippe Mathieu-Daudé geschrieben:

Quoted 15 lines

Avoid generating module_block.h and block-gen.c if we are not going to use them.

---
Cc: [email protected]

---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meson.build +0 -0
index 61cbb89cd44..181f8795f5a 100644

meson.build line 1837

Quoted 10 lines
meson.build +3 -1
@@ -1829,7 +1829,9 @@
 
 subdir('nbd')
 subdir('scsi')
-subdir('block')
+if have_block
+  subdir('block')
+endif
 
 blockdev_ss.add(files(
   'blockdev.c',

It feels odd to have a random have_block check in the middle of a whole bunch of lines that all deal with block layer functionality, especially when unconditional ones depend on the conditional one. (nbd, scsi and blockdev.c present in the context here certainly all can't work without block)

So should this if block become a bit longer and include all block layer related things nearby?

If not, at least a comment explaining why we're doing this would be nice.

Kevin

#11 lore raw

PATCH v2 6/12 meson: Merge trace_events_subdirs array

In reply to Philippe Mathieu-Daudé

The trace_events_subdirs array is split in two different locations, merge it as one.

---
Cc: Stefan Hajnoczi <[email protected]>

---
 meson.build | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
meson.build +13 -15
index 181f8795f5a..c43538a1523 100644
@@ -1686,7 +1686,20 @@
   'accel/kvm',
   'accel/tcg',
   'crypto',
+  'hw/core',
+  'qapi',
+  'qom',
   'monitor',
+  'target/arm',
+  'target/hppa',
+  'target/i386',
+  'target/i386/kvm',
+  'target/mips',
+  'target/ppc',
+  'target/riscv',
+  'target/s390x',
+  'target/sparc',
+  'util',
 ]
 if have_user
   trace_events_subdirs += [ 'linux-user' ]
@@ -1759,21 +1772,6 @@
     'ui',
   ]
 endif
-trace_events_subdirs += [
-  'hw/core',
-  'qapi',
-  'qom',
-  'target/arm',
-  'target/hppa',
-  'target/i386',
-  'target/i386/kvm',
-  'target/mips',
-  'target/ppc',
-  'target/riscv',
-  'target/s390x',
-  'target/sparc',
-  'util',
-]
 
 vhost_user = not_found
 if 'CONFIG_VHOST_USER' in config_host
Signature · 1 line
2.26.2
Reviewed-by on v2 6/12
#12 lore raw

Re: [PATCH v2 06/12] meson: Merge trace_events_subdirs array

Quoted 48 lines · Philippe Mathieu-Daudé

The trace_events_subdirs array is split in two different locations, merge it as one.

---
Cc: Stefan Hajnoczi <[email protected]>

---
 meson.build | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
meson.build +13 -8
index 181f8795f5a..c43538a1523 100644
@@ -1686,7 +1686,20 @@
   'accel/kvm',
   'accel/tcg',
   'crypto',
+  'hw/core',
+  'qapi',
+  'qom',
   'monitor',
+  'target/arm',
+  'target/hppa',
+  'target/i386',
+  'target/i386/kvm',
+  'target/mips',
+  'target/ppc',
+  'target/riscv',
+  'target/s390x',
+  'target/sparc',
+  'util',
 ]
 if have_user
   trace_events_subdirs += [ 'linux-user' ]
@@ -1759,21 +1772,6 @@
     'ui',
   ]
 endif
-trace_events_subdirs += [
-  'hw/core',
-  'qapi',
-  'qom',
-  'target/arm',
-  'target/hppa',
-  'target/i386',
-  'target/i386/kvm',

meson.build line 1777

Quoted 10 lines
meson.build +0 -7
-  'target/mips',
-  'target/ppc',
-  'target/riscv',
-  'target/s390x',
-  'target/sparc',
-  'util',
-]
 
 vhost_user = not_found
 if 'CONFIG_VHOST_USER' in config_host
#13 lore raw

PATCH v2 7/12 meson: Restrict some trace event directories to user/system emulation

In reply to Philippe Mathieu-Daudé

---
Cc: Stefan Hajnoczi <[email protected]>

---
 meson.build | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)
meson.build +16 -12
index c43538a1523..396ea3aa19b 100644
@@ -1683,22 +1683,10 @@
 # TODO: add each directory to the subdirs from its own meson.build, once
 # we have those
 trace_events_subdirs = [
-  'accel/kvm',
-  'accel/tcg',
   'crypto',
-  'hw/core',
   'qapi',
   'qom',
   'monitor',
-  'target/arm',
-  'target/hppa',
-  'target/i386',
-  'target/i386/kvm',
-  'target/mips',
-  'target/ppc',
-  'target/riscv',
-  'target/s390x',
-  'target/sparc',
   'util',
 ]
 if have_user
@@ -1715,6 +1703,7 @@
 endif
 if have_system
   trace_events_subdirs += [
+    'accel/kvm',
     'audio',
     'backends',
     'backends/tpm',
@@ -1772,6 +1761,21 @@
     'ui',
   ]
 endif
+if have_system or have_user
+  trace_events_subdirs += [
+    'accel/tcg',
+    'hw/core',
+    'target/arm',
+    'target/hppa',
+    'target/i386',
+    'target/i386/kvm',
+    'target/mips',
+    'target/ppc',
+    'target/riscv',
+    'target/s390x',
+    'target/sparc',
+  ]
+endif
 
 vhost_user = not_found
 if 'CONFIG_VHOST_USER' in config_host
Signature · 1 line
2.26.2
#14 lore raw

PATCH v2 8/12 meson: Restrict emulation code

In reply to Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>

---
 meson.build | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
meson.build +7 -5
index 396ea3aa19b..b5afa2923b3 100644
@@ -1809,16 +1809,18 @@
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res)
 
-decodetree = generator(find_program('scripts/decodetree.py'),
-                       output: 'decode-@[email protected]',
-                       arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
+if have_system or have_user
+  decodetree = generator(find_program('scripts/decodetree.py'),
+                         output: 'decode-@[email protected]',
+                         arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
+  subdir('libdecnumber')
+  subdir('target')
+endif
 
 subdir('audio')
 subdir('io')
 subdir('chardev')
 subdir('fsdev')
-subdir('libdecnumber')
-subdir('target')
 subdir('dump')
 
 block_ss.add(files(
Signature · 1 line
2.26.2
#15 lore raw

Re: [PATCH v2 08/12] meson: Restrict emulation code

Quoted 12 lines · Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>

---
 meson.build | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
meson.build +0 -0
index 396ea3aa19b..b5afa2923b3 100644

meson.build line 1812

Quoted 7 lines
meson.build +1 -3
@@ -1809,16 +1809,18 @@
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res)
 
-decodetree = generator(find_program('scripts/decodetree.py'),
-                       output: 'decode-@[email protected]',
-                       arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
+if have_system or have_user

Maybe better as:

if not get_option('tcg').disabled()

And even clearer as:

if get_option('tcg').enabled()

assuming enabled would be "auto" or "yes".

Quoted 17 lines
meson.build +6 -2
+  decodetree = generator(find_program('scripts/decodetree.py'),
+                         output: 'decode-@[email protected]',
+                         arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
+  subdir('libdecnumber')
+  subdir('target')
+endif
 
 subdir('audio')
 subdir('io')
 subdir('chardev')
 subdir('fsdev')
-subdir('libdecnumber')
-subdir('target')
 subdir('dump')
 
 block_ss.add(files(
#16 lore raw

Re: [PATCH v2 08/12] meson: Restrict emulation code

Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>

---
 meson.build | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
meson.build +0 -0
index 396ea3aa19b..b5afa2923b3 100644

meson.build line 1812

Quoted 7 lines
meson.build +1 -3
@@ -1809,16 +1809,18 @@
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res)
 
-decodetree = generator(find_program('scripts/decodetree.py'),
-                       output: 'decode-@[email protected]',
-                       arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
+if have_system or have_user

Maybe better as:

Quoted 7 lines

if not get_option('tcg').disabled()

And even clearer as:

   if get_option('tcg').enabled()

assuming enabled would be "auto" or "yes".

^ this comment is only for the decodetree generator, not for the target/ directory ;)

Quoted 19 lines
Quoted 18 lines
meson.build +6 -2
+  decodetree = generator(find_program('scripts/decodetree.py'),
+                         output: 'decode-@[email protected]',
+                         arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
+  subdir('libdecnumber')
+  subdir('target')
+endif
 
 subdir('audio')
 subdir('io')
 subdir('chardev')
 subdir('fsdev')
-subdir('libdecnumber')
-subdir('target')
 subdir('dump')
 
 block_ss.add(files(
#17 lore raw

PATCH v2 9/12 qapi/meson: Restrict qdev code to system-mode emulation

In reply to Philippe Mathieu-Daudé

Beside a CPU device, user-mode emulation doesn't access anything else from qdev subsystem.

Tools don't need anything from qdev.

---
Cc: Laurent Vivier <[email protected]>
Cc: Eduardo Habkost <[email protected]>

---
 stubs/qdev.c      | 23 +++++++++++++++++++++++
 MAINTAINERS       |  1 +
 qapi/meson.build  |  6 +++++-
 stubs/meson.build |  2 ++
 4 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 stubs/qdev.c
stubs/qdev.c new file +23 -0
new file mode 100644
index 00000000000..92e61431344
@@ -0,0 +1,23 @@
+/*
+ * QOM stubs
+ *
+ * Copyright (c) 2021 Red Hat, Inc.
+ *
+ * Author:
+ *   Philippe Mathieu-Daudé <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qapi-events-qdev.h"
+
+void qapi_event_send_device_deleted(bool has_device,
+                                    const char *device,
+                                    const char *path)
+{
+    /* Nothing to do. */
+}
MAINTAINERS +1 -0
index 34359a99b8e..d2dd7c24228 100644
@@ -2523,6 +2523,7 @@ F: qapi/qom.json
 F: qapi/qdev.json
 F: scripts/coccinelle/qom-parent-type.cocci
 F: softmmu/qdev-monitor.c
+F: stubs/qdev.c
 F: qom/
 F: tests/check-qom-interface.c
 F: tests/check-qom-proplist.c
qapi/meson.build +5 -1
index ab68e7900e4..2839871b478 100644
@@ -35,7 +35,6 @@
   'misc-target',
   'net',
   'pragma',
-  'qdev',
   'pci',
   'qom',
   'rdma',
@@ -49,6 +48,11 @@
   'ui',
   'yank',
 ]
+if have_system
+  qapi_all_modules += [
+    'qdev',
+  ]
+endif
 
 qapi_storage_daemon_modules = [
   'block-core',
stubs/meson.build +2 -0
index 1a656cd0704..a054d5877fb 100644
@@ -53,4 +53,6 @@
 if have_system
   stub_ss.add(files('semihost.c'))
   stub_ss.add(files('xen-hw-stub.c'))
+else
+  stub_ss.add(files('qdev.c'))
 endif
Signature · 1 line
2.26.2
#18 lore raw

Re: [PATCH v2 09/12] qapi/meson: Restrict qdev code to system-mode emulation

Quoted 4 lines · Philippe Mathieu-Daudé

Beside a CPU device, user-mode emulation doesn't access anything else from qdev subsystem.

Tools don't need anything from qdev.

I prefer to avoid stubs. So if this patch can simply be dropped with no effects on 10-12, that's nicer for me.

Paolo

Quoted 89 lines

---
Cc: Laurent Vivier <[email protected]>
Cc: Eduardo Habkost <[email protected]>

---
  stubs/qdev.c      | 23 +++++++++++++++++++++++
  MAINTAINERS       |  1 +
  qapi/meson.build  |  6 +++++-
  stubs/meson.build |  2 ++
  4 files changed, 31 insertions(+), 1 deletion(-)

create mode 100644 stubs/qdev.c

stubs/qdev.c new file +23 -0
new file mode 100644
index 00000000000..92e61431344
@@ -0,0 +1,23 @@
+/*
+ * QOM stubs
+ *
+ * Copyright (c) 2021 Red Hat, Inc.
+ *
+ * Author:
+ *   Philippe Mathieu-Daudé <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qapi-events-qdev.h"
+
+void qapi_event_send_device_deleted(bool has_device,
+                                    const char *device,
+                                    const char *path)
+{
+    /* Nothing to do. */
+}
MAINTAINERS +1 -0
index 34359a99b8e..d2dd7c24228 100644
@@ -2523,6 +2523,7 @@ F: qapi/qom.json
  F: qapi/qdev.json
  F: scripts/coccinelle/qom-parent-type.cocci
  F: softmmu/qdev-monitor.c
+F: stubs/qdev.c
  F: qom/
  F: tests/check-qom-interface.c
  F: tests/check-qom-proplist.c
qapi/meson.build +5 -1
index ab68e7900e4..2839871b478 100644
@@ -35,7 +35,6 @@
    'misc-target',
    'net',
    'pragma',
-  'qdev',
    'pci',
    'qom',
    'rdma',
@@ -49,6 +48,11 @@
    'ui',
    'yank',
  ]
+if have_system
+  qapi_all_modules += [
+    'qdev',
+  ]
+endif
 
  qapi_storage_daemon_modules = [
    'block-core',
stubs/meson.build +2 -0
index 1a656cd0704..a054d5877fb 100644
@@ -53,4 +53,6 @@
  if have_system
    stub_ss.add(files('semihost.c'))
    stub_ss.add(files('xen-hw-stub.c'))
+else
+  stub_ss.add(files('qdev.c'))
  endif
#19 lore raw

Re: [PATCH v2 09/12] qapi/meson: Restrict qdev code to system-mode emulation

Quoted 8 lines · Paolo Bonzini
Quoted 4 lines · Philippe Mathieu-Daudé

Beside a CPU device, user-mode emulation doesn't access anything else from qdev subsystem.

Tools don't need anything from qdev.

I prefer to avoid stubs.  So if this patch can simply be dropped with no effects on 10-12, that's nicer for me.

The alternative is ugly:

-- >8 --

hw/core/qdev.c +1 -0
index cefc5eaa0a9..d09f32e38d6 100644
@@ -950,7 +950,9 @@ static void device_finalize(Object *obj)
     if (dev->pending_deleted_event) {
         g_assert(dev->canonical_path);
 
+#ifdef CONFIG_USER_ONLY
         qapi_event_send_device_deleted(!!dev->id, dev->id,

dev->canonical_path);
+#endif

         g_free(dev->canonical_path);
         dev->canonical_path = NULL;
     }

---

Maybe wrapping it in an inlined function?

#20 lore raw

Re: [PATCH v2 09/12] qapi/meson: Restrict qdev code to system-mode emulation

Quoted 19 lines · Philippe Mathieu-Daudé

The alternative is ugly:

-- >8 --

hw/core/qdev.c +2 -0
index cefc5eaa0a9..d09f32e38d6 100644
@@ -950,7 +950,9 @@ static void device_finalize(Object *obj)
     if (dev->pending_deleted_event) {
         g_assert(dev->canonical_path);
 
+#ifdef CONFIG_USER_ONLY
         qapi_event_send_device_deleted(!!dev->id, dev->id,
 dev->canonical_path);
+#endif
         g_free(dev->canonical_path);
         dev->canonical_path = NULL;
     }
Quoted 1 line

---

Well, the alternative is also to not do anything. There's already a stub for qapi_event_emit, does it really hurt to have the not-stubbed-out code for qapi_event_send_device_deleted?

Paolo

#21 lore raw

PATCH v2 10/12 qapi/meson: Remove QMP from user-mode emulation

In reply to Philippe Mathieu-Daudé

---
Cc: Laurent Vivier <[email protected]>

---
 qapi/meson.build  | 10 +++++++---
 tests/meson.build |  7 ++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
qapi/meson.build +7 -3
index 2839871b478..b301a46f04a 100644
@@ -4,14 +4,18 @@
   'qapi-dealloc-visitor.c',
   'qapi-util.c',
   'qapi-visit-core.c',
-  'qmp-dispatch.c',
-  'qmp-event.c',
-  'qmp-registry.c',
   'qobject-input-visitor.c',
   'qobject-output-visitor.c',
   'string-input-visitor.c',
   'string-output-visitor.c',
 ))
+if have_system or have_tools
+  util_ss.add(files(
+    'qmp-dispatch.c',
+    'qmp-event.c',
+    'qmp-registry.c',
+  ))
+endif
 
 qapi_all_modules = [
   'acpi',
tests/meson.build +6 -1
index 6f1ff926d26..7d7da6a6364 100644
@@ -86,7 +86,6 @@
   'test-qobject-input-visitor': [testqapi],
   'test-string-input-visitor': [testqapi],
   'test-string-output-visitor': [testqapi],
-  'test-qmp-event': [testqapi],
   'test-opts-visitor': [testqapi],
   'test-visitor-serialization': [testqapi],
   'test-bitmap': [],
@@ -117,6 +116,12 @@
   'test-qapi-util': [],
 }
 
+if have_system or have_tools
+  tests += {
+    'test-qmp-event': [testqapi],
+  }
+endif
+
 test_deps = {
   'test-qht-par': qht_bench,
 }
Signature · 1 line
2.26.2
#22 lore raw

PATCH v2 11/12 qapi/meson: Restrict system-mode specific modules

In reply to Philippe Mathieu-Daudé
---
 qapi/meson.build | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
qapi/meson.build +6 -6
index b301a46f04a..7aca8d50484 100644
@@ -18,8 +18,6 @@
 endif
 
 qapi_all_modules = [
-  'acpi',
-  'audio',
   'authz',
   'block',
   'block-core',
@@ -39,14 +37,10 @@
   'misc-target',
   'net',
   'pragma',
-  'pci',
   'qom',
-  'rdma',
   'replay',
-  'rocker',
   'run-state',
   'sockets',
-  'tpm',
   'trace',
   'transaction',
   'ui',
@@ -54,7 +48,13 @@
 ]
 if have_system
   qapi_all_modules += [
+    'acpi',
+    'audio',
     'qdev',
+    'pci',
+    'rdma',
+    'rocker',
+    'tpm',
   ]
 endif
 
Signature · 1 line
2.26.2
#23 lore raw

PATCH v2 12/12 qapi/meson: Restrict UI module to system emulation and tools

In reply to Philippe Mathieu-Daudé

---
Cc: Gerd Hoffmann <[email protected]>

---
 qapi/meson.build | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
qapi/meson.build +5 -1
index 7aca8d50484..0652569bc43 100644
@@ -43,7 +43,6 @@
   'sockets',
   'trace',
   'transaction',
-  'ui',
   'yank',
 ]
 if have_system
@@ -57,6 +56,11 @@
     'tpm',
   ]
 endif
+if have_system or have_tools
+  qapi_all_modules += [
+    'ui',
+  ]
+endif
 
 qapi_storage_daemon_modules = [
   'block-core',
Signature · 1 line
2.26.2
Acked-by on the v2 series
#24 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 35 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Philippe Mathieu-Daudé (12):
configure: Only check for audio drivers if system-mode is selected tests/meson: Only build softfloat objects if TCG is selected pc-bios/meson: Only install EDK2 blob firmwares with system emulation
meson: Do not build optional libraries by default
meson: Restrict block subsystem processing
meson: Merge trace_events_subdirs array
meson: Restrict some trace event directories to user/system emulation
meson: Restrict emulation code
qapi/meson: Restrict qdev code to system-mode emulation qapi/meson: Remove QMP from user-mode emulation qapi/meson: Restrict system-mode specific modules qapi/meson: Restrict UI module to system emulation and tools

  configure           |  6 +++++
  meson.build         | 55 ++++++++++++++++++++++++++-------------------
  stubs/qdev.c        | 23 +++++++++++++++++++
  MAINTAINERS         |  1 +
  pc-bios/meson.build |  1 +
  qapi/meson.build    | 34 +++++++++++++++++++---------
  stubs/meson.build   |  2 ++
  tests/meson.build   | 11 +++++++--
  8 files changed, 97 insertions(+), 36 deletions(-)
Quoted 2 lines

create mode 100644 stubs/qdev.c

Except for patch 8,

#25 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Series looks good to me but I guess you need some sub-system feedback. I've sent a few more patches that might be worth rolling in to better handle check-tcg/softfloat.

Quoted 25 lines

Philippe Mathieu-Daudé (12):
configure: Only check for audio drivers if system-mode is selected tests/meson: Only build softfloat objects if TCG is selected pc-bios/meson: Only install EDK2 blob firmwares with system emulation
meson: Do not build optional libraries by default
meson: Restrict block subsystem processing
meson: Merge trace_events_subdirs array
meson: Restrict some trace event directories to user/system emulation
meson: Restrict emulation code
qapi/meson: Restrict qdev code to system-mode emulation qapi/meson: Remove QMP from user-mode emulation qapi/meson: Restrict system-mode specific modules qapi/meson: Restrict UI module to system emulation and tools

 configure           |  6 +++++
 meson.build         | 55 ++++++++++++++++++++++++++-------------------
 stubs/qdev.c        | 23 +++++++++++++++++++
 MAINTAINERS         |  1 +
 pc-bios/meson.build |  1 +
 qapi/meson.build    | 34 +++++++++++++++++++---------
 stubs/meson.build   |  2 ++
 tests/meson.build   | 11 +++++++--
 8 files changed, 97 insertions(+), 36 deletions(-)
 create mode 100644 stubs/qdev.c
Signature · 1 line
Alex Bennée
#26 lore raw
Quoted 10 lines · Alex Bennée
Quoted 7 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

Quoted 6 lines
Quoted 4 lines

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Series looks good to me but I guess you need some sub-system feedback.

Yeah, I will wait for Markus feedback on qapi/ before respining (with target/ fix), ...

Quoted 2 lines

I've sent a few more patches that might be worth rolling in to better handle check-tcg/softfloat.

... including your patches if they aren't merged before.

Thanks for having a look,

Phil.

#27 lore raw
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Alex Bennée
Quoted 10 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Supersedes: <[email protected]>

Series looks good to me but I guess you need some sub-system feedback.

Yeah, I will wait for Markus feedback on qapi/ before respining (with target/ fix), ...

Maybe I'm naive today, but to me this looks like a case of "if it still builds, it's fine".

Anything in particular you want my feedback for?

Quoted 8 lines
Quoted 2 lines

I've sent a few more patches that might be worth rolling in to better handle check-tcg/softfloat.

... including your patches if they aren't merged before.

Thanks for having a look,

Phil.

#28 lore raw
Quoted 20 lines · Markus Armbruster
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Alex Bennée
Quoted 11 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Series looks good to me but I guess you need some sub-system feedback.

Quoted 7 lines
Quoted 2 lines

Yeah, I will wait for Markus feedback on qapi/ before respining (with target/ fix), ...

Maybe I'm naive today, but to me this looks like a case of "if it still builds, it's fine".

Anything in particular you want my feedback for?

You are listed as qapi/ maintainer with Michael :)

QAPI
M: Markus Armbruster <[email protected]>
M: Michael Roth <[email protected]>
S: Supported
F: qapi/

If it is fine to you, then I'll respin addressing Paolo's comments.

Thanks :)

Phil.

#29 lore raw
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Markus Armbruster
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Alex Bennée
Quoted 11 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Series looks good to me but I guess you need some sub-system feedback.

Quoted 7 lines
Quoted 2 lines

Yeah, I will wait for Markus feedback on qapi/ before respining (with target/ fix), ...

Maybe I'm naive today, but to me this looks like a case of "if it still builds, it's fine".

Anything in particular you want my feedback for?

You are listed as qapi/ maintainer with Michael :)

QAPI
M: Markus Armbruster <[email protected]>
M: Michael Roth <[email protected]>
S: Supported
F: qapi/

Quoted 5 lines

If it is fine to you, then I'll respin addressing Paolo's comments.

Thanks :)

Phil.

Go right ahead!

#30 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 35 lines · Philippe Mathieu-Daudé

In this series we deselect a bunch of features when they not required, so less objects are built.

While this reduce pressure on CI and slow systems, this is particularly helpful for developers regularly testing multiple build configurations.

All CI tests pass:
https://gitlab.com/philmd/qemu/-/pipelines/245654160

Supersedes: <[email protected]>

Philippe Mathieu-Daudé (12):
configure: Only check for audio drivers if system-mode is selected tests/meson: Only build softfloat objects if TCG is selected pc-bios/meson: Only install EDK2 blob firmwares with system emulation
meson: Do not build optional libraries by default
meson: Restrict block subsystem processing
meson: Merge trace_events_subdirs array
meson: Restrict some trace event directories to user/system emulation
meson: Restrict emulation code
qapi/meson: Restrict qdev code to system-mode emulation qapi/meson: Remove QMP from user-mode emulation qapi/meson: Restrict system-mode specific modules qapi/meson: Restrict UI module to system emulation and tools

  configure           |  6 +++++
  meson.build         | 55 ++++++++++++++++++++++++++-------------------
  stubs/qdev.c        | 23 +++++++++++++++++++
  MAINTAINERS         |  1 +
  pc-bios/meson.build |  1 +
  qapi/meson.build    | 34 +++++++++++++++++++---------
  stubs/meson.build   |  2 ++
  tests/meson.build   | 11 +++++++--
  8 files changed, 97 insertions(+), 36 deletions(-)
Quoted 2 lines

create mode 100644 stubs/qdev.c

Queued, thanks.

Paolo