From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>
Subject: Re: [PATCH 00/31] Skip automatic zero-init of large arrays / structs in I/O paths
Date: Tue, 10 Jun 2025 10:04:07 -0400 [thread overview]
Message-ID: <20250610140407.GB89694@fedora> (raw)
In-Reply-To: <20250610123709.835102-1-berrange@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 4637 bytes --]
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 <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-06-10 16:59 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 12:36 [PATCH 00/31] Skip automatic zero-init of large arrays / structs in I/O paths Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 01/31] include/qemu/compiler: add QEMU_UNINITIALIZED attribute macro Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 02/31] hw/virtio/virtio: avoid cost of -ftrivial-auto-var-init in hot path Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 03/31] block: skip automatic zero-init of large array in ioq_submit Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 04/31] chardev/char-fd: skip automatic zero-init of large array Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 05/31] chardev/char-pty: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 06/31] chardev/char-socket: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 07/31] hw/audio/ac97: skip automatic zero-init of large arrays Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 08/31] hw/audio/cs4231a: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 09/31] hw/audio/es1370: skip automatic zero-init of large array Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 10/31] hw/audio/gus: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 11/31] " Daniel P. Berrangé
2025-06-10 14:23 ` Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 12/31] hw/audio/sb16: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 13/31] hw/audio/via-ac97: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 14/31] hw/char/sclpconsole-lm: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 15/31] hw/dma/xlnx_csu_dma: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 16/31] hw/display/vmware_vga: skip automatic zero-init of large struct Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 17/31] hw/hyperv/syndbg: skip automatic zero-init of large array Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 18/31] hw/misc/aspeed_hace: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 19/31] hw/net/rtl8139: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 20/31] hw/net/tulip: " Daniel P. Berrangé
2025-06-10 12:36 ` [PATCH 21/31] hw/net/virtio-net: skip automatic zero-init of large arrays Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 22/31] hw/net/xgamc: skip automatic zero-init of large array Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 23/31] hw/nvme/ctrl: skip automatic zero-init of large arrays Daniel P. Berrangé
2025-06-11 8:55 ` Klaus Jensen
2025-06-10 12:37 ` [PATCH 24/31] hw/ppc/pnv_occ: skip automatic zero-init of large struct Daniel P. Berrangé
2025-06-11 9:09 ` Harsh Prateek Bora
2025-06-10 12:37 ` [PATCH 25/31] hw/ppc/spapr_tpm_proxy: skip automatic zero-init of large arrays Daniel P. Berrangé
2025-06-11 9:20 ` Harsh Prateek Bora
2025-06-10 12:37 ` [PATCH 26/31] hw/usb/hcd-ohci: skip automatic zero-init of large array Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 27/31] hw/scsi/lsi53c895a: " Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 28/31] hw/scsi/megasas: skip automatic zero-init of large arrays Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 29/31] hw/ufs/lu: skip automatic zero-init of large array Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 30/31] net/socket: " Daniel P. Berrangé
2025-06-10 12:37 ` [PATCH 31/31] net/stream: " Daniel P. Berrangé
2025-06-10 12:49 ` [PATCH 00/31] Skip automatic zero-init of large arrays / structs in I/O paths Philippe Mathieu-Daudé
2025-06-10 12:56 ` Daniel P. Berrangé
2025-06-10 15:00 ` Philippe Mathieu-Daudé
2025-06-10 15:56 ` Daniel P. Berrangé
2025-06-10 14:04 ` Stefan Hajnoczi [this message]
2025-06-11 19:19 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250610140407.GB89694@fedora \
--to=stefanha@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.