Stubs cleanup
cover Stubs cleanup
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c. libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.
Paolo
Paolo Bonzini (11):
stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub
stubs: move smbios stubs to hw/smbios
stubs: move acpi stubs to hw/acpi
stubs: remove unused stub for serial_hd
hw: move reset handlers from vl.c to hw/core
stubs: group stubs for user-mode emulation
stubs: group all monitor_fdset_* functions in a single file
stubs: move vhost stubs to stubs/vhost.o
event_notifier: cleanups around event_notifier_set_handler
build: remove --enable-colo/--disable-colo
stubs: remove stubs/kvm.c
MAINTAINERS | 1 +
Makefile.target | 4 +-
configure | 11 ----
hw/Makefile.objs | 2 +-
hw/acpi/Makefile.objs | 12 ++--
stubs/ipmi.c => hw/acpi/ipmi-stub.c | 0
hw/core/Makefile.objs | 2 +-
hw/core/reset.c | 72 ++++++++++++++++++++++
hw/smbios/Makefile.objs | 11 +++-
.../smbios/smbios_type_38-stub.c | 0
hw/usb/ccid-card-emulated.c | 2 +-
hw/virtio/Makefile.objs | 6 +-
stubs/vhost.c => hw/virtio/vhost-stub.c | 0
hw/virtio/virtio.c | 10 +--
include/hw/hw.h | 6 +-
include/qemu/event_notifier.h | 3 -
include/qemu/main-loop.h | 15 +++++
include/sysemu/reset.h | 10 +++
include/sysemu/sysemu.h | 1 -
iohandler.c | 7 +++
migration/Makefile.objs | 3 +-
stubs/Makefile.objs | 19 +-----
stubs/cpus.c | 11 ----
stubs/fdset-add-fd.c | 8 ---
stubs/fdset-find-fd.c | 8 ---
stubs/fdset-get-fd.c | 8 ---
stubs/fdset-remove-fd.c | 7 ---
stubs/fdset.c | 22 +++++++
stubs/get-next-serial.c | 4 --
stubs/iohandler.c | 8 ---
stubs/kvm.c | 8 ---
stubs/migration-colo.c | 46 --------------
stubs/mon-is-qmp.c | 10 ---
stubs/monitor-init.c | 7 ---
stubs/{get-fd.c => monitor.c} | 6 ++
stubs/replay-user.c | 33 ----------
stubs/reset.c | 14 -----
target/i386/hyperv.c | 7 ++-
target/mips/kvm.c | 5 ++
target/ppc/kvm.c | 5 ++
target/s390x/kvm.c | 5 ++
tests/Makefile.include | 1 +
user-exec-stub.c | 34 ++++++++++
util/event_notifier-posix.c | 9 ---
util/event_notifier-win32.c | 12 ----
vl.c | 42 -------------
46 files changed, 222 insertions(+), 295 deletions(-)
rename stubs/ipmi.c => hw/acpi/ipmi-stub.c (100%)
create mode 100644 hw/core/reset.c
rename stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c (100%)
rename stubs/vhost.c => hw/virtio/vhost-stub.c (100%)
create mode 100644 include/sysemu/reset.h
delete mode 100644 stubs/cpus.c
delete mode 100644 stubs/fdset-add-fd.c
delete mode 100644 stubs/fdset-find-fd.c
delete mode 100644 stubs/fdset-get-fd.c
delete mode 100644 stubs/fdset-remove-fd.c
create mode 100644 stubs/fdset.c
delete mode 100644 stubs/get-next-serial.c
delete mode 100644 stubs/iohandler.c
delete mode 100644 stubs/kvm.c
delete mode 100644 stubs/migration-colo.c
delete mode 100644 stubs/mon-is-qmp.c
delete mode 100644 stubs/monitor-init.c
rename stubs/{get-fd.c => monitor.c} (75%)
delete mode 100644 stubs/replay-user.c
delete mode 100644 stubs/reset.c
create mode 100644 user-exec-stub.cSignature · 1 line
2.9.3
PATCH 1/11 stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub
monitor_cur_is_qmp was previously used by other stubs, but it's not since 397d30e ("qemu-error: remove dependency of stubs on monitor", 2016-11-01).
---
stubs/Makefile.objs | 4 +---
stubs/mon-is-qmp.c | 10 ----------
stubs/monitor-init.c | 7 -------
stubs/{get-fd.c => monitor.c} | 6 ++++++
4 files changed, 7 insertions(+), 20 deletions(-)
delete mode 100644 stubs/mon-is-qmp.c
delete mode 100644 stubs/monitor-init.c
rename stubs/{get-fd.c => monitor.c} (75%)stubs/Makefile.objs +1 -3
@@ -15,7 +15,6 @@ stub-obj-y += fdset-find-fd.o stub-obj-y += fdset-get-fd.o stub-obj-y += fdset-remove-fd.o stub-obj-y += gdbstub.o -stub-obj-y += get-fd.o stub-obj-y += get-next-serial.o stub-obj-y += get-vm-name.o stub-obj-y += iothread.o
@@ -23,8 +22,7 @@ stub-obj-y += iothread-lock.o stub-obj-y += is-daemonized.o stub-obj-y += machine-init-done.o stub-obj-y += migr-blocker.o -stub-obj-y += mon-is-qmp.o -stub-obj-y += monitor-init.o +stub-obj-y += monitor.o stub-obj-y += notify-event.o stub-obj-y += qtest.o stub-obj-y += replay.o
stubs/mon-is-qmp.c deleted +0 -10
@@ -1,10 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "monitor/monitor.h" - -Monitor *cur_mon; - -bool monitor_cur_is_qmp (void ) -{ -return false; -}
stubs/monitor-init.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "monitor/monitor.h" - -void monitor_init (CharDriverState *chr,int flags) -{ -}
stubs/monitor.c renamed from stubs/get-fd.c +6 -0
@@ -3,8 +3,14 @@#include "qemu-common.h" #include "monitor/monitor.h" +Monitor *cur_mon =NULL ; +int monitor_get_fd (Monitor *mon,const char *name,Error **errp) {error_setg (errp,"only QEMU supports file descriptor passing" );return -1 ; } + +void monitor_init (CharDriverState *chr,int flags) +{ +}
Signature · 1 line
2.9.3
PATCH 2/11 stubs: move smbios stubs to hw/smbios
In reply to Paolo BonziniNo need to include them in libqemustub.a, since only system emulators need them.
--- hw/smbios/Makefile.objs | 11 ++++++++--- stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c | 0 stubs/Makefile.objs | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) rename stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c (100%)
hw/smbios/Makefile.objs +8 -3
@@ -1,5 +1,10 @@ -common-obj-$(CONFIG_SMBIOS) += smbios.o -common-obj-$(call land,$(CONFIG_SMBIOS),$(CONFIG_IPMI)) += smbios_type_38.o +ifeq ($(CONFIG_SMBIOS),y) +common-obj-y += smbios.o +common-obj-$(CONFIG_IPMI) += smbios_type_38.o +common-obj-$(call lnot,$(CONFIG_IPMI)) += smbios_type_38-stub.o +else +common-obj-y += smbios-stub.o +endif -common-obj-$(call lnot,$(CONFIG_SMBIOS)) += smbios-stub.o common-obj-$(CONFIG_ALL) += smbios-stub.o +common-obj-$(CONFIG_ALL) += smbios_type_38-stub.o
hw/smbios/smbios_type_38-stub.c renamed from stubs/smbios_type_38.c +0 -0
stubs/Makefile.objs +0 -1
@@ -44,7 +44,6 @@ stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o stub-obj-y += vhost.o stub-obj-y += iohandler.o -stub-obj-y += smbios_type_38.o stub-obj-y += ipmi.o stub-obj-y += pc_madt_cpu_entry.o stub-obj-y += migration-colo.o
Signature · 1 line
2.9.3
PATCH 3/11 stubs: move acpi stubs to hw/acpi
In reply to Paolo BonziniNo need to include them in libqemustub.a, since only system emulators need them.
--- hw/acpi/Makefile.objs | 12 ++++++++---- stubs/ipmi.c => hw/acpi/ipmi-stub.c | 0 stubs/Makefile.objs | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) rename stubs/ipmi.c => hw/acpi/ipmi-stub.c (100%)
hw/acpi/Makefile.objs +8 -4
@@ -4,7 +4,11 @@ common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o -common-obj-$(CONFIG_ACPI) += acpi_interface.o -common-obj-$(CONFIG_ACPI) += bios-linker-loader.o -common-obj-$(CONFIG_ACPI) += aml-build.o -common-obj-$(call land,$(CONFIG_ACPI),$(CONFIG_IPMI)) += ipmi.o + +common-obj-y += acpi_interface.o +common-obj-y += bios-linker-loader.o +common-obj-y += aml-build.o + +common-obj-$(CONFIG_IPMI) += ipmi.o +common-obj-$(call lnot,$(CONFIG_IPMI)) += ipmi-stub.o +common-obj-$(CONFIG_ALL) += ipmi-stub.o
hw/acpi/ipmi-stub.c renamed from stubs/ipmi.c +0 -0
stubs/Makefile.objs +0 -1
@@ -44,6 +44,5 @@ stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o stub-obj-y += vhost.o stub-obj-y += iohandler.o -stub-obj-y += ipmi.o stub-obj-y += pc_madt_cpu_entry.o stub-obj-y += migration-colo.o
Signature · 1 line
2.9.3
PATCH 4/11 stubs: remove unused stub for serial_hd
In reply to Paolo Bonzini--- stubs/Makefile.objs | 1 - stubs/get-next-serial.c | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 stubs/get-next-serial.c
stubs/Makefile.objs +0 -1
@@ -15,7 +15,6 @@ stub-obj-y += fdset-find-fd.o stub-obj-y += fdset-get-fd.o stub-obj-y += fdset-remove-fd.o stub-obj-y += gdbstub.o -stub-obj-y += get-next-serial.o stub-obj-y += get-vm-name.o stub-obj-y += iothread.o stub-obj-y += iothread-lock.o
stubs/get-next-serial.c deleted +0 -4
@@ -1,4 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" - -CharDriverState *serial_hds[0 ];
Signature · 1 line
2.9.3
PATCH 5/11 hw: move reset handlers from vl.c to hw/core
In reply to Paolo BonziniThey are small, it is not worth stubbing them. Just include them in user-mode emulators and unit tests as well.
--- hw/core/Makefile.objs | 2 +- hw/core/reset.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/hw.h | 6 +---- include/sysemu/reset.h | 10 +++++++ include/sysemu/sysemu.h | 1 - stubs/Makefile.objs | 1 - stubs/reset.c | 14 ---------- tests/Makefile.include | 1 + vl.c | 42 ----------------------------- 9 files changed, 85 insertions(+), 64 deletions(-) create mode 100644 hw/core/reset.c create mode 100644 include/sysemu/reset.h delete mode 100644 stubs/reset.c
hw/core/Makefile.objs +1 -1
@@ -1,6 +1,6 @@ # core qdev-related obj files, also used by *-user: common-obj-y += qdev.o qdev-properties.o -common-obj-y += bus.o +common-obj-y += bus.o reset.o common-obj-y += fw-path-provider.o # irq.o needed for qdev GPIO handling: common-obj-y += irq.o
hw/core/reset.c new file +72 -0
72 lines not on this page · raw message
include/hw/hw.h +1 -5
@@ -12,11 +12,7 @@#include "hw/irq.h" #include "migration/vmstate.h" #include "qemu/module.h" - -typedef void QEMUResetHandler (void *opaque); - -void qemu_register_reset (QEMUResetHandler *func,void *opaque); -void qemu_unregister_reset (QEMUResetHandler *func,void *opaque); +#include "sysemu/reset.h" void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
include/sysemu/reset.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef QEMU_SYSEMU_RESET_H +#define QEMU_SYSEMU_RESET_H + +typedef void QEMUResetHandler (void *opaque); + +void qemu_register_reset (QEMUResetHandler *func,void *opaque); +void qemu_unregister_reset (QEMUResetHandler *func,void *opaque); +void qemu_devices_reset (void ); + +#endif
include/sysemu/sysemu.h +0 -1
@@ -63,7 +63,6 @@ void qemu_system_vmstop_request_prepare(void);int qemu_shutdown_requested_get (void );int qemu_reset_requested_get (void );void qemu_system_killed (int signal,pid_t pid); -void qemu_devices_reset (void );void qemu_system_reset (bool report);void qemu_system_guest_panicked (void );size_t qemu_target_page_bits (void );
stubs/Makefile.objs +0 -1
@@ -26,7 +26,6 @@ stub-obj-y += notify-event.o stub-obj-y += qtest.o stub-obj-y += replay.o stub-obj-y += replay-user.o -stub-obj-y += reset.o stub-obj-y += runstate-check.o stub-obj-y += set-fd-handler.o stub-obj-y += slirp.o
stubs/reset.c deleted +0 -14
@@ -1,14 +0,0 @@ -#include "qemu/osdep.h" -#include "hw/hw.h" - -/* Stub functions for binaries that never call qemu_devices_reset(), -* and don't need to keep track of the reset handler list. -*/ - -void qemu_register_reset (QEMUResetHandler *func,void *opaque) -{ -} - -void qemu_unregister_reset (QEMUResetHandler *func,void *opaque) -{ -}
tests/Makefile.include +1 -0
@@ -515,6 +515,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ hw/core/bus.o \ hw/core/irq.o \ hw/core/fw-path-provider.o \ + hw/core/reset.o \ $(test-qapi-obj-y) tests/test-vmstate$(EXESUF): tests/test-vmstate.o \ migration/vmstate.o migration/qemu-file.o \
vl.c +0 -42
54 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 6/11 stubs: group stubs for user-mode emulation
In reply to Paolo BonziniSome stubs are used for user-mode emulation only; they are not needed by tools. Move them out of stubs/.
--- MAINTAINERS | 1 + Makefile.target | 4 ++-- stubs/Makefile.objs | 2 -- stubs/cpus.c | 11 ----------- stubs/replay-user.c | 33 --------------------------------- user-exec-stub.c | 34 ++++++++++++++++++++++++++++++++++ 6 files changed, 37 insertions(+), 48 deletions(-) delete mode 100644 stubs/cpus.c delete mode 100644 stubs/replay-user.c create mode 100644 user-exec-stub.c
MAINTAINERS +1 -0
@@ -1496,6 +1496,7 @@ M: Riku Voipio <[email protected]> S: Maintained F: thunk.c F: user-exec.c +F: user-exec-stub.c BSD user S: Orphan
Makefile.target +2 -2
@@ -115,7 +115,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \ -I$(SRC_PATH)/linux-user obj-y += linux-user/ -obj-y += gdbstub.o thunk.o user-exec.o +obj-y += gdbstub.o thunk.o user-exec.o user-exec-stub.o endif #CONFIG_LINUX_USER
@@ -128,7 +128,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR) obj-y += bsd-user/ -obj-y += gdbstub.o user-exec.o +obj-y += gdbstub.o user-exec.o user-exec-stub.o endif #CONFIG_BSD_USER
stubs/Makefile.objs +0 -2
@@ -25,7 +25,6 @@ stub-obj-y += monitor.o stub-obj-y += notify-event.o stub-obj-y += qtest.o stub-obj-y += replay.o -stub-obj-y += replay-user.o stub-obj-y += runstate-check.o stub-obj-y += set-fd-handler.o stub-obj-y += slirp.o
@@ -35,7 +34,6 @@ stub-obj-y += uuid.o stub-obj-y += vm-stop.o stub-obj-y += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.o -stub-obj-y += cpus.o stub-obj-y += kvm.o stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o
stubs/cpus.c deleted +0 -11
@@ -1,11 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "qom/cpu.h" - -void cpu_resume (CPUState *cpu) -{ -} - -void qemu_init_vcpu (CPUState *cpu) -{ -}
stubs/replay-user.c deleted +0 -33
@@ -1,33 +0,0 @@ -/* -* replay.c -* -* Copyright (c) 2010-2015 Institute for System Programming -* of the Russian Academy of Sciences. -* -* 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 "sysemu/replay.h" - -bool replay_exception (void ) -{ -return true; -} - -bool replay_has_exception (void ) -{ -return false; -} - -bool replay_interrupt (void ) -{ -return true; -} - -bool replay_has_interrupt (void ) -{ -return false; -}
user-exec-stub.c new file +34 -0
@@ -0,0 +1,34 @@ +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "qom/cpu.h" +#include "sysemu/replay.h" + +void cpu_resume (CPUState *cpu) +{ +} + +void qemu_init_vcpu (CPUState *cpu) +{ +} + +/* User mode emulation does not support record/replay yet. */ + +bool replay_exception (void ) +{ +return true; +} + +bool replay_has_exception (void ) +{ +return false; +} + +bool replay_interrupt (void ) +{ +return true; +} + +bool replay_has_interrupt (void ) +{ +return false; +}
Signature · 1 line
2.9.3
PATCH 7/11 stubs: group all monitor_fdset_* functions in a single file
In reply to Paolo BonziniIt makes little sense to implement only one of them, so avoid proliferation of stubs files.
--- stubs/Makefile.objs | 5 +---- stubs/fdset-add-fd.c | 8 -------- stubs/fdset-find-fd.c | 8 -------- stubs/fdset-get-fd.c | 8 -------- stubs/fdset-remove-fd.c | 7 ------- stubs/fdset.c | 22 ++++++++++++++++++++++ 6 files changed, 23 insertions(+), 35 deletions(-) delete mode 100644 stubs/fdset-add-fd.c delete mode 100644 stubs/fdset-find-fd.c delete mode 100644 stubs/fdset-get-fd.c delete mode 100644 stubs/fdset-remove-fd.c create mode 100644 stubs/fdset.c
stubs/Makefile.objs +1 -4
@@ -10,10 +10,7 @@ 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-add-fd.o -stub-obj-y += fdset-find-fd.o -stub-obj-y += fdset-get-fd.o -stub-obj-y += fdset-remove-fd.o +stub-obj-y += fdset.o stub-obj-y += gdbstub.o stub-obj-y += get-vm-name.o stub-obj-y += iothread.o
stubs/fdset-add-fd.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "monitor/monitor.h" - -int monitor_fdset_dup_fd_add (int64_t fdset_id,int dup_fd) -{ -return -1 ; -}
stubs/fdset-find-fd.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "monitor/monitor.h" - -int monitor_fdset_dup_fd_find (int dup_fd) -{ -return -1 ; -}
stubs/fdset-get-fd.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "monitor/monitor.h" - -int monitor_fdset_get_fd (int64_t fdset_id,int flags) -{ -return -1 ; -}
stubs/fdset-remove-fd.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "monitor/monitor.h" - -void monitor_fdset_dup_fd_remove (int dupfd) -{ -}
stubs/fdset.c new file +22 -0
@@ -0,0 +1,22 @@ +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "monitor/monitor.h" + +int monitor_fdset_dup_fd_add (int64_t fdset_id,int dup_fd) +{ +return -1 ; +} + +int monitor_fdset_dup_fd_find (int dup_fd) +{ +return -1 ; +} + +int monitor_fdset_get_fd (int64_t fdset_id,int flags) +{ +return -1 ; +} + +void monitor_fdset_dup_fd_remove (int dupfd) +{ +}
Signature · 1 line
2.9.3
PATCH 8/11 stubs: move vhost stubs to stubs/vhost.o
In reply to Paolo BonziniNo need to include them in libqemustub.a, since only system emulators need them.
--- hw/Makefile.objs | 2 +- hw/virtio/Makefile.objs | 6 +++++- stubs/vhost.c => hw/virtio/vhost-stub.c | 0 stubs/Makefile.objs | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) rename stubs/vhost.c => hw/virtio/vhost-stub.c (100%)
hw/Makefile.objs +1 -1
@@ -29,7 +29,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += timer/ devices-dirs-$(CONFIG_TPM) += tpm/ devices-dirs-$(CONFIG_SOFTMMU) += usb/ devices-dirs-$(CONFIG_SOFTMMU) += vfio/ -devices-dirs-$(CONFIG_VIRTIO) += virtio/ +devices-dirs-$(CONFIG_SOFTMMU) += virtio/ devices-dirs-$(CONFIG_SOFTMMU) += watchdog/ devices-dirs-$(CONFIG_SOFTMMU) += xen/ devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
hw/virtio/Makefile.objs +5 -1
@@ -1,3 +1,4 @@ +ifeq ($(CONFIG_VIRTIO),y) common-obj-y += virtio-rng.o common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o common-obj-y += virtio-bus.o
@@ -5,7 +6,10 @@ common-obj-y += virtio-mmio.o obj-y += virtio.o virtio-balloon.o obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o - obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o obj-y += virtio-crypto.o obj-$(CONFIG_VIRTIO_PCI) += virtio-crypto-pci.o +endif + +common-obj-$(call lnot,$(CONFIG_LINUX)) += vhost-stub.o +common-obj-$(CONFIG_ALL) += vhost-stub.o
hw/virtio/vhost-stub.c renamed from stubs/vhost.c +0 -0
stubs/Makefile.objs +0 -1
@@ -35,7 +35,6 @@ stub-obj-y += kvm.o stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o -stub-obj-y += vhost.o stub-obj-y += iohandler.o stub-obj-y += pc_madt_cpu_entry.o stub-obj-y += migration-colo.o
Signature · 1 line
2.9.3
PATCH 9/11 event_notifier: cleanups around event_notifier_set_handler
In reply to Paolo BonziniEventNotifiers are already supported by AioContext, so reuse that in iohandler.c and remove the useless is_external argument. Since the iohandler AioContext is never used for block devices, aio_disable_external is never called on it. This lets us remove stubs/iohandler.c.
--- hw/usb/ccid-card-emulated.c | 2 +- hw/virtio/virtio.c | 10 +++++----- include/qemu/event_notifier.h | 3 --- include/qemu/main-loop.h | 15 +++++++++++++++ iohandler.c | 7 +++++++ stubs/Makefile.objs | 1 - stubs/iohandler.c | 8 -------- target/i386/hyperv.c | 7 ++++--- util/event_notifier-posix.c | 9 --------- util/event_notifier-win32.c | 12 ------------ 10 files changed, 32 insertions(+), 42 deletions(-) delete mode 100644 stubs/iohandler.c
hw/usb/ccid-card-emulated.c +1 -1
@@ -407,7 +407,7 @@ static int init_event_notifier(EmulatedState *card)DPRINTF (card,2 ,"event notifier creation failed\n" );return -1 ; } -event_notifier_set_handler (&card->notifier, false, card_event_handler); +event_notifier_set_handler (&card->notifier, card_event_handler);return 0 ; }
hw/virtio/virtio.c +5 -5
@@ -2174,10 +2174,10 @@ void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign, bool with_irqfd) {if (assign && !with_irqfd) { -event_notifier_set_handler (&vq->guest_notifier, false, +event_notifier_set_handler (&vq->guest_notifier, virtio_queue_guest_notifier_read); }else { -event_notifier_set_handler (&vq->guest_notifier, false,NULL ); +event_notifier_set_handler (&vq->guest_notifier,NULL ); }if (!assign) {/* Test and clear notifier before closing it,
@@ -2351,7 +2351,7 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev) err = r; goto assign_error; } -event_notifier_set_handler (&vq->host_notifier, true, +event_notifier_set_handler (&vq->host_notifier, virtio_queue_host_notifier_read); }
@@ -2372,7 +2372,7 @@ assign_error:continue ; } -event_notifier_set_handler (&vq->host_notifier, true,NULL ); +event_notifier_set_handler (&vq->host_notifier,NULL ); r =virtio_bus_set_host_notifier (qbus, n, false);assert (r >=0 ); }
@@ -2398,7 +2398,7 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)if (!virtio_queue_get_num (vdev, n)) {continue ; } -event_notifier_set_handler (&vq->host_notifier, true,NULL ); +event_notifier_set_handler (&vq->host_notifier,NULL ); r =virtio_bus_set_host_notifier (qbus, n, false);assert (r >=0 ); }
include/qemu/event_notifier.h +0 -3
@@ -34,9 +34,6 @@ int event_notifier_init(EventNotifier *, int active);void event_notifier_cleanup (EventNotifier *);int event_notifier_set (EventNotifier *);int event_notifier_test_and_clear (EventNotifier *); -int event_notifier_set_handler (EventNotifier *, -bool is_external, -EventNotifierHandler *);#ifdef CONFIG_POSIX void event_notifier_init_fd (EventNotifier *,int fd);
include/qemu/main-loop.h +15 -0
@@ -203,6 +203,21 @@ void qemu_set_fd_handler(int fd, IOHandler *fd_write, void *opaque); + +/** +* event_notifier_set_handler: Register an EventNotifier with the main loop +* +* This function tells the main loop to wake up whenever the +* #EventNotifier was set. +* +* @e: The #EventNotifier to be observed. +* +* @handler: A level-triggered callback that is fired when @e +* has been set. @e is passed to it as a parameter. +*/ +void event_notifier_set_handler (EventNotifier *e, +EventNotifierHandler *handler); +GSource *iohandler_get_g_source (void );AioContext *iohandler_get_aio_context (void );#ifdef CONFIG_POSIX
iohandler.c +7 -0
@@ -66,6 +66,13 @@ void qemu_set_fd_handler(int fd, fd_read, fd_write, opaque); } +void event_notifier_set_handler (EventNotifier *e, +EventNotifierHandler *handler) +{ +iohandler_init (); +aio_set_event_notifier (iohandler_get_aio_context (), e, false, handler); +} +/* reaping of zombies. right now we're not passing the status to anyone, but it would be possible to add a callback. */ #ifndef _WIN32
stubs/Makefile.objs +0 -1
@@ -35,6 +35,5 @@ stub-obj-y += kvm.o stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o -stub-obj-y += iohandler.o stub-obj-y += pc_madt_cpu_entry.o stub-obj-y += migration-colo.o
stubs/iohandler.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "qemu/main-loop.h" - -AioContext *iohandler_get_aio_context (void ) -{ -abort (); -}
target/i386/hyperv.c +4 -3
@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "hyperv.h" #include "standard-headers/asm-x86/hyperv.h"
@@ -88,7 +89,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, goto err_sint_set_notifier; } -event_notifier_set_handler (&sint_route->sint_ack_notifier, false, +event_notifier_set_handler (&sint_route->sint_ack_notifier, kvm_hv_sint_ack_handler); gsi =kvm_irqchip_add_hv_sint_route (kvm_state, vcpu_id, sint);
@@ -112,7 +113,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, err_irqfd:kvm_irqchip_release_virq (kvm_state, gsi); err_gsi: -event_notifier_set_handler (&sint_route->sint_ack_notifier, false,NULL ); +event_notifier_set_handler (&sint_route->sint_ack_notifier,NULL );event_notifier_cleanup (&sint_route->sint_ack_notifier); err_sint_set_notifier:event_notifier_cleanup (&sint_route->sint_set_notifier);
@@ -128,7 +129,7 @@ void kvm_hv_sint_route_destroy(HvSintRoute *sint_route) &sint_route->sint_set_notifier, sint_route->gsi);kvm_irqchip_release_virq (kvm_state, sint_route->gsi); -event_notifier_set_handler (&sint_route->sint_ack_notifier, false,NULL ); +event_notifier_set_handler (&sint_route->sint_ack_notifier,NULL );event_notifier_cleanup (&sint_route->sint_ack_notifier);event_notifier_cleanup (&sint_route->sint_set_notifier);g_free (sint_route);
util/event_notifier-posix.c +0 -9
@@ -90,15 +90,6 @@ int event_notifier_get_fd(const EventNotifier *e)return e->rfd; } -int event_notifier_set_handler (EventNotifier *e, -bool is_external, -EventNotifierHandler *handler) -{ -aio_set_fd_handler (iohandler_get_aio_context (), e->rfd, is_external, - (IOHandler *)handler,NULL , e); -return 0 ; -} -int event_notifier_set (EventNotifier *e) {static const uint64_t value =1 ;
util/event_notifier-win32.c +0 -12
@@ -32,18 +32,6 @@ HANDLE event_notifier_get_handle(EventNotifier *e)return e->event; } -int event_notifier_set_handler (EventNotifier *e, -bool is_external, -EventNotifierHandler *handler) -{ -if (handler) { -return qemu_add_wait_object (e->event, (IOHandler *)handler, e); - }else { -qemu_del_wait_object (e->event, (IOHandler *)handler, e); -return 0 ; - } -} -int event_notifier_set (EventNotifier *e) {SetEvent (e->event);
Signature · 1 line
2.9.3
PATCH 10/11 build: remove --enable-colo/--disable-colo
In reply to Paolo BonziniNo need to provide this knob, just enable COLO unconditionally. Remove the configure option as well as stubs/migration-colo.c.
--- configure | 11 ----------- migration/Makefile.objs | 3 +-- stubs/Makefile.objs | 1 - stubs/migration-colo.c | 46 ---------------------------------------------- 4 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 stubs/migration-colo.c
configure +0 -5
@@ -228,7 +228,6 @@ vhost_net="no" vhost_scsi="no" vhost_vsock="no" kvm="no" -colo="yes" rdma="" gprof="no" debug_tcg="no"
@@ -919,10 +918,6 @@ for opt do ;; --enable-kvm) kvm="yes" ;; - --disable-colo) colo="no" - ;; - --enable-colo) colo="yes" - ;; --disable-tcg-interpreter) tcg_interpreter="no" ;; --enable-tcg-interpreter) tcg_interpreter="yes"
configure +0 -6
@@ -1366,7 +1366,6 @@ disabled with --disable-FEATURE, default is enabled if available: fdt fdt device tree bluez bluez stack connectivity kvm KVM acceleration support - colo COarse-grain LOck-stepping VM for Non-stop Service rdma RDMA-based migration support vde support for vde network netmap support for netmap network
@@ -5043,7 +5042,6 @@ echo "Linux AIO support $linux_aio" echo "ATTR/XATTR support $attr" echo "Install blobs $blobs" echo "KVM support $kvm" -echo "COLO support $colo" echo "RDMA support $rdma" echo "TCG interpreter $tcg_interpreter" echo "fdt support $fdt"
@@ -5684,10 +5679,6 @@ if have_backend "syslog"; then fi echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak -if test "$colo" = "yes"; then - echo "CONFIG_COLO=y" >> $config_host_mak -fi - if test "$rdma" = "yes" ; then echo "CONFIG_RDMA=y" >> $config_host_mak fi
migration/Makefile.objs +1 -2
@@ -1,7 +1,6 @@ common-obj-y += migration.o socket.o fd.o exec.o common-obj-y += tls.o -common-obj-y += colo-comm.o -common-obj-$(CONFIG_COLO) += colo.o colo-failover.o +common-obj-y += colo-comm.o colo.o colo-failover.o common-obj-y += vmstate.o common-obj-y += qemu-file.o common-obj-y += qemu-file-channel.o
stubs/Makefile.objs +0 -1
@@ -36,4 +36,3 @@ stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o stub-obj-y += pc_madt_cpu_entry.o -stub-obj-y += migration-colo.o
stubs/migration-colo.c deleted +0 -46
46 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 11/11 stubs: remove stubs/kvm.c
In reply to Paolo BonziniThis has a single function, just move it to the other target/*/kvm.c files.
--- stubs/Makefile.objs | 1 - stubs/kvm.c | 8 -------- target/mips/kvm.c | 5 +++++ target/ppc/kvm.c | 5 +++++ target/s390x/kvm.c | 5 +++++ 5 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 stubs/kvm.c
stubs/Makefile.objs +0 -1
@@ -31,7 +31,6 @@ stub-obj-y += uuid.o stub-obj-y += vm-stop.o stub-obj-y += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.o -stub-obj-y += kvm.o stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o
stubs/kvm.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "sysemu/kvm.h" - -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) -{ -return 0 ; -}
target/mips/kvm.c +5 -0
@@ -55,6 +55,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)return 0 ; } +int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +{ +return 0 ; +} +int kvm_arch_init_vcpu (CPUState *cs) {MIPSCPU *cpu =MIPS_CPU (cs);
target/ppc/kvm.c +5 -0
@@ -145,6 +145,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)return 0 ; } +int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +{ +return 0 ; +} +static int kvm_arch_sync_sregs (PowerPCCPU *cpu) {CPUPPCState *cenv = &cpu->env;
target/s390x/kvm.c +5 -0
@@ -294,6 +294,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)return 0 ; } +int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +{ +return 0 ; +} +unsigned long kvm_arch_vcpu_id (CPUState *cpu) {return cpu->cpu_index;
Signature · 1 line
2.9.3
Quoted 4 lines · Paolo Bonzini
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for
pci-stub.corkvm-stub.c. libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.
So why is doing it this way round better? (I don't have a strong opinion here, but you don't really give a rationale for this change.)
thanks
-- PMM
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Paolo Bonzini
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for
pci-stub.corkvm-stub.c. libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.So why is doing it this way round better? (I don't have a strong opinion here, but you don't really give a rationale for this change.)
I don't really have a strong opinion here either, hence the RFC. However, one advantage is that it keeps things visible to the right maintainer.
Paolo
Quoted 9 lines · Paolo Bonzini
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Paolo Bonzini
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for
pci-stub.corkvm-stub.c. libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.
Quoted 6 lines
Quoted 2 lines
So why is doing it this way round better? (I don't have a strong opinion here, but you don't really give a rationale for this change.)
I don't really have a strong opinion here either, hence the RFC. However, one advantage is that it keeps things visible to the right maintainer.
Can't we just move the files to subdirectories where they are visible to the maintainers, but keep using stub-obj-y/libqemustub to build/link them?
I find libqemustub/stub-obj-y much easier to use than manually setting obj-$(call lnot ...).
Signature · 1 line
Eduardo
Quoted 17 lines · Eduardo Habkost
Quoted 9 lines · Paolo Bonzini
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Paolo Bonzini
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for
pci-stub.corkvm-stub.c. libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.Quoted 6 lines
Quoted 2 lines
So why is doing it this way round better? (I don't have a strong opinion here, but you don't really give a rationale for this change.)
I don't really have a strong opinion here either, hence the RFC. However, one advantage is that it keeps things visible to the right maintainer.
Quoted 6 lines
Can't we just move the files to subdirectories where they are visible to the maintainers, but keep using stub-obj-y/libqemustub to build/link them?
I find libqemustub/stub-obj-y much easier to use than manually setting obj-$(call lnot ...).
Yes, that would work too. It's a pity that we cannot just use weak symbols, as that would work fine with obj-y.
It would be a bit ugly to have to add "stub-obj-y += foo/" in the parent directory. But maybe we can replace that with a "subdir-y += foo/" and just do a single recursion for all variables. Fam, you did the current implementation of unnest-vars, what do you think? Would it also be simpler?
Paolo
Quoted 22 lines · Paolo Bonzini
Quoted 21 lines · Eduardo Habkost
Quoted 9 lines · Paolo Bonzini
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Paolo Bonzini
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for
pci-stub.corkvm-stub.c. libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.Quoted 6 lines
Quoted 2 lines
So why is doing it this way round better? (I don't have a strong opinion here, but you don't really give a rationale for this change.)
I don't really have a strong opinion here either, hence the RFC. However, one advantage is that it keeps things visible to the right maintainer.
Can't we just move the files to subdirectories where they are visible to the maintainers, but keep using stub-obj-y/libqemustub to build/link them?
Quoted 5 lines
Quoted 2 lines
I find libqemustub/stub-obj-y much easier to use than manually setting obj-$(call lnot ...).
Yes, that would work too. It's a pity that we cannot just use weak symbols, as that would work fine with obj-y.
Can you explain again why we can't use weak symbols?
[...]
----- Original Message -----
Quoted 33 lines
From: "Markus Armbruster" <[email protected]>
To: "Paolo Bonzini" <[email protected]>
Cc: "Eduardo Habkost" <[email protected]>, "Peter Maydell" <[email protected]>, "Fam Zheng" <[email protected]>, "QEMU Developers" <[email protected]>
Sent: Friday, December 23, 2016 10:02:33 AM
Subject: Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanupQuoted 24 lines · Paolo Bonzini
Quoted 23 lines · Eduardo Habkost
Quoted 11 lines · Paolo Bonzini
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Paolo Bonzini
This moves out of libqemustub.a those functions which can be handled simply by $(call lnot), like we already do for
pci-stub.corkvm-stub.c.
libqemustub.a keep the more complex cases where a small part of the executables we build needs an implementation of a small subset of an API.Quoted 6 lines
Quoted 2 lines
So why is doing it this way round better? (I don't have a strong opinion here, but you don't really give a rationale for this change.)
I don't really have a strong opinion here either, hence the RFC. However, one advantage is that it keeps things visible to the right maintainer.
Can't we just move the files to subdirectories where they are visible to the maintainers, but keep using stub-obj-y/libqemustub to build/link them?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I find libqemustub/stub-obj-y much easier to use than manually setting obj-$(call lnot ...).
Yes, that would work too. It's a pity that we cannot just use weak symbols, as that would work fine with obj-y.
Can you explain again why we can't use weak symbols?
Because Windows and OS X don't have full support for weak symbols. At least as I understand it, OS X only supports "weak import" of a symbol from a library, where if a symbol is missing _in the library_ it resolves to NULL in the program. It doesn't support replacing a weak definition of a function with a strong definition of the same, and that's why we use a static library.
Paolo