60 lines
2.2 KiB
Diff
60 lines
2.2 KiB
Diff
From 63094ee4645705be09f68c547e3f1775ca528951 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
Date: Tue, 10 Jun 2025 13:36:46 +0100
|
|
Subject: [PATCH 09/31] hw/audio/cs4231a: skip automatic zero-init of large
|
|
arrays
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-MergeRequest: 461: Solve -ftrivial-auto-var-init performance regression with QEMU_UNINITIALIZED
|
|
RH-Jira: RHEL-99887
|
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-Commit: [8/30] c6117831ac2ec8e0a700207d5f101eddb67a24a4
|
|
|
|
The 'cs_write_audio' method has a pair of byte arrays, one 4k in size
|
|
and one 8k, which are used in converting audio samples. Skip the
|
|
automatic zero-init of these arrays to eliminate the performance
|
|
overhead in the I/O hot path.
|
|
|
|
The 'tmpbuf' array will be fully initialized when reading a block of
|
|
data from the guest. The 'linbuf' array will be fully initialized
|
|
when converting the audio samples.
|
|
|
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Message-id: 20250610123709.835102-9-berrange@redhat.com
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
(cherry picked from commit ca2cc0385d97cea66cd54ee42553f385c403d4a6)
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
---
|
|
hw/audio/cs4231a.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
|
|
index 9ef57f042d..5c312642cc 100644
|
|
--- a/hw/audio/cs4231a.c
|
|
+++ b/hw/audio/cs4231a.c
|
|
@@ -528,7 +528,7 @@ static int cs_write_audio (CSState *s, int nchan, int dma_pos,
|
|
int dma_len, int len)
|
|
{
|
|
int temp, net;
|
|
- uint8_t tmpbuf[4096];
|
|
+ QEMU_UNINITIALIZED uint8_t tmpbuf[4096];
|
|
IsaDmaClass *k = ISADMA_GET_CLASS(s->isa_dma);
|
|
|
|
temp = len;
|
|
@@ -547,7 +547,7 @@ static int cs_write_audio (CSState *s, int nchan, int dma_pos,
|
|
copied = k->read_memory(s->isa_dma, nchan, tmpbuf, dma_pos, to_copy);
|
|
if (s->tab) {
|
|
int i;
|
|
- int16_t linbuf[4096];
|
|
+ QEMU_UNINITIALIZED int16_t linbuf[4096];
|
|
|
|
for (i = 0; i < copied; ++i)
|
|
linbuf[i] = s->tab[tmpbuf[i]];
|
|
--
|
|
2.39.3
|
|
|