From 6ae70910d16ef313e4addefea33c00083cc5665c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 10 Jun 2025 13:36:55 +0100 Subject: [PATCH 25/43] hw/hyperv/syndbg: skip automatic zero-init of large array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Stefan Hajnoczi RH-MergeRequest: 381: Solve -ftrivial-auto-var-init performance regression with QEMU_UNINITIALIZED RH-Jira: RHEL-95479 RH-Acked-by: Miroslav Rezanina RH-Commit: [17/31] 2c7e0765ddb0fe5880403b234c299931da6daabf (stefanha/centos-stream-qemu-kvm) The 'handle_recv_msg' method has a 4k byte array used for copying data between the network socket and guest memory. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'data_buf' array will be fully initialized when data is read off the network socket. Signed-off-by: Daniel P. Berrangé Reviewed-by: Stefan Hajnoczi Message-id: 20250610123709.835102-18-berrange@redhat.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit 5a1f614d0cd0bcc8e84e0b7ab6af63d56bd348a2) Signed-off-by: Stefan Hajnoczi Conflicts: hw/hyperv/syndbg.c Context conflict due to missing commit 3efb9d226221 ("hw/hyperv/syndbg: common compilation unit") downstream. There is no need to backport the commit because it's not a bug fix. --- hw/hyperv/syndbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c index d3e3917077..16ed1ab66b 100644 --- a/hw/hyperv/syndbg.c +++ b/hw/hyperv/syndbg.c @@ -188,7 +188,7 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa, uint64_t timeout, uint32_t *retrieved_count) { uint16_t ret; - uint8_t data_buf[TARGET_PAGE_SIZE - UDP_PKT_HEADER_SIZE]; + QEMU_UNINITIALIZED uint8_t data_buf[TARGET_PAGE_SIZE - UDP_PKT_HEADER_SIZE]; hwaddr out_len; void *out_data; ssize_t recv_byte_count; -- 2.39.3