Skip to content

Commit

Permalink
Include sysemu/sysemu.h a lot less
Browse files Browse the repository at this point in the history
In my "build everything" tree, changing sysemu/sysemu.h triggers a
recompile of some 5400 out of 6600 objects (not counting tests and
objects that don't depend on qemu/osdep.h).

hw/qdev-core.h includes sysemu/sysemu.h since recent commit e965ffa
"qdev: add qdev_add_vm_change_state_handler()".  This is a bad idea:
hw/qdev-core.h is widely included.

Move the declaration of qdev_add_vm_change_state_handler() to
sysemu/sysemu.h, and drop the problematic include from hw/qdev-core.h.

Touching sysemu/sysemu.h now recompiles some 1800 objects.
qemu/uuid.h also drops from 5400 to 1800.  A few more headers show
smaller improvement: qemu/notify.h drops from 5600 to 5200,
qemu/timer.h from 5600 to 4500, and qapi/qapi-types-run-state.h from
5500 to 5000.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190812052359.30071-28-armbru@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
  • Loading branch information
Markus Armbruster committed Aug 16, 2019
1 parent d5938f2 commit 46517dd
Show file tree
Hide file tree
Showing 31 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions accel/kvm/kvm-all.c
Expand Up @@ -29,6 +29,7 @@
#include "exec/gdbstub.h"
#include "sysemu/kvm_int.h"
#include "sysemu/cpus.h"
#include "sysemu/sysemu.h"
#include "qemu/bswap.h"
#include "exec/memory.h"
#include "exec/ram_addr.h"
Expand Down
1 change: 1 addition & 0 deletions backends/hostmem.c
Expand Up @@ -12,6 +12,7 @@

#include "qemu/osdep.h"
#include "sysemu/hostmem.h"
#include "sysemu/sysemu.h"
#include "hw/boards.h"
#include "qapi/error.h"
#include "qapi/qapi-builtin-visit.h"
Expand Down
1 change: 1 addition & 0 deletions cpus.c
Expand Up @@ -41,6 +41,7 @@
#include "sysemu/kvm.h"
#include "sysemu/hax.h"
#include "sysemu/hvf.h"
#include "sysemu/sysemu.h"
#include "sysemu/whpx.h"
#include "exec/exec-all.h"

Expand Down
1 change: 1 addition & 0 deletions hw/arm/allwinner-a10.c
Expand Up @@ -23,6 +23,7 @@
#include "hw/sysbus.h"
#include "hw/arm/allwinner-a10.h"
#include "hw/misc/unimp.h"
#include "sysemu/sysemu.h"

static void aw_a10_init(Object *obj)
{
Expand Down
1 change: 1 addition & 0 deletions hw/arm/aspeed_soc.c
Expand Up @@ -22,6 +22,7 @@
#include "qemu/error-report.h"
#include "hw/i2c/aspeed_i2c.h"
#include "net/net.h"
#include "sysemu/sysemu.h"

#define ASPEED_SOC_IOMEM_SIZE 0x00200000

Expand Down
1 change: 1 addition & 0 deletions hw/arm/kzm.c
Expand Up @@ -24,6 +24,7 @@
#include "hw/net/lan9118.h"
#include "hw/char/serial.h"
#include "sysemu/qtest.h"
#include "sysemu/sysemu.h"

/* Memory map for Kzm Emulation Baseboard:
* 0x00000000-0x7fffffff See i.MX31 SOC for support
Expand Down
1 change: 1 addition & 0 deletions hw/arm/msf2-soc.c
Expand Up @@ -30,6 +30,7 @@
#include "hw/irq.h"
#include "hw/arm/msf2-soc.h"
#include "hw/misc/unimp.h"
#include "sysemu/sysemu.h"

#define MSF2_TIMER_BASE 0x40004000
#define MSF2_SYSREG_BASE 0x40038000
Expand Down
1 change: 1 addition & 0 deletions hw/arm/stm32f205_soc.c
Expand Up @@ -29,6 +29,7 @@
#include "exec/address-spaces.h"
#include "hw/arm/stm32f205_soc.h"
#include "hw/qdev-properties.h"
#include "sysemu/sysemu.h"

/* At the moment only Timer 2 to 5 are modelled */
static const uint32_t timer_addr[STM_NUM_TIMERS] = { 0x40000000, 0x40000400,
Expand Down
1 change: 1 addition & 0 deletions hw/char/serial-isa.c
Expand Up @@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "sysemu/sysemu.h"
#include "hw/char/serial.h"
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
Expand Down
1 change: 1 addition & 0 deletions hw/char/xen_console.c
Expand Up @@ -24,6 +24,7 @@
#include <termios.h>

#include "qapi/error.h"
#include "sysemu/sysemu.h"
#include "chardev/char-fe.h"
#include "hw/xen/xen-legacy-backend.h"

Expand Down
1 change: 1 addition & 0 deletions hw/core/numa.c
Expand Up @@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "sysemu/hostmem.h"
#include "sysemu/numa.h"
#include "sysemu/sysemu.h"
#include "exec/cpu-common.h"
#include "exec/ramlist.h"
#include "qemu/bitmap.h"
Expand Down
1 change: 1 addition & 0 deletions hw/core/vm-change-state-handler.c
Expand Up @@ -17,6 +17,7 @@

#include "qemu/osdep.h"
#include "hw/qdev-core.h"
#include "sysemu/sysemu.h"

static int qdev_get_dev_tree_depth(DeviceState *dev)
{
Expand Down
1 change: 1 addition & 0 deletions hw/display/qxl-render.c
Expand Up @@ -21,6 +21,7 @@

#include "qemu/osdep.h"
#include "qxl.h"
#include "sysemu/sysemu.h"
#include "trace.h"

static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
Expand Down
1 change: 1 addition & 0 deletions hw/i386/xen/xen-hvm.c
Expand Up @@ -25,6 +25,7 @@
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "qemu/range.h"
#include "sysemu/sysemu.h"
#include "sysemu/xen-mapcache.h"
#include "trace.h"
#include "exec/address-spaces.h"
Expand Down
1 change: 1 addition & 0 deletions hw/i386/xen/xen-mapcache.c
Expand Up @@ -17,6 +17,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "qemu/bitmap.h"

#include "sysemu/sysemu.h"
#include "sysemu/xen-mapcache.h"
#include "trace.h"

Expand Down
1 change: 1 addition & 0 deletions hw/intc/ioapic.c
Expand Up @@ -30,6 +30,7 @@
#include "hw/pci/msi.h"
#include "hw/qdev-properties.h"
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
#include "hw/i386/apic-msidef.h"
#include "hw/i386/x86-iommu.h"
#include "trace.h"
Expand Down
1 change: 1 addition & 0 deletions hw/pci/pci.c
Expand Up @@ -35,6 +35,7 @@
#include "monitor/monitor.h"
#include "net/net.h"
#include "sysemu/numa.h"
#include "sysemu/sysemu.h"
#include "hw/loader.h"
#include "qemu/error-report.h"
#include "qemu/range.h"
Expand Down
1 change: 1 addition & 0 deletions hw/riscv/sifive_e.c
Expand Up @@ -46,6 +46,7 @@
#include "hw/riscv/boot.h"
#include "chardev/char.h"
#include "sysemu/arch_init.h"
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"

static const struct MemmapEntry {
Expand Down
1 change: 1 addition & 0 deletions hw/riscv/sifive_u.c
Expand Up @@ -44,6 +44,7 @@
#include "chardev/char.h"
#include "sysemu/arch_init.h"
#include "sysemu/device_tree.h"
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"

#include <libfdt.h>
Expand Down
1 change: 1 addition & 0 deletions hw/riscv/spike.c
Expand Up @@ -40,6 +40,7 @@
#include "sysemu/arch_init.h"
#include "sysemu/device_tree.h"
#include "sysemu/qtest.h"
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"

#include <libfdt.h>
Expand Down
1 change: 1 addition & 0 deletions hw/riscv/virt.c
Expand Up @@ -37,6 +37,7 @@
#include "chardev/char.h"
#include "sysemu/arch_init.h"
#include "sysemu/device_tree.h"
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include "hw/pci/pci.h"
#include "hw/pci-host/gpex.h"
Expand Down
2 changes: 1 addition & 1 deletion hw/sparc64/niagara.c
Expand Up @@ -35,7 +35,7 @@
#include "sysemu/block-backend.h"
#include "qemu/error-report.h"
#include "sysemu/qtest.h"

#include "sysemu/sysemu.h"

typedef struct NiagaraBoardState {
MemoryRegion hv_ram;
Expand Down
1 change: 1 addition & 0 deletions hw/usb/hcd-ehci.h
Expand Up @@ -21,6 +21,7 @@
#include "qemu/timer.h"
#include "hw/usb.h"
#include "sysemu/dma.h"
#include "sysemu/sysemu.h"
#include "hw/pci/pci.h"
#include "hw/sysbus.h"

Expand Down
1 change: 1 addition & 0 deletions hw/xen/xen-common.c
Expand Up @@ -14,6 +14,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "chardev/char.h"
#include "sysemu/accel.h"
#include "sysemu/sysemu.h"
#include "migration/misc.h"
#include "migration/global_state.h"

Expand Down
1 change: 1 addition & 0 deletions hw/xen/xen_devconfig.c
Expand Up @@ -2,6 +2,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "qemu/option.h"
#include "sysemu/blockdev.h"
#include "sysemu/sysemu.h"

/* ------------------------------------------------------------- */

Expand Down
1 change: 1 addition & 0 deletions hw/xenpv/xen_machine_pv.c
Expand Up @@ -28,6 +28,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "hw/xen/xen-bus.h"
#include "sysemu/block-backend.h"
#include "sysemu/sysemu.h"

static void xen_init_pv(MachineState *machine)
{
Expand Down
5 changes: 0 additions & 5 deletions include/hw/qdev-core.h
Expand Up @@ -5,7 +5,6 @@
#include "qemu/bitmap.h"
#include "qom/object.h"
#include "hw/hotplug.h"
#include "sysemu/sysemu.h"

enum {
DEV_NVECTORS_UNSPECIFIED = -1,
Expand Down Expand Up @@ -451,8 +450,4 @@ static inline bool qbus_is_hotpluggable(BusState *bus)
void device_listener_register(DeviceListener *listener);
void device_listener_unregister(DeviceListener *listener);

VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
VMChangeStateHandler *cb,
void *opaque);

#endif
3 changes: 3 additions & 0 deletions include/sysemu/sysemu.h
Expand Up @@ -29,6 +29,9 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
void *opaque);
VMChangeStateEntry *qemu_add_vm_change_state_handler_prio(
VMChangeStateHandler *cb, void *opaque, int priority);
VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
VMChangeStateHandler *cb,
void *opaque);
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
void vm_state_notify(int running, RunState state);

Expand Down
1 change: 1 addition & 0 deletions migration/global_state.c
Expand Up @@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
#include "qapi/error.h"
#include "migration.h"
#include "migration/global_state.h"
Expand Down
1 change: 1 addition & 0 deletions migration/migration.c
Expand Up @@ -21,6 +21,7 @@
#include "exec.h"
#include "fd.h"
#include "socket.h"
#include "sysemu/sysemu.h"
#include "rdma.h"
#include "ram.h"
#include "migration/global_state.h"
Expand Down
1 change: 1 addition & 0 deletions migration/savevm.c
Expand Up @@ -57,6 +57,7 @@
#include "io/channel-buffer.h"
#include "io/channel-file.h"
#include "sysemu/replay.h"
#include "sysemu/sysemu.h"
#include "qjson.h"
#include "migration/colo.h"
#include "qemu/bitmap.h"
Expand Down

0 comments on commit 46517dd

Please sign in to comment.