From 2ae16a6aa4ce688e2ee25dec3ad2f023bece0b14 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 12 Aug 2019 07:23:32 +0200 Subject: Include generated QAPI headers less MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190812052359.30071-3-armbru@redhat.com> --- monitor/monitor-internal.h | 1 - 1 file changed, 1 deletion(-) (limited to 'monitor') diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 7760b22ba3..d78f5ca190 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -27,7 +27,6 @@ #include "chardev/char-fe.h" #include "monitor/monitor.h" -#include "qapi/qapi-types-misc.h" #include "qapi/qmp/dispatch.h" #include "qapi/qmp/json-parser.h" #include "qemu/readline.h" -- cgit v1.2.3 From 650d103d3ea959212f826acb9d3fe80cf30e347b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 12 Aug 2019 07:23:48 +0200 Subject: Include hw/hw.h exactly where needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In my "build everything" tree, changing hw/hw.h triggers a recompile of some 2600 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h). The previous commits have left only the declaration of hw_error() in hw/hw.h. This permits dropping most of its inclusions. Touching it now recompiles less than 200 objects. Signed-off-by: Markus Armbruster Reviewed-by: Alistair Francis Message-Id: <20190812052359.30071-19-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- monitor/misc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'monitor') diff --git a/monitor/misc.c b/monitor/misc.c index 00338c002a..117a172928 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "monitor-internal.h" #include "cpu.h" -#include "hw/hw.h" #include "monitor/qdev.h" #include "hw/usb.h" #include "hw/pci/pci.h" -- cgit v1.2.3 From 12e9493df9242a2051701e7eb64175d4e904acba Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 12 Aug 2019 07:23:52 +0200 Subject: Include hw/boards.h a bit less MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hw/boards.h pulls in almost 60 headers. The less we include it into headers, the better. As a first step, drop superfluous inclusions, and downgrade some more to what's actually needed. Gets rid of just one inclusion into a header. Cc: Eduardo Habkost Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Alistair Francis Message-Id: <20190812052359.30071-23-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Eduardo Habkost --- monitor/qmp-cmds.c | 1 - 1 file changed, 1 deletion(-) (limited to 'monitor') diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index b9ae40eec7..330558f332 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -35,7 +35,6 @@ #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qerror.h" -#include "hw/boards.h" #include "hw/mem/memory-device.h" #include "hw/acpi/acpi_dev_interface.h" -- cgit v1.2.3 From d5938f29fea29581725426f203a74da746ca03e7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 12 Aug 2019 07:23:56 +0200 Subject: Clean up inclusion of sysemu/sysemu.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). Almost a third of its inclusions are actually superfluous. Delete them. Downgrade two more to qapi/qapi-types-run-state.h, and move one from char/serial.h to char/serial.c. hw/semihosting/config.c, monitor/monitor.c, qdev-monitor.c, and stubs/semihost.c define variables declared in sysemu/sysemu.h without including it. The compiler is cool with that, but include it anyway. This doesn't reduce actual use much, as it's still included into widely included headers. The next commit will tackle that. Signed-off-by: Markus Armbruster Reviewed-by: Alistair Francis Message-Id: <20190812052359.30071-27-armbru@redhat.com> Reviewed-by: Alex Bennée --- monitor/monitor.c | 1 + 1 file changed, 1 insertion(+) (limited to 'monitor') diff --git a/monitor/monitor.c b/monitor/monitor.c index 3ef28171c0..12898b6448 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -31,6 +31,7 @@ #include "qemu/error-report.h" #include "qemu/option.h" #include "sysemu/qtest.h" +#include "sysemu/sysemu.h" #include "trace.h" /* -- cgit v1.2.3 From 54d31236b906c8f03eb011717de7bc47000720c3 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 12 Aug 2019 07:23:59 +0200 Subject: sysemu: Split sysemu/runstate.h off sysemu/sysemu.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sysemu/sysemu.h is a rather unfocused dumping ground for stuff related to the system-emulator. Evidence: * It's included widely: in my "build everything" tree, changing sysemu/sysemu.h still triggers a recompile of some 1100 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h, down from 5400 due to the previous two commits). * It pulls in more than a dozen additional headers. Split stuff related to run state management into its own header sysemu/runstate.h. Touching sysemu/sysemu.h now recompiles some 850 objects. qemu/uuid.h also drops from 1100 to 850, and qapi/qapi-types-run-state.h from 4400 to 4200. Touching new sysemu/runstate.h recompiles some 500 objects. Since I'm touching MAINTAINERS to add sysemu/runstate.h anyway, also add qemu/main-loop.h. Suggested-by: Paolo Bonzini Signed-off-by: Markus Armbruster Message-Id: <20190812052359.30071-30-armbru@redhat.com> Reviewed-by: Alex Bennée [Unbreak OS-X build] --- monitor/hmp-cmds.c | 2 +- monitor/hmp.c | 2 +- monitor/misc.c | 1 + monitor/qmp-cmds.c | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) (limited to 'monitor') diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 5ca3ebe942..5ed82387ea 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -19,7 +19,7 @@ #include "net/eth.h" #include "chardev/char.h" #include "sysemu/block-backend.h" -#include "sysemu/sysemu.h" +#include "sysemu/runstate.h" #include "qemu/config-file.h" #include "qemu/option.h" #include "qemu/timer.h" diff --git a/monitor/hmp.c b/monitor/hmp.c index 5223661e82..8942e28933 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -35,7 +35,7 @@ #include "qemu/option.h" #include "qemu/units.h" #include "sysemu/block-backend.h" -#include "sysemu/sysemu.h" +#include "sysemu/runstate.h" #include "trace.h" static void monitor_command_cb(void *opaque, const char *cmdline, diff --git a/monitor/misc.c b/monitor/misc.c index 117a172928..d229e65450 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -44,6 +44,7 @@ #include "sysemu/balloon.h" #include "qemu/timer.h" #include "sysemu/hw_accel.h" +#include "sysemu/runstate.h" #include "authz/list.h" #include "qapi/util.h" #include "sysemu/blockdev.h" diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 330558f332..0880341a2d 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -26,6 +26,7 @@ #include "ui/qemu-spice.h" #include "ui/vnc.h" #include "sysemu/kvm.h" +#include "sysemu/runstate.h" #include "sysemu/arch_init.h" #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" -- cgit v1.2.3