mbox series

[0/5] include: Trim some fat from osdep.h

Message ID 20220208200856.3558249-1-peter.maydell@linaro.org
Headers show
Series include: Trim some fat from osdep.h | expand

Message

Peter Maydell Feb. 8, 2022, 8:08 p.m. UTC
The osdep.h header is included by every C file we compile, so it helps
build times to keep it small. (As the comment at the top of the file
notes, in an ideal world this header would contain only things that
everybody needs and things where we need to apply a compatibility
workaround on some hosts.) This series trims more than 130 lines from
osdep.h (about 16% of its current size) by splitting some prototypes
that are used only in a few files out into new headers that are
included by those source files that need them.

(Looking at the size of osdep.h itself is not really the right metric,
because the real killer for compile time is going to be all the
system headers it pulls in; but it's easier to measure and looks
better for this series :-))

There's scope for more of this, I think, but there's no need to try to
do everything in one huge patchset.

thanks
-- PMM

Peter Maydell (5):
  include: Move qemu_madvise() and related #defines to new
    qemu/madvise.h
  include: Move qemu_mprotect_*() to new qemu/mprotect.h
  include: Move QEMU_MAP_* constants to mmap-alloc.h
  include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h
  include: Move hardware version declarations to new qemu/hw-version.h

 include/qemu/cacheinfo.h   |  21 ++++++
 include/qemu/hw-version.h  |  27 ++++++++
 include/qemu/madvise.h     |  95 ++++++++++++++++++++++++++
 include/qemu/mmap-alloc.h  |  23 +++++++
 include/qemu/mprotect.h    |  14 ++++
 include/qemu/osdep.h       | 132 -------------------------------------
 accel/tcg/translate-all.c  |   1 +
 backends/hostmem-file.c    |   1 +
 backends/hostmem.c         |   1 +
 hw/arm/nseries.c           |   1 +
 hw/ide/core.c              |   1 +
 hw/scsi/megasas.c          |   1 +
 hw/scsi/scsi-bus.c         |   1 +
 hw/scsi/scsi-disk.c        |   1 +
 hw/virtio/virtio-balloon.c |   1 +
 migration/postcopy-ram.c   |   1 +
 migration/qemu-file.c      |   1 +
 migration/ram.c            |   1 +
 plugins/loader.c           |   1 +
 softmmu/physmem.c          |   1 +
 softmmu/vl.c               |   1 +
 target/i386/cpu.c          |   1 +
 target/s390x/cpu_models.c  |   1 +
 tcg/region.c               |   3 +
 tcg/tcg.c                  |   1 +
 util/atomic64.c            |   1 +
 util/cacheflush.c          |   1 +
 util/cacheinfo.c           |   1 +
 util/osdep.c               |   3 +
 util/oslib-posix.c         |   1 +
 30 files changed, 208 insertions(+), 132 deletions(-)
 create mode 100644 include/qemu/cacheinfo.h
 create mode 100644 include/qemu/hw-version.h
 create mode 100644 include/qemu/madvise.h
 create mode 100644 include/qemu/mprotect.h

Comments

Philippe Mathieu-Daudé Feb. 9, 2022, 9:21 a.m. UTC | #1
On 8/2/22 21:08, Peter Maydell wrote:
> The osdep.h header is included by every C file we compile, so it helps
> build times to keep it small. (As the comment at the top of the file
> notes, in an ideal world this header would contain only things that
> everybody needs and things where we need to apply a compatibility
> workaround on some hosts.) This series trims more than 130 lines from
> osdep.h (about 16% of its current size) by splitting some prototypes
> that are used only in a few files out into new headers that are
> included by those source files that need them.
> 
> (Looking at the size of osdep.h itself is not really the right metric,
> because the real killer for compile time is going to be all the
> system headers it pulls in; but it's easier to measure and looks
> better for this series :-))
> 
> There's scope for more of this, I think, but there's no need to try to
> do everything in one huge patchset.
> 
> thanks
> -- PMM
> 
> Peter Maydell (5):
>    include: Move qemu_madvise() and related #defines to new
>      qemu/madvise.h
>    include: Move qemu_mprotect_*() to new qemu/mprotect.h
>    include: Move QEMU_MAP_* constants to mmap-alloc.h
>    include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h
>    include: Move hardware version declarations to new qemu/hw-version.h

TIL qemu_hw_version().

Series:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Peter Maydell Feb. 18, 2022, 12:18 p.m. UTC | #2
On Tue, 8 Feb 2022 at 20:08, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> The osdep.h header is included by every C file we compile, so it helps
> build times to keep it small. (As the comment at the top of the file
> notes, in an ideal world this header would contain only things that
> everybody needs and things where we need to apply a compatibility
> workaround on some hosts.) This series trims more than 130 lines from
> osdep.h (about 16% of its current size) by splitting some prototypes
> that are used only in a few files out into new headers that are
> included by those source files that need them.



Applied to target-arm.next, thanks.

-- PMM