All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/3] pc: mmap kernel (ELF image) and initrd
@ 2019-07-24 11:25 Stefano Garzarella
  2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 1/3] loader: Handle memory-mapped ELFs Stefano Garzarella
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stefano Garzarella @ 2019-07-24 11:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin,
	Julio Montes, Dr . David Alan Gilbert, Paolo Bonzini,
	Richard Henderson

In order to reduce the memory footprint when PVH kernel and initrd
are used, we map them into memory instead of reading them.
In this way we can share them between multiple instances of QEMU.

v3:
- Added patch 1 to handle memory-mapped ELFs in rom_add_elf_program() [Paolo]
- Patch 2:
  ~ passed the GMappedFile* to rom_add_elf_program() [Paolo]
  ~ renamed 'GMappedFile *gmf' in 'GMappedFile *mapped_filed' for readability
  ~ set 'data' pointer only if 'file_size > 0' as the original behaviour
    [check-qtest-ppc64 fails without it]
- Patch 3:
  ~ stored the initrd GMappedFile* in PCMachineState to avoid Coverity
    issue [Paolo]
  ~ renamed 'GMappedFile *gmf' in 'GMappedFile *mapped_filed' for readability

v2: https://patchew.org/QEMU/20190723140445.12748-1-sgarzare@redhat.com/

These are the results using a PVH kernel and initrd (cpio):
- memory footprint (using smem) [MB]
        QEMU              before                   now
    # instances        USS      PSS            USS      PSS
         1           102.0M   105.8M         102.3M   106.2M
         2            94.6M   101.2M          72.3M    90.1M
         4            94.1M    98.0M          72.0M    81.5M
         8            94.0M    96.2M          71.8M    76.9M
        16            93.9M    95.1M          71.6M    74.3M

    Initrd size: 3.0M
    Kernel
        image size: 28M
        sections size [size -A -d vmlinux]:  18.9M

- boot time [ms]
                          before                   now
 qemu_init_end:           63.85                   55.91
 linux_start_kernel:      82.11 (+18.26)          74.51 (+18.60)
 linux_start_user:       169.94 (+87.83)         159.06 (+84.56)

QEMU command used:
./qemu-system-x86_64 -bios /path/to/seabios/out/bios.bin -no-hpet \
    -machine q35,accel=kvm,kernel_irqchip,nvdimm,sata=off,smbus=off,vmport=off \
    -cpu host -m 1G -smp 1 -vga none -display none -no-user-config -nodefaults \
    -kernel /path/to/vmlinux -initrd /path/to/rootfs.cpio \
    -append 'root=/dev/mem0 ro console=hvc0 pci=lastbus=0 nosmap'

Stefano Garzarella (3):
  loader: Handle memory-mapped ELFs
  elf-ops.h: Map into memory the ELF to load
  hw/i386/pc: Map into memory the initrd

 hw/core/loader.c     | 37 +++++++++++++++++++-----
 hw/i386/pc.c         | 17 ++++++++---
 include/hw/elf_ops.h | 68 ++++++++++++++++++++++++++------------------
 include/hw/i386/pc.h |  1 +
 include/hw/loader.h  |  5 ++--
 5 files changed, 88 insertions(+), 40 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-24 13:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 11:25 [Qemu-devel] [PATCH v3 0/3] pc: mmap kernel (ELF image) and initrd Stefano Garzarella
2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 1/3] loader: Handle memory-mapped ELFs Stefano Garzarella
2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 2/3] elf-ops.h: Map into memory the ELF to load Stefano Garzarella
2019-07-24 11:50   ` Paolo Bonzini
2019-07-24 12:35     ` Stefano Garzarella
2019-07-24 13:07       ` Paolo Bonzini
2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 3/3] hw/i386/pc: Map into memory the initrd Stefano Garzarella

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.