buildsys: Start shrinking qemu-user build process
Subsystems (2)
v2 cover buildsys: Start shrinking qemu-user build process
Some files (especially from hw/core/, stubs/ and util/) are built for user mode emulation unnecessarily; they are not needed by any code that is part of qemu-user.
The bulk of the patch (commits 6-17) puts stubs/ on a diet both in general (moving stubs out into specific subdirectories and away from libqemuutil.a) and for specific builds, by documenting which parts of QEMU need the various object files.
Tested by building
--disable-system --disable-user --disable-tools --disable-guest-agent --disable-system --enable-user --disable-tools --disable-guest-agent --disable-system --disable-user --enable-tools --disable-guest-agent --disable-system --disable-user --disable-tools --enable-guest-agent
as well as regular CI.
Paolo
Paolo Bonzini (15):
meson: do not link pixman automatically into all targets
tests: only build plugins if TCG is enabled
tests/unit: match some unit tests to corresponding feature switches
yank: only build if needed
hw/core: Move system emulation files to system_ss
stubs: remove obsolete stubs
hw/usb: move stubs out of stubs/
hw/virtio: move stubs out of stubs/
semihosting: move stubs out of stubs/
ramfb: move stubs out of stubs/
memory-device: move stubs out of stubs/
colo: move stubs out of stubs/
stubs: split record/replay stubs further
stubs: include stubs only if needed
stubs: move monitor_fdsets_cleanup with other fdset stubs
Philippe Mathieu-Daudé (3):
ebpf: Restrict to system emulation util/qemu-config: Extract QMP commands to qemu-config-qmp.c
hw: Include minimal source set in user emulation build
meson.build | 8 +-
include/qemu/config-file.h | 3 +
include/sysemu/sysemu.h | 2 -
stubs/ramfb.c => hw/display/ramfb-stubs.c | 0
.../mem/memory-device-stubs.c | 0
stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 5 -
.../virtio/virtio-md-stubs.c | 0
stubs/colo.c => migration/colo-stubs.c | 0
monitor/qemu-config-qmp.c | 206 ++++++++++++++++++
stubs/colo-compare.c => net/colo-stubs.c | 0
.../semihost-all.c => semihosting/stubs-all.c | 0
.../semihost.c => semihosting/stubs-system.c | 0
stubs/fdset.c | 6 +
{hw/core => stubs}/hotplug-stubs.c | 0
stubs/isa-bus.c | 7 -
stubs/module-opts.c | 2 -
stubs/monitor-core.c | 6 -
stubs/{monitor.c => monitor-internal.c} | 5 -
stubs/pci-bus.c | 7 -
stubs/qdev.c | 6 -
stubs/qtest.c | 10 -
stubs/replay-mode.c | 4 +
stubs/replay.c | 2 -
util/qemu-config.c | 204 +----------------
ebpf/meson.build | 2 +-
hw/core/meson.build | 14 +-
hw/display/meson.build | 2 +-
hw/mem/meson.build | 1 +
hw/usb/meson.build | 2 +-
hw/virtio/meson.build | 3 +-
migration/meson.build | 2 +
monitor/meson.build | 1 +
net/meson.build | 2 +
semihosting/meson.build | 3 +
stubs/meson.build | 133 ++++++-----
tests/meson.build | 2 +-
tests/unit/meson.build | 12 +-
util/meson.build | 2 +-
38 files changed, 328 insertions(+), 336 deletions(-)
rename stubs/ramfb.c => hw/display/ramfb-stubs.c (100%)
rename stubs/memory_device.c => hw/mem/memory-device-stubs.c (100%)
rename stubs/usb-dev-stub.c => hw/usb/bus-stub.c (83%)
rename stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c (100%)
rename stubs/colo.c => migration/colo-stubs.c (100%)
create mode 100644 monitor/qemu-config-qmp.c
rename stubs/colo-compare.c => net/colo-stubs.c (100%)
rename stubs/semihost-all.c => semihosting/stubs-all.c (100%)
rename stubs/semihost.c => semihosting/stubs-system.c (100%)
rename {hw/core => stubs}/hotplug-stubs.c (100%)
delete mode 100644 stubs/isa-bus.c
delete mode 100644 stubs/module-opts.c
rename stubs/{monitor.c => monitor-internal.c} (79%)
delete mode 100644 stubs/pci-bus.c
create mode 100644 stubs/replay-mode.cSignature · 1 line
2.44.0
PATCH v2 1/18 meson: do not link pixman automatically into all targets
The dependency on pixman is listed manually in all sourcesets that need it. There is no need to bring into libqemuutil, since there is nothing in util/ that needs pixman either.
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -3477,7 +3477,7 @@ util_ss = util_ss.apply({}) libqemuutil = static_library('qemuutil', build_by_default: false, sources: util_ss.sources() + stub_ss.sources() + genh, - dependencies: [util_ss.dependencies(), libm, threads, glib, socket, malloc, pixman]) + dependencies: [util_ss.dependencies(), libm, threads, glib, socket, malloc]) qemuutil = declare_dependency(link_with: libqemuutil, sources: genh + version_res, dependencies: [event_loop_base])
Signature · 1 line
2.44.0
Re: [PATCH v2 01/18] meson: do not link pixman automatically into all targets
Quoted 9 lines · Paolo Bonzini
The dependency on pixman is listed manually in all sourcesets that need it. There is no need to bring into libqemuutil, since there is nothing in util/ that needs pixman either.
Reported-by Michael Tokarev<[email protected]>Signed-off-by Paolo Bonzini<[email protected]>--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH v2 2/18 tests: only build plugins if TCG is enabled
In reply to Paolo BonziniThere is no way to use them for testing, if all the available accelerators use hardware virtualization.
--- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/meson.build +1 -1
@@ -78,9 +78,9 @@ subdir('decode') if 'CONFIG_TCG' in config_all_accel subdir('fp') + subdir('plugin') endif -subdir('plugin') subdir('unit') subdir('qapi-schema') subdir('qtest')
Signature · 1 line
2.44.0
Re: [PATCH v2 02/18] tests: only build plugins if TCG is enabled
Quoted 7 lines · Paolo Bonzini
There is no way to use them for testing, if all the available accelerators use hardware virtualization.
Signed-off-by Paolo Bonzini <[email protected]>--- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH v2 02/18] tests: only build plugins if TCG is enabled
In reply to Paolo BonziniQuoted 7 lines · Paolo Bonzini
There is no way to use them for testing, if all the available accelerators use hardware virtualization.
Signed-off-by Paolo Bonzini<[email protected]>--- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH v2 3/18 ebpf: Restrict to system emulation
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
eBPF is not used in user emulation.
Message-ID: <[email protected]>
--- ebpf/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ebpf/meson.build +1 -1
@@ -1 +1 @@ -common_ss.add(when: libbpf, if_true: files('ebpf.c', 'ebpf_rss.c'), if_false: files('ebpf_rss-stub.c')) +system_ss.add(when: libbpf, if_true: files('ebpf.c', 'ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
Signature · 1 line
2.44.0
PATCH v2 4/18 tests/unit: match some unit tests to corresponding feature switches
In reply to Paolo BonziniTry not to test code that is not used by user mode emulation, or by the block layer, unless they are being compiled; and fix test-timed-average which was not compiled with --disable-system --enable-tools.
This is by no means complete, it only touches the more blatantly wrong cases.
--- tests/unit/meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/unit/meson.build +6 -6
@@ -18,7 +18,6 @@ tests = { 'test-forward-visitor': [testqapi], 'test-string-input-visitor': [testqapi], 'test-string-output-visitor': [testqapi], - 'test-opts-visitor': [testqapi], 'test-visitor-serialization': [testqapi], 'test-bitmap': [], 'test-resv-mem': [],
@@ -46,12 +45,8 @@ tests = { 'test-qemu-opts': [], 'test-keyval': [testqapi], 'test-logging': [], - 'test-uuid': [], - 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], 'test-qapi-util': [], 'test-interval-tree': [], - 'test-xs-node': [qom], - 'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'], } if have_system or have_tools
@@ -97,6 +92,8 @@ if have_block 'test-crypto-ivgen': [io], 'test-crypto-afsplit': [io], 'test-crypto-block': [io], + 'test-timed-average': [], + 'test-uuid': [], } if gnutls.found() and \ tasn1.found() and \
@@ -131,10 +128,13 @@ endif if have_system tests += { + 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], 'test-iov': [], + 'test-opts-visitor': [testqapi], + 'test-xs-node': [qom], + 'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'], 'test-qmp-cmds': [testqapi], 'test-xbzrle': [migration], - 'test-timed-average': [], 'test-util-sockets': ['socket-helpers.c'], 'test-base64': [], 'test-bufferiszero': [],
Signature · 1 line
2.44.0
Re: [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches
Quoted 11 lines · Paolo Bonzini
Try not to test code that is not used by user mode emulation, or by the block layer, unless they are being compiled; and fix test-timed-average which was not compiled with --disable-system --enable-tools.
This is by no means complete, it only touches the more blatantly wrong cases.
Signed-off-by Paolo Bonzini<[email protected]>--- tests/unit/meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
r~
PATCH v2 5/18 yank: only build if needed
In reply to Paolo BonziniThe yank feature is not used in user emulation.
--- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/meson.build +1 -1
@@ -60,7 +60,6 @@ util_ss.add(files('stats64.c')) util_ss.add(files('systemd.c')) util_ss.add(files('transactions.c')) util_ss.add(files('guest-random.c')) -util_ss.add(files('yank.c')) util_ss.add(files('int128.c')) util_ss.add(files('memalign.c')) util_ss.add(files('interval-tree.c'))
@@ -117,6 +116,7 @@ if have_block util_ss.add(files('vfio-helpers.c')) util_ss.add(files('chardev_open.c')) endif + util_ss.add(files('yank.c')) endif if cpu == 'aarch64'
Signature · 1 line
2.44.0
Re: [PATCH v2 05/18] yank: only build if needed
util/meson.build if have_block
Quoted 21 lines · Paolo Bonzini
The yank feature is not used in user emulation.
Suggested-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/meson.build +0
-1@@ -60,7 +60,6 @@ util_ss.add(files('stats64.c')) util_ss.add(files('systemd.c')) util_ss.add(files('transactions.c')) util_ss.add(files('guest-random.c')) -util_ss.add(files('yank.c')) util_ss.add(files('int128.c')) util_ss.add(files('memalign.c')) util_ss.add(files('interval-tree.c'))@@ -117,6 +116,7 @@ if have_block
Quoted 7 lines
util/meson.build +1
-0util_ss.add(files('vfio-helpers.c')) util_ss.add(files('chardev_open.c')) endif + util_ss.add(files('yank.c')) endif if cpu == 'aarch64'
Re: [PATCH v2 05/18] yank: only build if needed
In reply to Paolo BonziniQuoted 7 lines · Paolo Bonzini
The yank feature is not used in user emulation.
Suggested-by Philippe Mathieu-Daudé<[email protected]>Signed-off-by Paolo Bonzini<[email protected]>--- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH v2 6/18 util/qemu-config: Extract QMP commands to qemu-config-qmp.c
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
QMP is irrelevant for user emulation. Extract the code related to QMP in a different source file, which won't be build for user emulation binaries. This avoid pulling pointless code.
Message-ID: <[email protected]>
--- include/qemu/config-file.h | 3 + monitor/qemu-config-qmp.c | 206 +++++++++++++++++++++++++++++++++++++ util/qemu-config.c | 204 +----------------------------------- monitor/meson.build | 1 + 4 files changed, 212 insertions(+), 202 deletions(-) create mode 100644 monitor/qemu-config-qmp.c
include/qemu/config-file.h +3 -0
@@ -8,6 +8,9 @@ QemuOptsList *qemu_find_opts(const char *group);QemuOptsList *qemu_find_opts_err (const char *group,Error **errp);QemuOpts *qemu_find_opts_singleton (const char *group); +extern QemuOptsList *vm_config_groups[]; +extern QemuOptsList *drive_config_groups[]; +void qemu_add_opts (QemuOptsList *list);void qemu_add_drive_opts (QemuOptsList *list);int qemu_global_option (const char *str);
monitor/qemu-config-qmp.c new file +206 -0
206 lines not on this page · raw message
util/qemu-config.c +2 -202
222 lines not on this page · raw message
monitor/meson.build +1 -0
@@ -4,6 +4,7 @@ system_ss.add(files( 'fds.c', 'hmp-cmds.c', 'hmp.c', + 'qemu-config-qmp.c', )) system_ss.add([spice_headers, files('qmp-cmds.c')])
Signature · 1 line
2.44.0
PATCH v2 7/18 hw/core: Move system emulation files to system_ss
In reply to Paolo Bonzinihotplug.c, qdev-hotplug.c and reset.c are not used by user emulation and need not be included in hwcore_ss. Move them to system_ss, where they belong, by letting the linker pull in the stubs when needed.
---
{hw/core => stubs}/hotplug-stubs.c | 0
hw/core/meson.build | 14 +++-----------
stubs/meson.build | 1 +
3 files changed, 4 insertions(+), 11 deletions(-)
rename {hw/core => stubs}/hotplug-stubs.c (100%)stubs/hotplug-stubs.c renamed from hw/core/hotplug-stubs.c +0 -0
hw/core/meson.build +3 -11
@@ -3,7 +3,6 @@ hwcore_ss.add(files( 'bus.c', 'qdev-properties.c', 'qdev.c', - 'reset.c', 'resetcontainer.c', 'resettable.c', 'vmstate-if.c',
@@ -12,16 +11,6 @@ hwcore_ss.add(files( 'clock.c', 'qdev-clock.c', )) -if have_system - hwcore_ss.add(files( - 'hotplug.c', - 'qdev-hotplug.c', - )) -else - hwcore_ss.add(files( - 'hotplug-stubs.c', - )) -endif common_ss.add(files('cpu-common.c')) common_ss.add(files('machine-smp.c'))
@@ -40,6 +29,7 @@ system_ss.add(files( 'cpu-sysemu.c', 'fw-path-provider.c', 'gpio.c', + 'hotplug.c', 'loader.c', 'machine-hmp-cmds.c', 'machine-qmp-cmds.c',
@@ -48,7 +38,9 @@ system_ss.add(files( 'null-machine.c', 'numa.c', 'qdev-fw.c', + 'qdev-hotplug.c', 'qdev-properties-system.c', + 'reset.c', 'sysbus.c', 'vm-change-state-handler.c', 'clock-vmstate.c',
stubs/meson.build +1 -0
@@ -14,6 +14,7 @@ stub_ss.add(files('fdset.c')) stub_ss.add(files('gdbstub.c')) stub_ss.add(files('get-vm-name.c')) stub_ss.add(files('graph-lock.c')) +stub_ss.add(files('hotplug-stubs.c')) if linux_io_uring.found() stub_ss.add(files('io_uring.c')) endif
Signature · 1 line
2.44.0
Re: [PATCH v2 07/18] hw/core: Move system emulation files to system_ss
Quoted 11 lines · Paolo Bonzini
hotplug.c,qdev-hotplug.candreset.care not used by user emulation and need not be included inhwcore_ss. Move them tosystem_ss, where they belong, by letting the linker pull in the stubs when needed.Signed-off-by Paolo Bonzini<[email protected]>--- {hw/core => stubs}/hotplug-stubs.c | 0 hw/core/meson.build | 14 +++----------- stubs/meson.build | 1 + 3 files changed, 4 insertions(+), 11 deletions(-)rename {hw/core =>
stubs}/hotplug-stubs.c(100%)
r~
PATCH v2 8/18 hw: Include minimal source set in user emulation build
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
Only the files in hwcore_ss[] are required to link a user emulation binary.
Have meson process the hw/ sub-directories if system emulation is selected, otherwise directly process hw/core/ to get hwcore_ss[], which is the only set required by user emulation.
This removes about 10% from the time needed to run "../configure --disable-system --disable-tools --disable-guest-agent".
Message-ID: <[email protected]>
--- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meson.build +5 -1
@@ -3447,8 +3447,12 @@ subdir('qom') subdir('authz') subdir('crypto') subdir('ui') -subdir('hw') subdir('gdbstub') +if have_system + subdir('hw') +else + subdir('hw/core') +endif if enable_modules libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
Signature · 1 line
2.44.0
PATCH v2 9/18 stubs: remove obsolete stubs
In reply to Paolo BonziniThese file define functions are are not called from common code anymore. Delete those functions and, if applicable, the entire files.
--- include/sysemu/sysemu.h | 2 -- stubs/isa-bus.c | 7 ------- stubs/module-opts.c | 2 -- stubs/monitor-core.c | 6 ------ stubs/pci-bus.c | 7 ------- stubs/qdev.c | 6 ------ stubs/qtest.c | 10 ---------- stubs/usb-dev-stub.c | 5 ----- stubs/meson.build | 3 --- 9 files changed, 48 deletions(-) delete mode 100644 stubs/isa-bus.c delete mode 100644 stubs/module-opts.c delete mode 100644 stubs/pci-bus.c
include/sysemu/sysemu.h +0 -2
@@ -71,8 +71,6 @@ Chardev *serial_hd(int i);extern Chardev *parallel_hds[MAX_PARALLEL_PORTS ]; -void hmp_info_usb (Monitor *mon,const QDict *qdict); -void add_boot_device_path (int32_t bootindex,DeviceState *dev,const char *suffix);char *get_boot_devices_list (size_t *size);
stubs/isa-bus.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include "qemu/osdep.h" -#include "hw/isa/isa.h" - -ISADevice *isa_create_simple (ISABus *bus,const char *name) -{ -g_assert_not_reached (); -}
stubs/module-opts.c deleted +0 -2
@@ -1,2 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu/config-file.h"
stubs/monitor-core.c +0 -6
@@ -12,10 +12,6 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)return NULL ; } -void monitor_init_qmp (Chardev *chr,bool pretty,Error **errp) -{ -} -void qapi_event_emit (QAPIEvent event,QDict *qdict) { }
@@ -24,5 +20,3 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) {abort (); } - -
stubs/pci-bus.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include "qemu/osdep.h" -#include "hw/pci/pci.h" - -PCIDevice *pci_create_simple (PCIBus *bus,int devfn,const char *name) -{ -g_assert_not_reached (); -}
stubs/qdev.c +0 -6
@@ -20,9 +20,3 @@ void qapi_event_send_device_deleted(const char *device, {/* Nothing to do. */ } - -void qapi_event_send_device_unplug_guest_error (const char *device, -const char *path) -{ -/* Nothing to do. */ -}
stubs/qtest.c +0 -10
@@ -13,13 +13,3 @@/* Needed for qtest_allowed() */ bool qtest_allowed; - -bool qtest_driver (void ) -{ -return false; -} - -int64_t qtest_get_virtual_clock (void ) -{ -return 0 ; -}
stubs/usb-dev-stub.c +0 -5
@@ -26,8 +26,3 @@ HumanReadableText *qmp_x_query_usb(Error **errp)error_setg (errp,"Support for USB devices not built-in" );return NULL ; } - -void hmp_info_usb (Monitor *mon,const QDict *qdict) -{ -monitor_printf (mon,"Support for USB devices not built-in\n" ); -}
stubs/meson.build +0 -3
@@ -22,13 +22,11 @@ stub_ss.add(files('iothread-lock.c')) if have_block stub_ss.add(files('iothread-lock-block.c')) endif -stub_ss.add(files('isa-bus.c')) stub_ss.add(files('is-daemonized.c')) if libaio.found() stub_ss.add(files('linux-aio.c')) endif stub_ss.add(files('migr-blocker.c')) -stub_ss.add(files('module-opts.c')) stub_ss.add(files('monitor.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('physmem.c'))
@@ -57,7 +55,6 @@ if have_block or have_ga endif if have_system stub_ss.add(files('fw_cfg.c')) - stub_ss.add(files('pci-bus.c')) stub_ss.add(files('semihost.c')) stub_ss.add(files('usb-dev-stub.c')) stub_ss.add(files('xen-hw-stub.c'))
Signature · 1 line
2.44.0
Re: [PATCH v2 09/18] stubs: remove obsolete stubs
Quoted 15 lines · Paolo Bonzini
These file define functions are are not called from common code anymore. Delete those functions and, if applicable, the entire files.
Signed-off-by Paolo Bonzini<[email protected]>--- include/sysemu/sysemu.h | 2 -- stubs/isa-bus.c | 7 ------- stubs/module-opts.c | 2 -- stubs/monitor-core.c | 6 ------ stubs/pci-bus.c | 7 ------- stubs/qdev.c | 6 ------ stubs/qtest.c | 10 ---------- stubs/usb-dev-stub.c | 5 ----- stubs/meson.build | 3 --- 9 files changed, 48 deletions(-)
Quoted 3 lines
delete mode 100644
stubs/isa-bus.c
delete mode 100644stubs/module-opts.c
delete mode 100644stubs/pci-bus.c
r~
PATCH v2 10/18 hw/usb: move stubs out of stubs/
In reply to Paolo BonziniSince the USB stubs are needed exactly when the Kconfig symbols are not enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB.
--- stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0 hw/usb/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) rename stubs/usb-dev-stub.c => hw/usb/bus-stub.c (100%)
hw/usb/bus-stub.c renamed from stubs/usb-dev-stub.c +0 -0
hw/usb/meson.build +1 -1
@@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_USB', if_true: files( 'desc-msos.c', 'libhw.c', 'pcap.c', -)) +), if_false: files('bus-stub.c')) # usb host adapters system_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
stubs/meson.build +0 -1
@@ -56,7 +56,6 @@ endif if have_system stub_ss.add(files('fw_cfg.c')) stub_ss.add(files('semihost.c')) - stub_ss.add(files('usb-dev-stub.c')) stub_ss.add(files('xen-hw-stub.c')) stub_ss.add(files('virtio-md-pci.c')) else
Signature · 1 line
2.44.0
Re: [PATCH v2 10/18] hw/usb: move stubs out of stubs/
Quoted 16 lines · Paolo Bonzini
Since the USB stubs are needed exactly when the
Kconfigsymbols are not enabled, they can be placed in hw/usb/ and conditionalized onCONFIG_USB.Signed-off-by Paolo Bonzini <[email protected]>--- stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0 hw/usb/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)rename
stubs/usb-dev-stub.c=>hw/usb/bus-stub.c(100%)hw/usb/meson.build +0
-0
hw/usb/meson.build system_ss.add(when: 'CONFIG_USB', if_true: files( · line 12
Quoted 5 lines
hw/usb/meson.build +1
-1@@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_USB', if_true: files( 'desc-msos.c', 'libhw.c', 'pcap.c', -)) +), if_false: files('bus-stub.c'))
I like it because the stub is restricted to the
subsystem. Possibly easing maintenance.
stubs/meson.build
Quoted 3 lines
stubs/meson.build +0
-1- stub_ss.add(files('usb-dev-stub.c'))
Re: [PATCH v2 10/18] hw/usb: move stubs out of stubs/
In reply to Paolo BonziniQuoted 10 lines · Paolo Bonzini
Since the USB stubs are needed exactly when the
Kconfigsymbols are not enabled, they can be placed in hw/usb/ and conditionalized onCONFIG_USB.Signed-off-by Paolo Bonzini<[email protected]>--- stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0 hw/usb/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)rename
stubs/usb-dev-stub.c=>hw/usb/bus-stub.c(100%)
r~
PATCH v2 11/18 hw/virtio: move stubs out of stubs/
In reply to Paolo BonziniSince the virtio memory device stubs are needed exactly when the Kconfig symbol is not enabled, they can be placed in hw/virtio/ and conditionalized on CONFIG_VIRTIO_MD.
--- stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c | 0 hw/virtio/meson.build | 3 ++- stubs/meson.build | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) rename stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c (100%)
hw/virtio/virtio-md-stubs.c renamed from stubs/virtio-md-pci.c +0 -0
hw/virtio/meson.build +2 -1
@@ -80,7 +80,8 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem-pci.c' virtio_pci_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev-pci.c')) -virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c')) +virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c'), + if_false: files('virtio-md-stubs.c')) specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
stubs/meson.build +0 -1
@@ -57,7 +57,6 @@ if have_system stub_ss.add(files('fw_cfg.c')) stub_ss.add(files('semihost.c')) stub_ss.add(files('xen-hw-stub.c')) - stub_ss.add(files('virtio-md-pci.c')) else stub_ss.add(files('qdev.c')) endif
Signature · 1 line
2.44.0
Re: [PATCH v2 11/18] hw/virtio: move stubs out of stubs/
Quoted 11 lines · Paolo Bonzini
Since the virtio memory device stubs are needed exactly when the
Kconfigsymbol is not enabled, they can be placed in hw/virtio/ and conditionalized onCONFIG_VIRTIO_MD.Signed-off-by Paolo Bonzini<[email protected]>--- stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c | 0 hw/virtio/meson.build | 3 ++- stubs/meson.build | 1 - 3 files changed, 2 insertions(+), 2 deletions(-)rename
stubs/virtio-md-pci.c=>hw/virtio/virtio-md-stubs.c(100%)
r~
PATCH v2 12/18 semihosting: move stubs out of stubs/
In reply to Paolo BonziniSince the semihosting stubs are needed exactly when the Kconfig symbols are not needed, move them to semihosting/ and conditionalize them on CONFIG_SEMIHOSTING and/or CONFIG_SYSTEM_ONLY.
--- stubs/semihost-all.c => semihosting/stubs-all.c | 0 stubs/semihost.c => semihosting/stubs-system.c | 0 semihosting/meson.build | 3 +++ stubs/meson.build | 2 -- 4 files changed, 3 insertions(+), 2 deletions(-) rename stubs/semihost-all.c => semihosting/stubs-all.c (100%) rename stubs/semihost.c => semihosting/stubs-system.c (100%)
semihosting/stubs-all.c renamed from stubs/semihost-all.c +0 -0
semihosting/stubs-system.c renamed from stubs/semihost.c +0 -0
semihosting/meson.build +3 -0
@@ -9,5 +9,8 @@ specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_true: fil 'uaccess.c', )) +common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_false: files('stubs-all.c')) +system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: files('stubs-system.c')) + specific_ss.add(when: ['CONFIG_ARM_COMPATIBLE_SEMIHOSTING'], if_true: files('arm-compat-semi.c'))
stubs/meson.build +0 -2
@@ -55,9 +55,7 @@ if have_block or have_ga endif if have_system stub_ss.add(files('fw_cfg.c')) - stub_ss.add(files('semihost.c')) stub_ss.add(files('xen-hw-stub.c')) else stub_ss.add(files('qdev.c')) endif -stub_ss.add(files('semihost-all.c'))
Signature · 1 line
2.44.0
PATCH v2 13/18 ramfb: move stubs out of stubs/
In reply to Paolo BonziniSince the ramfb stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/display/ and compile them when ramfb.c is absent.
--- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) rename stubs/ramfb.c => hw/display/ramfb-stubs.c (100%)
hw/display/ramfb-stubs.c renamed from stubs/ramfb.c +0 -0
hw/display/meson.build +1 -1
@@ -3,7 +3,7 @@ hw_display_modules = {} system_ss.add(when: 'CONFIG_DDC', if_true: files('i2c-ddc.c')) system_ss.add(when: 'CONFIG_EDID', if_true: files('edid-generate.c', 'edid-region.c')) -system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb.c')) +system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb.c'), if_false: files('ramfb-stubs.c')) system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb-standalone.c')) system_ss.add(when: 'CONFIG_VGA_CIRRUS', if_true: files('cirrus_vga.c'))
stubs/meson.build +0 -1
@@ -36,7 +36,6 @@ stub_ss.add(files('qmp-command-available.c')) stub_ss.add(files('qmp-quit.c')) stub_ss.add(files('qtest.c')) stub_ss.add(files('ram-block.c')) -stub_ss.add(files('ramfb.c')) stub_ss.add(files('replay.c')) stub_ss.add(files('runstate-check.c')) stub_ss.add(files('sysbus.c'))
Signature · 1 line
2.44.0
Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/
Quoted 10 lines · Paolo Bonzini
Since the ramfb stubs are needed exactly when the
Kconfigsymbols are not needed, move them to hw/display/ and compile them whenramfb.cis absent.Signed-off-by Paolo Bonzini <[email protected]>--- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)rename
stubs/ramfb.c=>hw/display/ramfb-stubs.c(100%)
Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/
In reply to Paolo BonziniQuoted 10 lines · Paolo Bonzini
Since the ramfb stubs are needed exactly when the
Kconfigsymbols are not needed, move them to hw/display/ and compile them whenramfb.cis absent.Signed-off-by Paolo Bonzini<[email protected]>--- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)rename
stubs/ramfb.c
r~
Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/
In reply to Paolo BonziniQuoted 10 lines · Paolo Bonzini
Since the ramfb stubs are needed exactly when the
Kconfigsymbols are not needed, move them to hw/display/ and compile them whenramfb.cis absent.Signed-off-by Paolo Bonzini<[email protected]>--- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build | 2 +- stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)rename
stubs/ramfb.c=>hw/display/ramfb-stubs.c(100%)
r~
PATCH v2 14/18 memory-device: move stubs out of stubs/
In reply to Paolo BonziniSince the memory-device stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/mem/.
--- stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0 hw/mem/meson.build | 1 + stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename stubs/memory_device.c => hw/mem/memory-device-stubs.c (100%)
hw/mem/memory-device-stubs.c renamed from stubs/memory_device.c +0 -0
hw/mem/meson.build +1 -0
@@ -6,6 +6,7 @@ mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c')) mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c')) system_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c')) +system_ss.add(when: 'CONFIG_MEM_DEVICE', if_false: files('memory-device-stubs.c')) system_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss) system_ss.add(when: 'CONFIG_SPARSE_MEM', if_true: files('sparse-mem.c'))
stubs/meson.build +0 -1
@@ -31,7 +31,6 @@ stub_ss.add(files('monitor.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('physmem.c')) stub_ss.add(files('qemu-timer-notify-cb.c')) -stub_ss.add(files('memory_device.c')) stub_ss.add(files('qmp-command-available.c')) stub_ss.add(files('qmp-quit.c')) stub_ss.add(files('qtest.c'))
Signature · 1 line
2.44.0
Re: [PATCH v2 14/18] memory-device: move stubs out of stubs/
Quoted 10 lines · Paolo Bonzini
Since the memory-device stubs are needed exactly when the
Kconfigsymbols are not needed, move them to hw/mem/.Signed-off-by Paolo Bonzini<[email protected]>--- stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0 hw/mem/meson.build | 1 + stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 1 deletion(-)rename
stubs/memory_device.c=>hw/mem/memory-device-stubs.c(100%)
r~
Re: [PATCH v2 14/18] memory-device: move stubs out of stubs/
In reply to Paolo BonziniQuoted 10 lines · Paolo Bonzini
Since the memory-device stubs are needed exactly when the
Kconfigsymbols are not needed, move them to hw/mem/.Signed-off-by Paolo Bonzini <[email protected]>--- stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0 hw/mem/meson.build | 1 + stubs/meson.build | 1 - 3 files changed, 1 insertion(+), 1 deletion(-)rename
stubs/memory_device.c=>hw/mem/memory-device-stubs.c(100%)
PATCH v2 15/18 colo: move stubs out of stubs/
In reply to Paolo BonziniSince the colo stubs are needed exactly when the build options are not enabled, move them together with the code they stub.
--- stubs/colo.c => migration/colo-stubs.c | 0 stubs/colo-compare.c => net/colo-stubs.c | 0 migration/meson.build | 2 ++ net/meson.build | 2 ++ stubs/meson.build | 2 -- 5 files changed, 4 insertions(+), 2 deletions(-) rename stubs/colo.c => migration/colo-stubs.c (100%) rename stubs/colo-compare.c => net/colo-stubs.c (100%)
migration/colo-stubs.c renamed from stubs/colo.c +0 -0
net/colo-stubs.c renamed from stubs/colo-compare.c +0 -0
migration/meson.build +2 -0
@@ -34,6 +34,8 @@ system_ss.add(files( if get_option('replication').allowed() system_ss.add(files('colo-failover.c', 'colo.c')) +else + system_ss.add(files('colo-stubs.c')) endif system_ss.add(when: rdma, if_true: files('rdma.c'))
net/meson.build +2 -0
@@ -20,6 +20,8 @@ if get_option('replication').allowed() or \ get_option('colo_proxy').allowed() system_ss.add(files('colo-compare.c')) system_ss.add(files('colo.c')) +else + system_ss.add(files('colo-stubs.c')) endif if get_option('colo_proxy').allowed()
stubs/meson.build +0 -2
@@ -42,8 +42,6 @@ stub_ss.add(files('target-get-monitor-def.c')) stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('trace-control.c')) stub_ss.add(files('uuid.c')) -stub_ss.add(files('colo.c')) -stub_ss.add(files('colo-compare.c')) stub_ss.add(files('vmstate.c')) stub_ss.add(files('vm-stop.c')) stub_ss.add(files('win32-kbd-hook.c'))
Signature · 1 line
2.44.0
PATCH v2 16/18 stubs: split record/replay stubs further
In reply to Paolo Bonzinireplay.c symbols are only needed by user mode emulation, with the exception of replay_mode that is needed by both user mode emulation (by way of qemu_guest_getrandom) and block layer tools (by way of util/qemu-timer.c).
Since it is needed by libqemuutil rather than specific files that are part of the tools and emulators, split the replay_mode stub into its own file.
--- stubs/replay-mode.c | 4 ++++ stubs/replay.c | 2 -- stubs/meson.build | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 stubs/replay-mode.c
stubs/replay-mode.c new file +4 -0
@@ -0,0 +1,4 @@ +#include "qemu/osdep.h" +#include "sysemu/replay.h" + +ReplayMode replay_mode;
stubs/replay.c +0 -2
@@ -1,8 +1,6 @@#include "qemu/osdep.h" #include "exec/replay-core.h" -ReplayMode replay_mode; -void replay_finish (void ) { }
stubs/meson.build +1 -0
@@ -36,6 +36,7 @@ stub_ss.add(files('qmp-quit.c')) stub_ss.add(files('qtest.c')) stub_ss.add(files('ram-block.c')) stub_ss.add(files('replay.c')) +stub_ss.add(files('replay-mode.c')) stub_ss.add(files('runstate-check.c')) stub_ss.add(files('sysbus.c')) stub_ss.add(files('target-get-monitor-def.c'))
Signature · 1 line
2.44.0
Re: [PATCH v2 16/18] stubs: split record/replay stubs further
Quoted 9 lines · Paolo Bonzini
replay.csymbols are only needed by user mode emulation, with the exception ofreplay_modethat is needed by both user mode emulation (by way ofqemu_guest_getrandom) and block layer tools (by way ofutil/qemu-timer.c).Since it is needed by libqemuutil rather than specific files that are part of the tools and emulators, split the
replay_modestub into its own file.
Quoted 7 lines
Signed-off-by Paolo Bonzini <[email protected]>--- stubs/replay-mode.c | 4 ++++ stubs/replay.c | 2 -- stubs/meson.build | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)create mode 100644
stubs/replay-mode.c
I don't see how this helps.
With qemu_guest_getrandom you still pull in replay_read_random and replay_save_random. With timerlist_run_timers you still pull in replay_checkpoint.
So both stubs files are still used in the same cases.
r~
Re: [PATCH v2 16/18] stubs: split record/replay stubs further
Quoted 11 lines · Richard Henderson
Quoted 8 lines · Paolo Bonzini
replay.csymbols are only needed by user mode emulation, with the exception ofreplay_modethat is needed by both user mode emulation (by way ofqemu_guest_getrandom) and block layer tools (by way ofutil/qemu-timer.c).Since it is needed by libqemuutil rather than specific files that are part of the tools and emulators, split the
replay_modestub into its own file.
Quoted 6 lines
I don't see how this helps.
With
qemu_guest_getrandomyou still pull inreplay_read_randomandreplay_save_random. Withtimerlist_run_timersyou still pull inreplay_checkpoint.So both stubs files are still used in the same cases.
But user-mode emulation does not use timerlist_run_timers, and block layer tools do not use qemu_guest_getrandom. In fact the next patch wouldn't compile if that wasn't the case.
Paolo
PATCH v2 17/18 stubs: include stubs only if needed
In reply to Paolo BonziniCurrently it is not documented anywhere why some functions need to be stubbed.
Group the files in stubs/meson.build according to who needs them, both to reduce the size of the compilation and to clarify the use of stubs.
---
stubs/{monitor.c => monitor-internal.c} | 0
stubs/meson.build | 122 +++++++++++++++---------
2 files changed, 75 insertions(+), 47 deletions(-)
rename stubs/{monitor.c => monitor-internal.c} (100%)stubs/monitor-internal.c renamed from stubs/monitor.c +0 -0
stubs/meson.build +75 -47
133 lines not on this page · raw message
Signature · 1 line
2.44.0
PATCH v2 18/18 stubs: move monitor_fdsets_cleanup with other fdset stubs
In reply to Paolo BonziniEven though monitor_get_fd() has to remain separate because it is mocked by tests/unit/test-util-sockets, monitor_fdsets_cleanup() is logically part of the stubs for monitor/fds.c, so move it there.
--- stubs/fdset.c | 6 ++++++ stubs/monitor-internal.c | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-)
stubs/fdset.c +6 -0
@@ -1,5 +1,7 @@#include "qemu/osdep.h" +#include "qapi/error.h" #include "monitor/monitor.h" +#include "../monitor/monitor-internal.h" int monitor_fdset_dup_fd_add (int64_t fdset_id,int flags) {
@@ -15,3 +17,7 @@ int64_t monitor_fdset_dup_fd_find(int dup_fd)void monitor_fdset_dup_fd_remove (int dupfd) { } + +void monitor_fdsets_cleanup (void ) +{ +}
stubs/monitor-internal.c +0 -5
@@ -1,7 +1,6 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "monitor/monitor.h" -#include "../monitor/monitor-internal.h" int monitor_get_fd (Monitor *mon,const char *name,Error **errp) {
@@ -12,7 +11,3 @@ int monitor_get_fd(Monitor *mon, const char *name, Error **errp)void monitor_init_hmp (Chardev *chr,bool use_readline,Error **errp) { } - -void monitor_fdsets_cleanup (void ) -{ -}
Signature · 1 line
2.44.0
Re: [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs
Quoted 9 lines · Paolo Bonzini
Even though
monitor_get_fd()has to remain separate because it is mocked by tests/unit/test-util-sockets,monitor_fdsets_cleanup()is logically part of the stubs formonitor/fds.c, so move it there.Signed-off-by Paolo Bonzini<[email protected]>--- stubs/fdset.c | 6 ++++++ stubs/monitor-internal.c | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-)
r~