qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

Include generated QAPI headers less

Some of the generated qapi-types-MODULE.h are included all over the
place. Changing a QAPI type can trigger massive recompiling. Top
scorers recompile more than 1000 out of some 6600 objects (not
counting tests and objects that don't depend on qemu/osdep.h):

6300 qapi/qapi-builtin-types.h
5700 qapi/qapi-types-run-state.h
3900 qapi/qapi-types-common.h
3300 qapi/qapi-types-sockets.h
3000 qapi/qapi-types-misc.h
3000 qapi/qapi-types-crypto.h
3000 qapi/qapi-types-job.h
3000 qapi/qapi-types-block-core.h
2800 qapi/qapi-types-block.h
1300 qapi/qapi-types-net.h

Clean up headers to include generated QAPI headers only where needed.
Impact is negligible except for hw/qdev-properties.h.

This header includes qapi/qapi-types-block.h and
qapi/qapi-types-misc.h. They are used only in expansions of property
definition macros such as DEFINE_PROP_BLOCKDEV_ON_ERROR() and
DEFINE_PROP_OFF_AUTO(). Moving their inclusion from
hw/qdev-properties.h to the users of these macros avoids pointless
recompiles. This is how other property definition macros, such as
DEFINE_PROP_NETDEV(), already work.

Improves things for some of the top scorers:

3600 qapi/qapi-types-common.h
2800 qapi/qapi-types-sockets.h
900 qapi/qapi-types-misc.h
2200 qapi/qapi-types-crypto.h
2100 qapi/qapi-types-job.h
2100 qapi/qapi-types-block-core.h
270 qapi/qapi-types-block.h

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190812052359.30071-3-armbru@redhat.com>

+10 -12
+2
hw/core/qdev-properties.c
··· 3 3 #include "hw/qdev.h" 4 4 #include "qapi/error.h" 5 5 #include "hw/pci/pci.h" 6 + #include "qapi/qapi-types-block.h" 7 + #include "qapi/qapi-types-misc.h" 6 8 #include "qapi/qmp/qerror.h" 7 9 #include "qemu/ctype.h" 8 10 #include "qemu/error-report.h"
+1
hw/i386/kvm/i8254.c
··· 25 25 26 26 #include "qemu/osdep.h" 27 27 #include <linux/kvm.h> 28 + #include "qapi/qapi-types-misc.h" 28 29 #include "qapi/error.h" 29 30 #include "qemu/module.h" 30 31 #include "qemu/timer.h"
+1
hw/ide/qdev.c
··· 21 21 #include "hw/hw.h" 22 22 #include "sysemu/dma.h" 23 23 #include "qapi/error.h" 24 + #include "qapi/qapi-types-block.h" 24 25 #include "qemu/error-report.h" 25 26 #include "qemu/module.h" 26 27 #include "hw/ide/internal.h"
-1
include/authz/listfile.h
··· 22 22 #define QAUTHZ_LISTFILE_H 23 23 24 24 #include "authz/list.h" 25 - #include "qapi/qapi-types-authz.h" 26 25 #include "qemu/filemonitor.h" 27 26 28 27 #define TYPE_QAUTHZ_LIST_FILE "authz-list-file"
-1
include/block/block.h
··· 2 2 #define BLOCK_H 3 3 4 4 #include "block/aio.h" 5 - #include "qapi/qapi-types-block-core.h" 6 5 #include "block/aio-wait.h" 7 6 #include "qemu/iov.h" 8 7 #include "qemu/coroutine.h"
+1
include/hw/acpi/acpi_dev_interface.h
··· 1 1 #ifndef ACPI_DEV_INTERFACE_H 2 2 #define ACPI_DEV_INTERFACE_H 3 3 4 + #include "qapi/qapi-types-misc.h" 4 5 #include "qom/object.h" 5 6 #include "hw/boards.h" 6 7
+1
include/hw/mem/memory-device.h
··· 13 13 #ifndef MEMORY_DEVICE_H 14 14 #define MEMORY_DEVICE_H 15 15 16 + #include "qapi/qapi-types-misc.h" 16 17 #include "qom/object.h" 17 18 #include "hw/qdev.h" 18 19
-1
include/hw/ppc/spapr_drc.h
··· 14 14 #define HW_SPAPR_DRC_H 15 15 16 16 #include <libfdt.h> 17 - #include "qapi/qapi-types-run-state.h" 18 17 #include "qom/object.h" 19 18 #include "sysemu/sysemu.h" 20 19 #include "hw/qdev.h"
-2
include/hw/qdev-properties.h
··· 1 1 #ifndef QEMU_QDEV_PROPERTIES_H 2 2 #define QEMU_QDEV_PROPERTIES_H 3 3 4 - #include "qapi/qapi-types-block.h" 5 - #include "qapi/qapi-types-misc.h" 6 4 #include "hw/qdev-core.h" 7 5 8 6 /*** qdev-properties.c ***/
+1
include/hw/virtio/virtio-pmem.h
··· 15 15 #define HW_VIRTIO_PMEM_H 16 16 17 17 #include "hw/virtio/virtio.h" 18 + #include "qapi/qapi-types-misc.h" 18 19 #include "sysemu/hostmem.h" 19 20 20 21 #define TYPE_VIRTIO_PMEM "virtio-pmem"
-1
include/migration/global_state.h
··· 13 13 #ifndef QEMU_MIGRATION_GLOBAL_STATE_H 14 14 #define QEMU_MIGRATION_GLOBAL_STATE_H 15 15 16 - #include "qapi/qapi-types-run-state.h" 17 16 #include "sysemu/sysemu.h" 18 17 19 18 void register_global_state(void);
+1 -1
include/qemu/job.h
··· 26 26 #ifndef JOB_H 27 27 #define JOB_H 28 28 29 - #include "qapi/qapi-types-block-core.h" 29 + #include "qapi/qapi-types-job.h" 30 30 #include "qemu/queue.h" 31 31 #include "qemu/coroutine.h" 32 32 #include "block/aio.h"
-1
include/sysemu/arch_init.h
··· 1 1 #ifndef QEMU_ARCH_INIT_H 2 2 #define QEMU_ARCH_INIT_H 3 3 4 - #include "qapi/qapi-types-misc.h" 5 4 6 5 enum { 7 6 QEMU_ARCH_ALL = -1,
-1
include/ui/egl-helpers.h
··· 4 4 #include <epoxy/gl.h> 5 5 #include <epoxy/egl.h> 6 6 #include <gbm.h> 7 - #include "qapi/qapi-types-ui.h" 8 7 #include "ui/console.h" 9 8 #include "ui/shader.h" 10 9
-1
monitor/monitor-internal.h
··· 27 27 28 28 #include "chardev/char-fe.h" 29 29 #include "monitor/monitor.h" 30 - #include "qapi/qapi-types-misc.h" 31 30 #include "qapi/qmp/dispatch.h" 32 31 #include "qapi/qmp/json-parser.h" 33 32 #include "qemu/readline.h"
+1
target/i386/monitor.c
··· 33 33 #include "sysemu/sev.h" 34 34 #include "qapi/error.h" 35 35 #include "sev_i386.h" 36 + #include "qapi/qapi-commands-misc-target.h" 36 37 #include "qapi/qapi-commands-misc.h" 37 38 38 39 /* Perform linear address sign extension */
+1 -1
target/i386/sev_i386.h
··· 19 19 #include "sysemu/kvm.h" 20 20 #include "sysemu/sev.h" 21 21 #include "qemu/error-report.h" 22 - #include "qapi/qapi-commands-misc-target.h" 22 + #include "qapi/qapi-types-misc-target.h" 23 23 24 24 #define SEV_POLICY_NODBG 0x1 25 25 #define SEV_POLICY_NOKS 0x2
-1
ui/vnc.h
··· 27 27 #ifndef QEMU_VNC_H 28 28 #define QEMU_VNC_H 29 29 30 - #include "qapi/qapi-types-ui.h" 31 30 #include "qemu/queue.h" 32 31 #include "qemu/thread.h" 33 32 #include "ui/console.h"