user-mode: Prune build dependencies (part 1)
v4 cover user-mode: Prune build dependencies (part 1)
This is the first part of a series reducing user-mode dependencies. By stripping out unused code, the build and testing time is reduced (as is space used by objects).
Part 1 (generic):
- reduce user-mode object list
- remove some migration code from user-mode
- remove cpu_get_crash_info()
Patches 1-12 are fully reviewed.
Since v3:
- Rebased due to (trivial) conflicts after:
. commit 2df9f5718df7722924699a3754f99165e2f4ae35
ui/win32-kbd-hook: handle AltGr in a hook procedure
. commit b69c3c21a5d11075d42100d5cfe0a736593fae6b
qdev: Unrealize must not fail
. commit d2623129a7dec1d3041ad1221dda1ca49c667532
qom: Drop parameter @errp of object_property_add() & friends
- Added patch #13 'Restrict ui/win32-kbd-hook to system-mode'
Since v2:
- Rebased due to conflict when applying patch:
"util/Makefile: Reduce the user-mode object list" because commit 01ef6b9e4e modified util/Makefile.objs:
"linux-user: factor out reading of /proc/self/maps"
Since v1:
- Addressed Laurent/Richard review comments
- Removed 'exec: Drop redundant #ifdeffery'
- Removed 'target: Restrict write_elfXX_note() handlers to system-mode'
$ git backport-diff -u v2 -r v3 Key: [----] : patches are identical [####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/13:[----] [--] 'Makefile: Only build virtiofsd if system-mode is enabled' 002/13:[----] [--] 'configure: Avoid building TCG when not needed' 003/13:[----] [--] 'tests/Makefile: Only display TCG-related tests when TCG is available' 004/13:[----] [--] 'tests/Makefile: Restrict some softmmu-only tests' 005/13:[----] [--] 'util/Makefile: Reduce the user-mode object list' 006/13:[----] [-C] 'stubs/Makefile: Reduce the user-mode object list' 007/13:[----] [--] 'target/riscv/cpu: Restrict CPU migration to system-mode' 008/13:[----] [--] 'exec: Assert CPU migration is not used on user-only build' 009/13:[----] [--] 'arch_init: Remove unused 'qapi-commands-misc.h' include' 010/13:[----] [-C] 'target/i386: Restrict CpuClass::get_crash_info() to system-mode' 011/13:[----] [-C] 'target/s390x: Restrict CpuClass::get_crash_info() to system-mode' 012/13:[----] [--] 'hw/core: Restrict CpuClass::get_crash_info() to system-mode' 013/13:[down] 'stubs: Restrict ui/win32-kbd-hook to system-mode'
Philippe Mathieu-Daudé (13):
Makefile: Only build virtiofsd if system-mode is enabled
configure: Avoid building TCG when not needed tests/Makefile: Only display TCG-related tests when TCG is available tests/Makefile: Restrict some softmmu-only tests util/Makefile: Reduce the user-mode object list stubs/Makefile: Reduce the user-mode object list target/riscv/cpu: Restrict CPU migration to system-mode
exec: Assert CPU migration is not used on user-only build
arch_init: Remove unused 'qapi-commands-misc.h' include target/i386: Restrict CpuClass::get_crash_info() to system-mode target/s390x: Restrict CpuClass::get_crash_info() to system-mode hw/core: Restrict CpuClass::get_crash_info() to system-mode
stubs: Restrict ui/win32-kbd-hook to system-mode
configure | 4 +++ Makefile | 2 +- include/hw/core/cpu.h | 7 ++++- arch_init.c | 1 - exec.c | 4 ++- hw/core/cpu.c | 2 ++ target/i386/cpu.c | 6 ++++- target/riscv/cpu.c | 6 +++-- target/s390x/cpu.c | 12 ++++----- stubs/Makefile.objs | 54 ++++++++++++++++++++++---------------- tests/Makefile.include | 18 +++++++------ util/Makefile.objs | 59 +++++++++++++++++++++++++++--------------- 12 files changed, 109 insertions(+), 66 deletions(-)
Signature · 1 line
2.21.3
PATCH v4 1/13 Makefile: Only build virtiofsd if system-mode is enabled
Do not build the virtiofsd helper when configured with --disable-system.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -345,7 +345,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF) vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json endif -ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) +ifeq ($(CONFIG_SOFTMMU)$(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyyy) HELPERS-y += virtiofsd$(EXESUF) vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json endif
Signature · 1 line
2.21.3
PATCH v4 2/13 configure: Avoid building TCG when not needed
In reply to Philippe Mathieu-DaudéAvoid building TCG when building only tools:
./configure --enable-tools --disable-system --disable-user
This saves us from running the soft-float tests enabled since commit 76170102508.
--- configure | 4 ++++ 1 file changed, 4 insertions(+)
configure +4 -0
@@ -1663,6 +1663,10 @@ if [ "$ARCH" = "unknown" ]; then linux_user="no" fi +if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then + tcg="no" +fi + default_target_list="" mak_wilds=""
Signature · 1 line
2.21.3
PATCH v4 3/13 tests/Makefile: Only display TCG-related tests when TCG is available
In reply to Philippe Mathieu-Daudé--- tests/Makefile.include | 2 ++ 1 file changed, 2 insertions(+)
tests/Makefile.include +2 -0
@@ -12,8 +12,10 @@ check-help: @echo " $(MAKE) check-speed Run qobject speed tests" @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" @echo " $(MAKE) check-block Run block tests" +ifeq ($(CONFIG_TCG),y) @echo " $(MAKE) check-tcg Run TCG tests" @echo " $(MAKE) check-softfloat Run FPU emulation tests" +endif @echo " $(MAKE) check-acceptance Run all acceptance (functional) tests" @echo @echo " $(MAKE) check-report.tap Generates an aggregated TAP test report"
Signature · 1 line
2.21.3
PATCH v4 4/13 tests/Makefile: Restrict some softmmu-only tests
In reply to Philippe Mathieu-DaudéIn the next commit we are going to remove some objects from the util-obj-y variable (objects which are not used by user-mode, when configured with --disable-system).
Then some system-mode tests are going to fail, due to the missing objects:
$ make check-unit -k
LINK tests/test-iov
/usr/bin/ld: tests/test-iov.o: in function `iov_from_buf':
include/qemu/iov.h:49: undefined reference to `iov_from_buf_full'
make: *** [rules.mak:124: tests/test-iov] Error 1
LINK tests/test-timed-average
/usr/bin/ld: tests/test-timed-average.o: in function `account':
tests/test-timed-average.c:27: undefined reference to `timed_average_account'
make: *** [rules.mak:124: tests/test-timed-average] Error 1
LINK tests/test-util-filemonitor
/usr/bin/ld: tests/test-util-filemonitor.o: in function `qemu_file_monitor_test_event_loop':
tests/test-util-filemonitor.c:83: undefined reference to `main_loop_wait'
make: *** [rules.mak:124: tests/test-util-filemonitor] Error 1
LINK tests/test-util-sockets
/usr/bin/ld: tests/test-util-sockets.o: in function `test_socket_fd_pass_name_good':
tests/test-util-sockets.c:91: undefined reference to `socket_connect'
make: *** [rules.mak:124: tests/test-util-sockets] Error 1
LINK tests/test-base64
/usr/bin/ld: tests/test-base64.o: in function `test_base64_good':
tests/test-base64.c:35: undefined reference to `qbase64_decode'
collect2: error: ld returned 1 exit status
make: *** [rules.mak:124: tests/test-base64] Error 1
LINK tests/test-bufferiszero
/usr/bin/ld: tests/test-bufferiszero.o: in function `test_1':
tests/test-bufferiszero.c:31: undefined reference to `buffer_is_zero'
make: *** [rules.mak:124: tests/test-bufferiszero] Error 1
make: Target 'check-unit' not remade because of errors.Instead, restrict these tests to system-mode, by using the $(CONFIG_SOFTMMU) variable.
--- tests/Makefile.include | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tests/Makefile.include +8 -8
@@ -66,14 +66,14 @@ check-unit-y += tests/check-qlit$(EXESUF) check-unit-y += tests/test-qobject-output-visitor$(EXESUF) check-unit-y += tests/test-clone-visitor$(EXESUF) check-unit-y += tests/test-qobject-input-visitor$(EXESUF) -check-unit-y += tests/test-qmp-cmds$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-qmp-cmds$(EXESUF) check-unit-y += tests/test-string-input-visitor$(EXESUF) check-unit-y += tests/test-string-output-visitor$(EXESUF) check-unit-y += tests/test-qmp-event$(EXESUF) check-unit-y += tests/test-opts-visitor$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF) check-unit-y += tests/test-visitor-serialization$(EXESUF) -check-unit-y += tests/test-iov$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-iov$(EXESUF) check-unit-y += tests/test-bitmap$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
@@ -108,7 +108,7 @@ check-unit-y += tests/test-qht$(EXESUF) check-unit-y += tests/test-qht-par$(EXESUF) check-unit-y += tests/test-bitops$(EXESUF) check-unit-y += tests/test-bitcnt$(EXESUF) -check-unit-y += tests/test-qdev-global-props$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-qdev-global-props$(EXESUF) check-unit-y += tests/check-qom-interface$(EXESUF) check-unit-y += tests/check-qom-proplist$(EXESUF) check-unit-y += tests/test-qemu-opts$(EXESUF)
@@ -126,9 +126,9 @@ check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tl ifneq (,$(findstring qemu-ga,$(TOOLS))) check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF) endif -check-unit-y += tests/test-timed-average$(EXESUF) -check-unit-$(CONFIG_INOTIFY1) += tests/test-util-filemonitor$(EXESUF) -check-unit-y += tests/test-util-sockets$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-timed-average$(EXESUF) +check-unit-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_INOTIFY1)) += tests/test-util-filemonitor$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-util-sockets$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
@@ -139,7 +139,7 @@ check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF) check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF) -check-unit-y += tests/test-base64$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-base64$(EXESUF) check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF) check-unit-$(CONFIG_BLOCK) += tests/test-crypto-afsplit$(EXESUF)
@@ -147,7 +147,7 @@ check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_QEMU_PRIVATE_XTS)) += tests/test check-unit-$(CONFIG_BLOCK) += tests/test-crypto-block$(EXESUF) check-unit-y += tests/test-logging$(EXESUF) check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF) -check-unit-y += tests/test-bufferiszero$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-bufferiszero$(EXESUF) check-unit-y += tests/test-uuid$(EXESUF) check-unit-y += tests/ptimer-test$(EXESUF) check-unit-y += tests/test-qapi-util$(EXESUF)
Signature · 1 line
2.21.3
PATCH v4 5/13 util/Makefile: Reduce the user-mode object list
In reply to Philippe Mathieu-DaudéThese objects are not required when configured with --disable-system.
--- util/Makefile.objs | 59 +++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 21 deletions(-)
util/Makefile.objs +38 -21
@@ -1,8 +1,4 @@ util-obj-y = osdep.o cutils.o unicode.o qemu-timer-common.o -util-obj-y += bufferiszero.o -util-obj-y += lockcnt.o -util-obj-y += aiocb.o async.o aio-wait.o thread-pool.o qemu-timer.o -util-obj-y += main-loop.o util-obj-$(call lnot,$(CONFIG_ATOMIC64)) += atomic64.o util-obj-$(CONFIG_POSIX) += aio-posix.o util-obj-$(CONFIG_POSIX) += fdmon-poll.o
@@ -21,31 +17,20 @@ util-obj-$(CONFIG_WIN32) += oslib-win32.o util-obj-$(CONFIG_WIN32) += qemu-thread-win32.o util-obj-y += envlist.o path.o module.o util-obj-y += host-utils.o -util-obj-y += bitmap.o bitops.o hbitmap.o +util-obj-y += bitmap.o bitops.o util-obj-y += fifo8.o -util-obj-y += nvdimm-utils.o util-obj-y += cacheinfo.o util-obj-y += error.o qemu-error.o util-obj-y += qemu-print.o util-obj-y += id.o -util-obj-y += iov.o qemu-config.o qemu-sockets.o uri.o notify.o +util-obj-y += qemu-config.o notify.o util-obj-y += qemu-option.o qemu-progress.o util-obj-y += keyval.o -util-obj-y += hexdump.o util-obj-y += crc32c.o util-obj-y += uuid.o -util-obj-y += throttle.o util-obj-y += getauxval.o -util-obj-y += readline.o util-obj-y += rcu.o util-obj-$(CONFIG_MEMBARRIER) += sys_membarrier.o -util-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o -util-obj-y += qemu-coroutine-sleep.o -util-obj-y += qemu-co-shared-resource.o -util-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o -util-obj-y += buffer.o -util-obj-y += timed-average.o -util-obj-y += base64.o util-obj-y += log.o util-obj-y += pagesize.o util-obj-y += qdist.o
@@ -54,13 +39,45 @@ util-obj-y += qsp.o util-obj-y += range.o util-obj-y += stats64.o util-obj-y += systemd.o -util-obj-y += iova-tree.o -util-obj-$(CONFIG_INOTIFY1) += filemonitor-inotify.o -util-obj-$(call lnot,$(CONFIG_INOTIFY1)) += filemonitor-stub.o -util-obj-$(CONFIG_LINUX) += vfio-helpers.o util-obj-$(CONFIG_POSIX) += drm.o util-obj-y += guest-random.o util-obj-$(CONFIG_GIO) += dbus.o dbus.o-cflags = $(GIO_CFLAGS) dbus.o-libs = $(GIO_LIBS) util-obj-$(CONFIG_USER_ONLY) += selfmap.o + +####################################################################### +# code used by both qemu system emulation and qemu-img + +ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y) + +util-obj-y += aio-wait.o +util-obj-y += aiocb.o +util-obj-y += async.o +util-obj-y += base64.o +util-obj-y += buffer.o +util-obj-y += bufferiszero.o +util-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o +util-obj-y += hexdump.o +util-obj-y += lockcnt.o +util-obj-y += iov.o +util-obj-y += iova-tree.o +util-obj-y += hbitmap.o +util-obj-y += main-loop.o +util-obj-y += nvdimm-utils.o +util-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o +util-obj-y += qemu-coroutine-sleep.o +util-obj-y += qemu-co-shared-resource.o +util-obj-y += qemu-sockets.o +util-obj-y += qemu-timer.o +util-obj-y += thread-pool.o +util-obj-y += throttle.o +util-obj-y += timed-average.o +util-obj-y += uri.o + +util-obj-$(CONFIG_LINUX) += vfio-helpers.o +util-obj-$(CONFIG_INOTIFY1) += filemonitor-inotify.o +util-obj-$(call lnot,$(CONFIG_INOTIFY1)) += filemonitor-stub.o +util-obj-$(CONFIG_BLOCK) += readline.o + +endif # CONFIG_SOFTMMU || CONFIG_TOOLS
Signature · 1 line
2.21.3
PATCH v4 6/13 stubs/Makefile: Reduce the user-mode object list
In reply to Philippe Mathieu-DaudéThese stubs are not required when configured with --disable-system.
--- stubs/Makefile.objs | 52 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 22 deletions(-)
stubs/Makefile.objs +30 -22
@@ -1,47 +1,55 @@ -stub-obj-y += arch_type.o -stub-obj-y += bdrv-next-monitor-owned.o stub-obj-y += blk-commit-all.o -stub-obj-y += blockdev-close-all-bdrv-states.o -stub-obj-y += clock-warp.o stub-obj-y += cpu-get-clock.o stub-obj-y += cpu-get-icount.o stub-obj-y += dump.o stub-obj-y += error-printf.o stub-obj-y += fdset.o stub-obj-y += gdbstub.o -stub-obj-y += get-vm-name.o -stub-obj-y += iothread.o stub-obj-y += iothread-lock.o stub-obj-y += is-daemonized.o stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o -stub-obj-y += machine-init-done.o -stub-obj-y += migr-blocker.o -stub-obj-y += change-state-handler.o -stub-obj-y += monitor.o stub-obj-y += monitor-core.o stub-obj-y += notify-event.o +stub-obj-y += qmp_memory_device.o stub-obj-y += qtest.o +stub-obj-y += ramfb.o stub-obj-y += replay.o -stub-obj-y += replay-user.o stub-obj-y += runstate-check.o +stub-obj-$(CONFIG_SOFTMMU) += semihost.o stub-obj-y += set-fd-handler.o +stub-obj-y += vmgenid.o stub-obj-y += sysbus.o stub-obj-y += tpm.o stub-obj-y += trace-control.o -stub-obj-y += uuid.o -stub-obj-y += vm-stop.o stub-obj-y += vmstate.o stub-obj-y += win32-kbd-hook.o + +####################################################################### +# code used by both qemu system emulation and qemu-img + +ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y) + +stub-obj-y += arch_type.o +stub-obj-y += bdrv-next-monitor-owned.o +stub-obj-y += blockdev-close-all-bdrv-states.o +stub-obj-y += change-state-handler.o +stub-obj-y += clock-warp.o stub-obj-y += fd-register.o -stub-obj-y += qmp_memory_device.o -stub-obj-y += target-monitor-defs.o -stub-obj-y += target-get-monitor-def.o -stub-obj-y += vmgenid.o -stub-obj-y += xen-common.o -stub-obj-y += xen-hvm.o +stub-obj-y += fw_cfg.o +stub-obj-y += get-vm-name.o +stub-obj-y += iothread.o +stub-obj-y += machine-init-done.o +stub-obj-y += migr-blocker.o +stub-obj-y += monitor.o stub-obj-y += pci-host-piix.o stub-obj-y += ram-block.o -stub-obj-y += ramfb.o -stub-obj-y += fw_cfg.o -stub-obj-$(CONFIG_SOFTMMU) += semihost.o +stub-obj-y += replay-user.o +stub-obj-y += target-get-monitor-def.o +stub-obj-y += target-monitor-defs.o +stub-obj-y += uuid.o +stub-obj-y += vm-stop.o +stub-obj-y += xen-common.o +stub-obj-y += xen-hvm.o + +endif # CONFIG_SOFTMMU || CONFIG_TOOLS
Signature · 1 line
2.21.3
PATCH v4 7/13 target/riscv/cpu: Restrict CPU migration to system-mode
In reply to Philippe Mathieu-Daudé--- target/riscv/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
target/riscv/cpu.c +4 -2
@@ -485,10 +485,12 @@ static void riscv_cpu_init(Object *obj)cpu_set_cpustate_pointers (cpu); } +#ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_riscv_cpu = { .name ="cpu" , .unmigratable =1 , }; +#endif static Property riscv_cpu_properties[] = {DEFINE_PROP_BOOL ("i" ,RISCVCPU , cfg.ext_i, true),
@@ -544,13 +546,13 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->do_transaction_failed = riscv_cpu_do_transaction_failed; cc->do_unaligned_access = riscv_cpu_do_unaligned_access; cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug; +/* For now, mark unmigratable: */ + cc->vmsd = &vmstate_riscv_cpu;#endif #ifdef CONFIG_TCG cc->tcg_initialize = riscv_translate_init; cc->tlb_fill = riscv_cpu_tlb_fill;#endif -/* For now, mark unmigratable: */ - cc->vmsd = &vmstate_riscv_cpu;device_class_set_props (dc, riscv_cpu_properties); }
Signature · 1 line
2.21.3
PATCH v4 8/13 exec: Assert CPU migration is not used on user-only build
In reply to Philippe Mathieu-Daudé--- exec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
exec.c +3 -1
@@ -946,7 +946,9 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)qemu_plugin_vcpu_init_hook (cpu); -#ifndef CONFIG_USER_ONLY +#ifdef CONFIG_USER_ONLY +assert (cc->vmsd ==NULL ); +#else /* !CONFIG_USER_ONLY */ if (qdev_get_vmsd (DEVICE (cpu)) ==NULL ) {vmstate_register (NULL , cpu->cpu_index, &vmstate_cpu_common, cpu); }
Signature · 1 line
2.21.3
PATCH v4 9/13 arch_init: Remove unused 'qapi-commands-misc.h' include
In reply to Philippe Mathieu-DaudéCommit ffaee83bcb2 moved qmp_query_target but forgot to remove this include.
--- arch_init.c | 1 - 1 file changed, 1 deletion(-)
arch_init.c +0 -1
@@ -27,7 +27,6 @@#include "sysemu/arch_init.h" #include "hw/pci/pci.h" #include "hw/audio/soundhw.h" -#include "qapi/qapi-commands-misc.h" #include "qapi/error.h" #include "qemu/config-file.h" #include "qemu/error-report.h"
Signature · 1 line
2.21.3
PATCH v4 10/13 target/i386: Restrict CpuClass::get_crash_info() to system-mode
In reply to Philippe Mathieu-Daudé--- target/i386/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target/i386/cpu.c +5 -1
@@ -6843,6 +6843,7 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu,x86_cpu_register_bit_prop (cpu, name, w, bitnr); } +#if !defined(CONFIG_USER_ONLY )static GuestPanicInformation *x86_cpu_get_crash_info (CPUState *cs) {X86CPU *cpu =X86_CPU (cs);
@@ -6886,6 +6887,7 @@ static void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, errp); qapi_free_GuestPanicInformation(panic_info); } +#endif /* !CONFIG_USER_ONLY */ static void x86_cpu_initfn (Object *obj) {
@@ -6932,8 +6934,10 @@ static void x86_cpu_initfn(Object *obj) x86_cpu_get_unavailable_features, NULL, NULL, NULL); +#if !defined(CONFIG_USER_ONLY )object_property_add (obj,"crash-information" ,"GuestPanicInformation" , x86_cpu_get_crash_info_qom,NULL ,NULL ,NULL ); +#endif for (w =0 ; w <FEATURE_WORDS ; w++) {int bitnr;
@@ -7245,7 +7249,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->cpu_exec_interrupt = x86_cpu_exec_interrupt;#endif cc->dump_state = x86_cpu_dump_state; - cc->get_crash_info = x86_cpu_get_crash_info; cc->set_pc = x86_cpu_set_pc; cc->synchronize_from_tb = x86_cpu_synchronize_from_tb; cc->gdb_read_register = x86_cpu_gdb_read_register;
@@ -7256,6 +7259,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->asidx_from_attrs = x86_asidx_from_attrs; cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug; + cc->get_crash_info = x86_cpu_get_crash_info; cc->write_elf64_note = x86_cpu_write_elf64_note; cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; cc->write_elf32_note = x86_cpu_write_elf32_note;
Signature · 1 line
2.21.3
PATCH v4 11/13 target/s390x: Restrict CpuClass::get_crash_info() to system-mode
In reply to Philippe Mathieu-Daudé--- target/s390x/cpu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
target/s390x/cpu.c +5 -7
@@ -247,6 +247,7 @@ out:error_propagate (errp, err); } +#if !defined(CONFIG_USER_ONLY )static GuestPanicInformation *s390_cpu_get_crash_info (CPUState *cs) {GuestPanicInformation *panic_info;
@@ -256,11 +257,7 @@ static GuestPanicInformation *s390_cpu_get_crash_info(CPUState *cs) panic_info =g_malloc0 (sizeof (GuestPanicInformation)); panic_info->type =GUEST_PANIC_INFORMATION_TYPE_S390 ; -#if !defined(CONFIG_USER_ONLY ) panic_info->u.s390.core = cpu->env.core_id; -#else - panic_info->u.s390.core =0 ;/* sane default for non system emulation */ -#endif panic_info->u.s390.psw_mask = cpu->env.psw.mask; panic_info->u.s390.psw_addr = cpu->env.psw.addr; panic_info->u.s390.reason = cpu->env.crash_reason;
@@ -286,6 +283,7 @@ static void s390_cpu_get_crash_info_qom(Object *obj, Visitor *v, errp); qapi_free_GuestPanicInformation(panic_info); } +#endif static void s390_cpu_initfn (Object *obj) {
@@ -295,16 +293,16 @@ static void s390_cpu_initfn(Object *obj)cpu_set_cpustate_pointers (cpu); cs->halted =1 ; cs->exception_index =EXCP_HLT ; +#if !defined(CONFIG_USER_ONLY )object_property_add (obj,"crash-information" ,"GuestPanicInformation" , s390_cpu_get_crash_info_qom,NULL ,NULL ,NULL ); -s390_cpu_model_register_props (obj); -#if !defined(CONFIG_USER_ONLY ) cpu->env.tod_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , s390x_tod_timer, cpu); cpu->env.cpu_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , s390x_cpu_timer, cpu);s390_cpu_set_state (S390_CPU_STATE_STOPPED , cpu);#endif +s390_cpu_model_register_props (obj); }static void s390_cpu_finalize (Object *obj)
@@ -488,13 +486,13 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->do_interrupt = s390_cpu_do_interrupt;#endif cc->dump_state = s390_cpu_dump_state; - cc->get_crash_info = s390_cpu_get_crash_info; cc->set_pc = s390_cpu_set_pc; cc->gdb_read_register = s390_cpu_gdb_read_register; cc->gdb_write_register = s390_cpu_gdb_write_register;#ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = s390_cpu_get_phys_page_debug; cc->vmsd = &vmstate_s390_cpu; + cc->get_crash_info = s390_cpu_get_crash_info; cc->write_elf64_note = s390_cpu_write_elf64_note;#ifdef CONFIG_TCG cc->cpu_exec_interrupt = s390_cpu_exec_interrupt;
Signature · 1 line
2.21.3
PATCH v4 12/13 hw/core: Restrict CpuClass::get_crash_info() to system-mode
In reply to Philippe Mathieu-Daudé--- include/hw/core/cpu.h | 7 ++++++- hw/core/cpu.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-)
include/hw/core/cpu.h +6 -1
@@ -490,6 +490,8 @@ bool cpu_paging_enabled(const CPUState *cpu);void cpu_get_memory_mapping (CPUState *cpu,MemoryMappingList *list,Error **errp); +#if !defined(CONFIG_USER_ONLY ) +/** * cpu_write_elf64_note: * @f: pointer to a function that writes memory to a file
@@ -539,6 +541,8 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,*/ GuestPanicInformation *cpu_get_crash_info (CPUState *cpu); +#endif /* !CONFIG_USER_ONLY */ +/** * CPUDumpFlags: * @CPU_DUMP_CODE:
@@ -632,7 +636,8 @@ static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) }return ret; } -#endif + +#endif /* CONFIG_USER_ONLY */ /** * cpu_list_add:
hw/core/cpu.c +2 -0
@@ -209,6 +209,7 @@ static bool cpu_common_exec_interrupt(CPUState *cpu, int int_req)return false; } +#if !defined(CONFIG_USER_ONLY )GuestPanicInformation *cpu_get_crash_info (CPUState *cpu) {CPUClass *cc =CPU_GET_CLASS (cpu);
@@ -219,6 +220,7 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) }return res; } +#endif void cpu_dump_state (CPUState *cpu,FILE *f,int flags) {
Signature · 1 line
2.21.3
PATCH v4 13/13 stubs: Restrict ui/win32-kbd-hook to system-mode
In reply to Philippe Mathieu-DaudéIn Makefile.objs, the ui/ directory is restricted to system-mode:
43 ifeq ($(CONFIG_SOFTMMU),y)
...
65 common-obj-y += ui/
66 common-obj-m += ui/
...
82 endif # CONFIG_SOFTMMU
Restrict the ui/ stub added in commit 2df9f5718df to only build it for system-mode emulation.
---
Cc: Volker Rümelin <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
--- stubs/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
stubs/Makefile.objs +1 -1
@@ -23,7 +23,7 @@ stub-obj-y += sysbus.o stub-obj-y += tpm.o stub-obj-y += trace-control.o stub-obj-y += vmstate.o -stub-obj-y += win32-kbd-hook.o +stub-obj-$(CONFIG_SOFTMMU) += win32-kbd-hook.o ####################################################################### # code used by both qemu system emulation and qemu-img
Signature · 1 line
2.21.3
Re: [PATCH v4 13/13] stubs: Restrict ui/win32-kbd-hook to system-mode
Quoted 9 lines · Philippe Mathieu-Daudé
In Makefile.objs, the ui/ directory is restricted to system-mode:
43 ifeq ($(CONFIG_SOFTMMU),y)
...
65 common-obj-y += ui/
66 common-obj-m += ui/
...
82 endif #CONFIG_SOFTMMU
Quoted 5 lines
Restrict the ui/ stub added in commit
2df9f5718dfto only build it for system-mode emulation.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
r~
This series is now fully reviewed.
Laurent, as Paolo's misc-tree is already full, can it go via your linux-user tree (as it improve linux-user at the end)?
Thanks,
Phil.
Quoted 9 lines · Philippe Mathieu-Daudé
This is the first part of a series reducing user-mode dependencies. By stripping out unused code, the build and testing time is reduced (as is space used by objects).
Part 1 (generic):
- reduce user-mode object list
- remove some migration code from user-mode
- removecpu_get_crash_info()
[...]
Quoted 15 lines
Philippe Mathieu-Daudé (13):
Makefile: Only build virtiofsd if system-mode is enabled
configure: Avoid building TCG when not needed tests/Makefile: Only display TCG-related tests when TCG is available tests/Makefile: Restrict some softmmu-only tests util/Makefile: Reduce the user-mode object list stubs/Makefile: Reduce the user-mode object list target/riscv/cpu: Restrict CPU migration to system-mode
exec: Assert CPU migration is not used on user-only build
arch_init: Remove unused 'qapi-commands-misc.h' include target/i386: RestrictCpuClass::get_crash_info()to system-mode target/s390x: RestrictCpuClass::get_crash_info()to system-mode hw/core: RestrictCpuClass::get_crash_info()to system-mode
stubs: Restrict ui/win32-kbd-hook to system-mode
Le 02/06/2020 à 16:46, Philippe Mathieu-Daudé a écrit :
Quoted 4 lines
This series is now fully reviewed.
Laurent, as Paolo's misc-tree is already full, can it go via your linux-user tree (as it improve linux-user at the end)?
OK, I add the series to my queue. I plan to do a linux-user PR soon.
Thanks,
Laurent
Quoted 31 lines
Thanks,
Phil.
Quoted 9 lines · Philippe Mathieu-Daudé
This is the first part of a series reducing user-mode dependencies. By stripping out unused code, the build and testing time is reduced (as is space used by objects).
Part 1 (generic):
- reduce user-mode object list
- remove some migration code from user-mode
- removecpu_get_crash_info()[...]
Quoted 15 lines
Philippe Mathieu-Daudé (13):
Makefile: Only build virtiofsd if system-mode is enabled
configure: Avoid building TCG when not needed tests/Makefile: Only display TCG-related tests when TCG is available tests/Makefile: Restrict some softmmu-only tests util/Makefile: Reduce the user-mode object list stubs/Makefile: Reduce the user-mode object list target/riscv/cpu: Restrict CPU migration to system-mode
exec: Assert CPU migration is not used on user-only build
arch_init: Remove unused 'qapi-commands-misc.h' include target/i386: RestrictCpuClass::get_crash_info()to system-mode target/s390x: RestrictCpuClass::get_crash_info()to system-mode hw/core: RestrictCpuClass::get_crash_info()to system-mode
stubs: Restrict ui/win32-kbd-hook to system-mode