On 3/5/20 2:42 PM, Daniel P. Berrangé wrote:
On Thu, Mar 05, 2020 at 01:45:16PM +0100, Philippe Mathieu-Daudé wrote:
Since v1:
- merged 2 series
- reworked hw/usb/quirks
- added R-b/A-b tags
This series reduce the footprint of the QEMU binary:
.bss: 106KiB (moved to .heap)
Did this actually have an impact on the binary size, or just on the
size the elf-dissector reports ? I'm not very familiar with ELF,
but Wikipedia's description of BSS makes me question it...
"Typically only the length of the bss section, but no data,
is stored in the object file. The program loader allocates
memory for the bss section when it loads the program. On
some platforms, some or all of the bss section is initialized
to zeroes. Unix-like systems and Windows initialize the bss
section to zero"
This suggests .bss has no on-disk overhead, only runtime overhead,
which is presumably going to be the same with heap allocations.
IIUC when stored in the .bss, the buffer are always allocated in memory,
even if not used. By moving them to the .heap, we only allocate them
when using either the adlib audio device or curses.
.data: 1MiB
.rodata: 4.34MiB
These looks useful though in terms of disk footprint.
Memory footprint is more important than disk footprint, but harder to
track/manage.
(sizes on x86_64 building with -Os)
The elf-dissector tool [1] [2] helped to notice the big array.
[1] https://phabricator.kde.org/source/elf-dissector/
[2] https://www.volkerkrause.eu/2019/06/22/elf-dissector-aarch64-support.html
[heap equivalent tool working with QEMU: https://github.com/KDE/heaptrack]
Supersedes: <20200304221807.25212-1-phi...@redhat.com>
Supersedes: <20200305010446.17029-1-phi...@redhat.com>
Philippe Mathieu-Daudé (9):
hw/audio/fmopl: Fix a typo twice
hw/audio/fmopl: Move ENV_CURVE to .heap to save 32KiB of .bss
hw/audio/intel-hda: Use memory region alias to reduce .rodata by
4.34MB
hw/net/e1000: Add readops/writeops typedefs
hw/net/e1000: Move macreg[] arrays to .rodata to save 1MiB of .data
hw/usb/quirks: Use smaller types to reduce .rodata by 10KiB
ui/curses: Make control_characters[] array const
ui/curses: Move arrays to .heap to save 74KiB of .bss
virtfs-proxy-helper: Make the helper_opts[] array const
hw/usb/quirks.h | 22 +++++++++++++---------
fsdev/virtfs-proxy-helper.c | 2 +-
hw/audio/fmopl.c | 8 +++++---
hw/audio/intel-hda.c | 24 ++++++++++--------------
hw/net/e1000.c | 6 ++++--
hw/net/e1000e_core.c | 6 ++++--
hw/usb/quirks.c | 4 ++--
ui/curses.c | 10 +++++++---
8 files changed, 46 insertions(+), 36 deletions(-)
--
2.21.1
Regards,
Daniel