On Tue, Jun 10, 2025 at 01:36:38PM +0100, Daniel P. Berrangé wrote:
> This series is an extension of Stefan's proposal:
> 
>   https://lists.nongnu.org/archive/html/qemu-devel/2025-06/msg00736.html
> 
> It used '-Wframe-larger-than=4096' to identify all code locations
> with more than 4k on the stack. Any locations in the I/O paths
> were chosen to avoid automatic zero-init, to eliminate the performance
> overhead of the automatic initialization.
> 
> Note, although all the changed locations are I/O paths, this does not
> imply that the changes make a measurement performance difference in
> every case.
> 
> This is because many of the emulated devices are likely limited by the
> emulation impl, rather than any implicit memory zero'ing overhead of
> stack data.
> 
> None the less the memory zero'ing is still a redundant CPU burn in
> all these cases, so I felt it worth setting the general precedent
> that any data over 4k on a stack in a device I/O path should be
> skipping zero-init.
> 
> I did reasonable review in each case to identify that the data was
> indeed initialized explicitly later in the method.
> 
> Daniel P. Berrangé (29):
>   block: skip automatic zero-init of large array in ioq_submit
>   chardev/char-fd: skip automatic zero-init of large array
>   chardev/char-pty: skip automatic zero-init of large array
>   chardev/char-socket: skip automatic zero-init of large array
>   hw/audio/ac97: skip automatic zero-init of large arrays
>   hw/audio/cs4231a: skip automatic zero-init of large arrays
>   hw/audio/es1370: skip automatic zero-init of large array
>   hw/audio/gus: skip automatic zero-init of large array
>   hw/audio/gus: skip automatic zero-init of large array
>   hw/audio/sb16: skip automatic zero-init of large array
>   hw/audio/via-ac97: skip automatic zero-init of large array
>   hw/char/sclpconsole-lm: skip automatic zero-init of large array
>   hw/dma/xlnx_csu_dma: skip automatic zero-init of large array
>   hw/display/vmware_vga: skip automatic zero-init of large struct
>   hw/hyperv/syndbg: skip automatic zero-init of large array
>   hw/misc/aspeed_hace: skip automatic zero-init of large array
>   hw/net/rtl8139: skip automatic zero-init of large array
>   hw/net/tulip: skip automatic zero-init of large array
>   hw/net/virtio-net: skip automatic zero-init of large arrays
>   hw/net/xgamc: skip automatic zero-init of large array
>   hw/nvme/ctrl: skip automatic zero-init of large arrays
>   hw/ppc/pnv_occ: skip automatic zero-init of large struct
>   hw/ppc/spapr_tpm_proxy: skip automatic zero-init of large arrays
>   hw/usb/hcd-ohci: skip automatic zero-init of large array
>   hw/scsi/lsi53c895a: skip automatic zero-init of large array
>   hw/scsi/megasas: skip automatic zero-init of large arrays
>   hw/ufs/lu: skip automatic zero-init of large array
>   net/socket: skip automatic zero-init of large array
>   net/stream: skip automatic zero-init of large array
> 
> Stefan Hajnoczi (2):
>   include/qemu/compiler: add QEMU_UNINITIALIZED attribute macro
>   hw/virtio/virtio: avoid cost of -ftrivial-auto-var-init in hot path
> 
>  block/linux-aio.c          |  2 +-
>  chardev/char-fd.c          |  2 +-
>  chardev/char-pty.c         |  2 +-
>  chardev/char-socket.c      |  2 +-
>  hw/audio/ac97.c            |  4 ++--
>  hw/audio/cs4231a.c         |  4 ++--
>  hw/audio/es1370.c          |  2 +-
>  hw/audio/gus.c             |  2 +-
>  hw/audio/marvell_88w8618.c |  2 +-
>  hw/audio/sb16.c            |  2 +-
>  hw/audio/via-ac97.c        |  2 +-
>  hw/char/sclpconsole-lm.c   |  2 +-
>  hw/display/vmware_vga.c    |  2 +-
>  hw/dma/xlnx_csu_dma.c      |  2 +-
>  hw/hyperv/syndbg.c         |  2 +-
>  hw/misc/aspeed_hace.c      |  2 +-
>  hw/net/rtl8139.c           |  2 +-
>  hw/net/tulip.c             |  2 +-
>  hw/net/virtio-net.c        |  6 +++---
>  hw/net/xgmac.c             |  2 +-
>  hw/nvme/ctrl.c             |  6 +++---
>  hw/ppc/pnv_occ.c           |  2 +-
>  hw/ppc/spapr_tpm_proxy.c   |  4 ++--
>  hw/scsi/lsi53c895a.c       |  2 +-
>  hw/scsi/megasas.c          |  7 ++-----
>  hw/ufs/lu.c                |  2 +-
>  hw/usb/hcd-ohci.c          |  2 +-
>  hw/virtio/virtio.c         |  8 ++++----
>  include/qemu/compiler.h    | 20 ++++++++++++++++++++
>  net/socket.c               |  2 +-
>  net/stream.c               |  2 +-
>  31 files changed, 61 insertions(+), 44 deletions(-)
> 
> -- 
> 2.49.0
> 

I will merge this series but want to give others a chance to review it
first:

Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>

Attachment: signature.asc
Description: PGP signature

Reply via email to