From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559143; cv=none; d=zohomail.com; s=zohoarc; b=FGa0c+3TVf7tnIEtXwG9NLpXKZtSN6BNYdn7e0zHx85GdROuSpTsX7Ig5R2sKh6ViU/rMHfjup2TqKB/yoexDGX10zT6qWjecpgeGogUy7e+/pftc5TydlMefNDYP0xGeR621frFPL+2xbyPXBvf0rMByhd4ju4P1w/VLlJTL68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559143; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nNEVpaA6ZpnQR9kqI67uv9Fpve9YxWzS8rPPOTlSlY4=; b=EjCo1FHnjqeq6dUBVlLrLxsxyWnJrevnn9W4MIPgSTpJo67NdMwC6ob2a+StadYTgTud0OB4qBE1dqDB/Ss82cnOvgcm+P96df9X975n8fFsHZRWxhsc9r6PEDBQ4iu8MrZl8hWuK2o4TjJWGkZ1KSdt2vrumRsMv/6hYFdZBzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559143358617.4968880514499; Tue, 10 Jun 2025 05:39:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEM-000107-72; Tue, 10 Jun 2025 08:37:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEF-0000v2-RE for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyED-0000KI-Uk for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:23 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-693-mrIVs1tSNCaSGYVn00HIHg-1; Tue, 10 Jun 2025 08:37:17 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2A5E819560A2; Tue, 10 Jun 2025 12:37:16 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EBE3F30002C4; Tue, 10 Jun 2025 12:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nNEVpaA6ZpnQR9kqI67uv9Fpve9YxWzS8rPPOTlSlY4=; b=XOQ0aCEnO5mSzUGBNoCmL20epu2DNVM9cppdCBkYSAiT/D/TrFcxE3zwVx8L7M/roRMDi0 iszp9iPEl7Ei3w1HuMyf3kQQvMSANkr4kxNxnFl3yNWUf9YwV3xcmMRXZmitEOsNH8MsJ8 AB1yarXTk4OVaP8+ZsMLJsjoo7jEsek= X-MC-Unique: mrIVs1tSNCaSGYVn00HIHg-1 X-Mimecast-MFC-AGG-ID: mrIVs1tSNCaSGYVn00HIHg_1749559036 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 01/31] include/qemu/compiler: add QEMU_UNINITIALIZED attribute macro Date: Tue, 10 Jun 2025 13:36:39 +0100 Message-ID: <20250610123709.835102-2-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559143997116600 From: Stefan Hajnoczi The QEMU_UNINITIALIZED macro is to be used to skip the default compiler variable initialization done by -ftrivial-auto-var-init=3Dzero. Use this in cases where there a method in the device I/O path (or other important hot paths), that has large variables on the stack. A rule of thumb is that "large" means a method with 4kb data in the local stack frame. Any variables which are KB in size, should be annotated with this attribute, to pre-emptively eliminate any potential overhead from the compiler zero'ing memory. Given that this turns off a security hardening feature, when using this to flag variables, it is important that the code is double-checked to ensure there is no possible use of uninitialized data in the method. Signed-off-by: Stefan Hajnoczi [DB: split off patch & rewrite guidance on when to use the annotation] Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- include/qemu/compiler.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 496dac5ac1..65b89958d3 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -207,6 +207,26 @@ # define QEMU_USED #endif =20 +/* + * Disable -ftrivial-auto-var-init on a local variable. + * + * Use this in cases where there a method in the device I/O path (or other + * important hot paths), that has large variables on the stack. A rule of + * thumb is that "large" means a method with 4kb data in the local stack + * frame. Any variables which are KB in size, should be annotated with this + * attribute, to pre-emptively eliminate any potential overhead from the + * compiler's implicit zero'ing of memory. + * + * Given that this turns off a security hardening feature, when using this + * to flag variables, it is important that the code is double-checked to + * ensure there is no possible use of uninitialized data in the method. + */ +#if __has_attribute(uninitialized) +# define QEMU_UNINITIALIZED __attribute__((uninitialized)) +#else +# define QEMU_UNINITIALIZED +#endif + /* * http://clang.llvm.org/docs/ThreadSafetyAnalysis.html * --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559155; cv=none; d=zohomail.com; s=zohoarc; b=dVKM4h/Rtaa1zYiHM0Hw3ALPOsGcvKHuTjnK2lW7kLf23uNaMZp5nP0XNMNKjJgTY/jEsrMyFzwTzkBKQZ6TL+ZPeSfiZ8HojUnHZyxw5+2IEg4bdQRCj/zMu7wkRpjXcy6Qpif02i69MjXwrCddkTnLARVVqDOpuxy8qdKfABg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559155; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=j76fbKOvludH5u8gLvzbitzanC2lomyLcTIVOQQN+ro=; b=W1yvTL5TbBQtbF/eNa/SffYV/ppCcCPAWhNugeY5goU9oHffAyHj7Q9YRPscqfjzwaNABrOWANysUYloz9KTgCS9h6lmWql6rnLJDZHN8hv+Sb5/mB5sEd4LftmZ5bOzUFqkZcOX7K5Lpkz1qmOv+YcUHKKRhSE22wl3+D8+eW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559155176448.68894116689887; Tue, 10 Jun 2025 05:39:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEN-000126-Qg; Tue, 10 Jun 2025 08:37:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEI-0000vQ-7t for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEG-0000Kd-74 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:25 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-h4Yf_TulMQ6kqVsL3CAK2g-1; Tue, 10 Jun 2025 08:37:20 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A4578195606A; Tue, 10 Jun 2025 12:37:18 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7FF3B30001B1; Tue, 10 Jun 2025 12:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j76fbKOvludH5u8gLvzbitzanC2lomyLcTIVOQQN+ro=; b=Z7NGkV72cEhAGTgAJfTjCo3Z9wNST7+F0iAuhRlYgpL/BDiebuPGuO5dlss6gmnyXIfmof U7h8F/4eqgaUSYOZdoWRawtlm4DCWf4Cc+flmLuz9V3CLEiiENdv6lazkbyLSYXgw81oTu d7o8s6MmmSc5U42QeCCuNOchmTUlH4Y= X-MC-Unique: h4Yf_TulMQ6kqVsL3CAK2g-1 X-Mimecast-MFC-AGG-ID: h4Yf_TulMQ6kqVsL3CAK2g_1749559038 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 02/31] hw/virtio/virtio: avoid cost of -ftrivial-auto-var-init in hot path Date: Tue, 10 Jun 2025 13:36:40 +0100 Message-ID: <20250610123709.835102-3-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559158233116600 From: Stefan Hajnoczi Since commit 7ff9ff039380 ("meson: mitigate against use of uninitialize stack for exploits") the -ftrivial-auto-var-init=3Dzero compiler option is used to zero local variables. While this reduces security risks associated with uninitialized stack data, it introduced a measurable bottleneck in the virtqueue_split_pop() and virtqueue_packed_pop() functions. These virtqueue functions are in the hot path. They are called for each element (request) that is popped from a VIRTIO device's virtqueue. Using __attribute__((uninitialized)) on large stack variables in these functions improves fio randread bs=3D4k iodepth=3D64 performance from 304k to 332k IOPS (+9%). This issue was found using perf-top(1). virtqueue_split_pop() was one of the top CPU consumers and the "annotate" feature showed that the memory zeroing instructions at the beginning of the functions were hot. Fixes: 7ff9ff039380 ("meson: mitigate against use of uninitialize stack for= exploits") Cc: Daniel P. Berrang=C3=A9 Signed-off-by: Stefan Hajnoczi Reviewed-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5534251e01..82a285a31d 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1689,8 +1689,8 @@ static void *virtqueue_split_pop(VirtQueue *vq, size_= t sz) VirtIODevice *vdev =3D vq->vdev; VirtQueueElement *elem =3D NULL; unsigned out_num, in_num, elem_entries; - hwaddr addr[VIRTQUEUE_MAX_SIZE]; - struct iovec iov[VIRTQUEUE_MAX_SIZE]; + hwaddr QEMU_UNINITIALIZED addr[VIRTQUEUE_MAX_SIZE]; + struct iovec QEMU_UNINITIALIZED iov[VIRTQUEUE_MAX_SIZE]; VRingDesc desc; int rc; =20 @@ -1836,8 +1836,8 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size= _t sz) VirtIODevice *vdev =3D vq->vdev; VirtQueueElement *elem =3D NULL; unsigned out_num, in_num, elem_entries; - hwaddr addr[VIRTQUEUE_MAX_SIZE]; - struct iovec iov[VIRTQUEUE_MAX_SIZE]; + hwaddr QEMU_UNINITIALIZED addr[VIRTQUEUE_MAX_SIZE]; + struct iovec QEMU_UNINITIALIZED iov[VIRTQUEUE_MAX_SIZE]; VRingPackedDesc desc; uint16_t id; int rc; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559257; cv=none; d=zohomail.com; s=zohoarc; b=lL59GzzQM32iAwEh1+LVUeE/oGGM9J2IDwZQK2kCS8A9SUfsZTyiSWyGMuWcBHMLHoq8IW2JaOH/VB7dkZ6buMOJARgv4g9RnGwyZjT9fgs4GPVwh9DReX5oG4e7CaJ+ySfqUhgfSFZmKmIUmiQKhZvVzfy/xVNq8Ai2niUgLsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559257; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HPC5fL9ZgHxTmRf/UnDDKNb3x7TqATZwHvx2CTeh1eI=; b=l36ULmvY19Mmfs5VG4he02BrxDVgui5kYF+L/rMD1k8gbULJdUN7/TKRJENoyX1TRWjwVG7uZC6oyGmwkycIIiRKnnP2ZflgtVzLUeG70yE2MlRHPc7BMragtySynMfSAF6Sue6Hd03IASHNYWAmffa8mTCpCVNR6/s1B3hguN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559257211911.7407623828997; Tue, 10 Jun 2025 05:40:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyET-00016d-SJ; Tue, 10 Jun 2025 08:37:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEM-000123-RQ for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEK-0000LB-BC for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:30 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-mTewK1llPf68HWOll7F2Yg-1; Tue, 10 Jun 2025 08:37:23 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3ECF4195604F; Tue, 10 Jun 2025 12:37:21 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EB19530001B1; Tue, 10 Jun 2025 12:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HPC5fL9ZgHxTmRf/UnDDKNb3x7TqATZwHvx2CTeh1eI=; b=eUKD/YpvzgzxjnbotW2xUjPqGv20XNMHhhkkMHzI/X5OC+cgqIt0zEc7E6kVeiO4PHrZ6E UMKhlJDzn2QbnblrwNdm8pW8N+auqau1wK7+QoGG3yusA1byGkLyNVRb3R5H0YV0SoTF8t xIiw4xaAAA9IGx2HvllNIznPpVQR2C8= X-MC-Unique: mTewK1llPf68HWOll7F2Yg-1 X-Mimecast-MFC-AGG-ID: mTewK1llPf68HWOll7F2Yg_1749559041 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 03/31] block: skip automatic zero-init of large array in ioq_submit Date: Tue, 10 Jun 2025 13:36:41 +0100 Message-ID: <20250610123709.835102-4-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559259465116600 The 'ioq_submit' method has a struct array that is 8k in size. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'iocbs' array will selectively initialized when processing the I/O data. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/linux-aio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/linux-aio.c b/block/linux-aio.c index 407369f5c9..c200e7ad20 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -291,7 +291,7 @@ static void ioq_submit(LinuxAioState *s) { int ret, len; struct qemu_laiocb *aiocb; - struct iocb *iocbs[MAX_EVENTS]; + QEMU_UNINITIALIZED struct iocb *iocbs[MAX_EVENTS]; QSIMPLEQ_HEAD(, qemu_laiocb) completed; =20 do { --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559112; cv=none; d=zohomail.com; s=zohoarc; b=ZUovC0tlkN1QG4pZQsuG/ml555ZiE8R1wttI70y7y6QfI0QZyMZXEqFq4rrphtq+4kDiLQsbzFOQ9NO0EM0dtmfvdeVX30yoIAkiLSQ/7ff/7CHVg/DCtE9ea5YnAJVERT6wT0zwtWCXT6+Kj//XqA4YNUrtBNihumVHosrrxGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559112; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2pU/WdK9MyKAGOHOGRI5D/jij3/HMuB9YHu/fFuyEtc=; b=eKXmArnbKi6FhdwUPEhR1m4vDSN/ZzT8xxLieRxhYh0++iGnuObpd+P7+PgpKFccbNCYT32ym+UiLd0U3PlrikWQmSqXh6Pzfol+8gp+/1klEzNzs4tjyG2d9y7jyFj4+iaOe2jktr0/UDf/kM4gK+ZoiwQfscNGyZa6syokBTI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559112205644.3050217077177; Tue, 10 Jun 2025 05:38:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEX-000192-EO; Tue, 10 Jun 2025 08:37:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEQ-000150-VP for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEL-0000LR-S1 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:34 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-n90PJIM7PLiroL2NwEMKXQ-1; Tue, 10 Jun 2025 08:37:25 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E1503180028A; Tue, 10 Jun 2025 12:37:23 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9D26130001B1; Tue, 10 Jun 2025 12:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2pU/WdK9MyKAGOHOGRI5D/jij3/HMuB9YHu/fFuyEtc=; b=P50WPoiMNAXXcSBGmpHk+NnreuY3GSKmQfDuui8cJQIFrlBXIwQe02GwvCfOT1oAVBXgVD HBzOSpKtJJ96Ols+coOjOvUBnkTS/oA9QmxJaGBWSiPPuQpvJ9/fLUrHSXRLQpR7saFJoB 84pdB0zcMR4vRwOc6770LYjOGzkUEns= X-MC-Unique: n90PJIM7PLiroL2NwEMKXQ-1 X-Mimecast-MFC-AGG-ID: n90PJIM7PLiroL2NwEMKXQ_1749559044 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 04/31] chardev/char-fd: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:42 +0100 Message-ID: <20250610123709.835102-5-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559113530116600 The 'fd_chr_read' method has a 4k byte array used for copying data between the socket and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when reading data off the network socket. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- chardev/char-fd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-fd.c b/chardev/char-fd.c index 23bfe3c0b1..6f03adf872 100644 --- a/chardev/char-fd.c +++ b/chardev/char-fd.c @@ -50,7 +50,7 @@ static gboolean fd_chr_read(QIOChannel *chan, GIOConditio= n cond, void *opaque) Chardev *chr =3D CHARDEV(opaque); FDChardev *s =3D FD_CHARDEV(opaque); int len; - uint8_t buf[CHR_READ_BUF_LEN]; + QEMU_UNINITIALIZED uint8_t buf[CHR_READ_BUF_LEN]; ssize_t ret; =20 len =3D sizeof(buf); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559184; cv=none; d=zohomail.com; s=zohoarc; b=bgOb4MjOnCJtQPg7zx6bJlpAaGkfTV3I62FBS8vNezy9F5yhVqiWtKlPQfmFDNkvawccWKGKg5t06HvIlljMTn3Qmm3UuuvPxoqM1XeXIagnNLsuScpeHB73K9cHWQ9ydrmrLnna76J3U5mh/OELTj26dsLS94/BX0I+sdRNUOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559184; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RBqbfCalZuqXutVzFFVBZwfbIeDK7ZBwE0vtee49vlw=; b=TICT1Sh++/r/qxOZoKpgESbZ7adunm1/py1jYC6X5MqRiXwRiBgiNKUq0Mzg6yu1Y6xf0TyTf1nGf+belvDTnIZgxRfj7dCAs912T55wBz4QDeIn3EPhFfk9hFEhlQvBUkKtt9vtK0GOsDiHzpAvh9PUT6QeAvabZDxx4C53VXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559184507711.355648863615; Tue, 10 Jun 2025 05:39:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyET-00015f-6B; Tue, 10 Jun 2025 08:37:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEQ-00014A-7q for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEO-0000Lr-Ct for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:33 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-E92nkI84MiGM85ilb9EDxg-1; Tue, 10 Jun 2025 08:37:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5EA551956096; Tue, 10 Jun 2025 12:37:26 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44FBD30001B1; Tue, 10 Jun 2025 12:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RBqbfCalZuqXutVzFFVBZwfbIeDK7ZBwE0vtee49vlw=; b=BPwL90I3eG5yTqLBE6vKdssxje99chbHhksA5USh3U14KKsWHbGHC+PTmQZ2/ZFoqHkVVg kHCbLkTs3e33DQi5Knxx4Zysh9OzFhQ8lVCeo3BAV5QKu6EZ7JOU8JQLD1rNVOUYBD1aVJ xuczEiclNJcZdb7kkm+di/l2BcNB3lQ= X-MC-Unique: E92nkI84MiGM85ilb9EDxg-1 X-Mimecast-MFC-AGG-ID: E92nkI84MiGM85ilb9EDxg_1749559046 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 05/31] chardev/char-pty: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:43 +0100 Message-ID: <20250610123709.835102-6-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559186424116601 The 'pty_chr_read' method has a 4k byte array used for copying data between the PTY and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when reading data off the PTY. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- chardev/char-pty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-pty.c b/chardev/char-pty.c index c28554e6e0..674e9b3f14 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -154,7 +154,7 @@ static gboolean pty_chr_read(QIOChannel *chan, GIOCondi= tion cond, void *opaque) Chardev *chr =3D CHARDEV(opaque); PtyChardev *s =3D PTY_CHARDEV(opaque); gsize len; - uint8_t buf[CHR_READ_BUF_LEN]; + QEMU_UNINITIALIZED uint8_t buf[CHR_READ_BUF_LEN]; ssize_t ret; =20 len =3D sizeof(buf); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559107; cv=none; d=zohomail.com; s=zohoarc; b=HpvMhPsSIdUgbbUZN1CMzK7NN3A/IQeu+jz6JMuTq1NHjgLXWOi9ppv51Ba8ZsM7RlSiLgJXLHqz2wubUUp1kIEVinQ65Im7VmQA1hUPbUB10p7SkaejpCRCPFxH+1h2GnUL9pzFpBoYZXu0PjuowJXExhtXlO7U7bTQ0hahxfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559107; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eu7l30qYEJRqu5XHUXb1NdU98PZMY6yhM8D9nasdvOU=; b=aQ5Hj7jzs8qg/Xf6/pD73HbvE6Bup87aPx5hhYMQeNwOGuGwpcQs6JAUo9Ywp63QMZS0KKbwgo/VAXcmV8ZNGWd2c7Od+7p6211u0Eh2TbK+M31M841z4AGj8vulgeFLDcfCYbpDRzWeAjVqG43S89q8QTUZYbC20RSOJaOLAtI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559107633965.5125282415984; Tue, 10 Jun 2025 05:38:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEg-0001D9-Uw; Tue, 10 Jun 2025 08:37:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyET-00016n-O5 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEO-0000Lt-HT for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:37 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-9zEzcFL1O8uUyt7ZXFqHxw-1; Tue, 10 Jun 2025 08:37:30 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 096D0180028F; Tue, 10 Jun 2025 12:37:29 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B794030001B1; Tue, 10 Jun 2025 12:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eu7l30qYEJRqu5XHUXb1NdU98PZMY6yhM8D9nasdvOU=; b=XGjaQ/ZFgzca7qKd78VgxvGkLOLUtKI3UJk+2Dv9bgF7dkUk5LqVUQx71mgW9BJ+rP5zZ7 NKzlgCC6vAvEKExGG7zl6f1e/nil32NSl7yEfEIDUc+XuusNKKLTFcHTs5sQwnl4Cg0kiI TE7nXVjYfNVG8slFie+Nme+AXdTguy8= X-MC-Unique: 9zEzcFL1O8uUyt7ZXFqHxw-1 X-Mimecast-MFC-AGG-ID: 9zEzcFL1O8uUyt7ZXFqHxw_1749559049 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 06/31] chardev/char-socket: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:44 +0100 Message-ID: <20250610123709.835102-7-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559109547116600 The 'tcp_chr_read' method has a 4k byte array used for copying data between the socket and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when reading data off the network socket. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- chardev/char-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index e8dd2931dc..1e8313915b 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -497,7 +497,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondi= tion cond, void *opaque) { Chardev *chr =3D CHARDEV(opaque); SocketChardev *s =3D SOCKET_CHARDEV(opaque); - uint8_t buf[CHR_READ_BUF_LEN]; + QEMU_UNINITIALIZED uint8_t buf[CHR_READ_BUF_LEN]; int len, size; =20 if ((s->state !=3D TCP_CHARDEV_STATE_CONNECTED) || --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559131; cv=none; d=zohomail.com; s=zohoarc; b=OjKOKiW9U0PU32Jguz8iKpwdreXoYGQo4xqJ7R4vqkJvAOPEpPVbyKl02iwvx9//qBDydlgTk/3VFJI0Ee4Ok41HQ/FSTsadkh9us0ntQ/2ovdNEnIBWNUFgFkSmvhmS24IA+MugDvf6WC2QuWQmaaykO5BKfmfU6nyCXdosRbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559131; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JTdJdxEeveQy0CbzyfonyMLaA1XBMVsOuj6kJF0sIVc=; b=MYlkSDYpI4uToDK3sE4VOVmOeCkABKbWdl8uyMG57e7Drp7TZ2UMHrnGFqQqVgsUDm4yUBbgLRx0W7qCjvLMYhqJfOmWDY5mnGIUhW6O/Uqysqo8hOJ/idKPF6GEfg9m0o9wsd8DyGstNaEvhee+5QFHHdzfpvd1INBGXQvGf2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559131979493.77277035290604; Tue, 10 Jun 2025 05:38:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEb-0001BQ-FA; Tue, 10 Jun 2025 08:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyET-00016Q-DV for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyER-0000Mi-Bf for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:37 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-3-gE8X927YMsS969RyB6wm2g-1; Tue, 10 Jun 2025 08:37:33 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DFAD419560BE; Tue, 10 Jun 2025 12:37:31 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6482630002C6; Tue, 10 Jun 2025 12:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JTdJdxEeveQy0CbzyfonyMLaA1XBMVsOuj6kJF0sIVc=; b=irxTYS9DfaGroK/PMNQUFFJoyAfcPbgyVoMZkbb4MtPa0kNbo0PrXSaKxHNzIB1GfxhSLW nsYy+tDnVklgbUh3S9aTDO3OraYvGICkQFfz1ELZpVvn5h/iUNFRBjKk5vAHx/a0eVuYV5 YYdmikG0UbzkvpDBZK2zP0QiKi26MxI= X-MC-Unique: gE8X927YMsS969RyB6wm2g-1 X-Mimecast-MFC-AGG-ID: gE8X927YMsS969RyB6wm2g_1749559052 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 07/31] hw/audio/ac97: skip automatic zero-init of large arrays Date: Tue, 10 Jun 2025 13:36:45 +0100 Message-ID: <20250610123709.835102-8-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559133836116600 The 'read_audio' & 'write_audio' methods have a 4k byte array used for copying data between the audio backend and device. 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 data from the audio backend and/or device memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/audio/ac97.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 669a0463cc..eb7a847080 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -886,7 +886,7 @@ static void nabm_writel(void *opaque, uint32_t addr, ui= nt32_t val) static int write_audio(AC97LinkState *s, AC97BusMasterRegs *r, int max, int *stop) { - uint8_t tmpbuf[4096]; + QEMU_UNINITIALIZED uint8_t tmpbuf[4096]; uint32_t addr =3D r->bd.addr; uint32_t temp =3D r->picb << 1; uint32_t written =3D 0; @@ -959,7 +959,7 @@ static void write_bup(AC97LinkState *s, int elapsed) static int read_audio(AC97LinkState *s, AC97BusMasterRegs *r, int max, int *stop) { - uint8_t tmpbuf[4096]; + QEMU_UNINITIALIZED uint8_t tmpbuf[4096]; uint32_t addr =3D r->bd.addr; uint32_t temp =3D r->picb << 1; uint32_t nread =3D 0; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559603; cv=none; d=zohomail.com; s=zohoarc; b=S1bnWrN9qDuFjMxQ+2NmLL+ThHeQkOwoDna8ed4riARgvy5jZKioWlXOWYzQh9uBFwt0SAEIpcynF81hLqbPFJBkAQ0guEVeiRmovnfynCsDX+MNbNLmNtbShGJHfGxlJQsjP7O0ym5sEIKVR3JZL8R+8TwlTp6YbXW5laF/fpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559603; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SqELLEQfR8/5Vvj/4xWZnG7IMm5yMn3lnT+oxdWHCkQ=; b=GlMrraFxi20ZI9V9z2fGzjvGIwJ5UTO5lfSNufLpDy9Ot6BXb2Vc/4TE+HVCa/zn2ggyCZiKn96P4kdxBGBw7nNKwIO8ZpK+fgoLq6uWVUYrXme4pmg/XzDTEt9J4IYtaZlOznJBKE3V/7dY5BTB3L10fdGyJlPQRBS/QrJL+Hk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559603403843.1371181993492; Tue, 10 Jun 2025 05:46:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEe-0001Cl-Ah; Tue, 10 Jun 2025 08:37:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEa-0001Bc-I6 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEV-0000NX-Dn for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:43 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-488-mBh_R01mOIKVwAayOMjyMQ-1; Tue, 10 Jun 2025 08:37:35 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3F5B0195606A; Tue, 10 Jun 2025 12:37:34 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2EA2C30002C6; Tue, 10 Jun 2025 12:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SqELLEQfR8/5Vvj/4xWZnG7IMm5yMn3lnT+oxdWHCkQ=; b=dthAb+YGsjmEAbLP1EsIrmQGzymKMWY3GgGo3u/9Fnw55CLdAaRjKEZ3/hf0KWts5Fyz/V BGWZgkfyxhYzWRIp9l9NX3/lrLIZ6CdxhLKw5UAmZ+It7YP//w4Z7DC6a2Zpl5yxr+Rhyt vXmd8k/cORA2sfOTT4nSOBm+3U8tYmc= X-MC-Unique: mBh_R01mOIKVwAayOMjyMQ-1 X-Mimecast-MFC-AGG-ID: mBh_R01mOIKVwAayOMjyMQ_1749559054 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 08/31] hw/audio/cs4231a: skip automatic zero-init of large arrays Date: Tue, 10 Jun 2025 13:36:46 +0100 Message-ID: <20250610123709.835102-9-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559603975116600 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=C3=A9 Reviewed-by: Stefan Hajnoczi --- 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 eb9a45805b..6dfff202ff 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 d= ma_pos, int dma_len, int len) { int temp, net; - uint8_t tmpbuf[4096]; + QEMU_UNINITIALIZED uint8_t tmpbuf[4096]; IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); =20 temp =3D len; @@ -547,7 +547,7 @@ static int cs_write_audio (CSState *s, int nchan, int d= ma_pos, copied =3D k->read_memory(s->isa_dma, nchan, tmpbuf, dma_pos, to_c= opy); if (s->tab) { int i; - int16_t linbuf[4096]; + QEMU_UNINITIALIZED int16_t linbuf[4096]; =20 for (i =3D 0; i < copied; ++i) linbuf[i] =3D s->tab[tmpbuf[i]]; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559120; cv=none; d=zohomail.com; s=zohoarc; b=eJJjqKo4ONCd4WYXD41tYDZUV9aAPtltZ7TDG3iGnuh7mKO9g1jtT0Z3PTiQ/78/lDtnfDtwPHYyG8sttzA1vDnRrGZU0uGCyOW9f7RrIIKc/PBaPgUSTMpWve4XAexfULgdu/g+MnmN6ClRxrv+FKXvBFyWuOzKD5zViu1gJyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559120; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L0x7tEzCa1AMFXs2Pr1DEbB40HIZx+iiIsZiAtJd9qw=; b=eMbH2ywoTn8uwxPX9e4GBd5U/2g4d7hkJNfSNx01Cf6ZZjjmXmSArkOPipUTcqxQnA9ydkKKVlyWANOD9Sgah+v8s9Yxb0wVIOMWcAj54ldIVnBwqXvvRpwdek5WjrxhV/m8BJQ9Mu9ZWrYIarQrkCVRt8A0r7ECJrdWYiid9is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559120288288.8251138927127; Tue, 10 Jun 2025 05:38:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyEc-0001Bj-Td; Tue, 10 Jun 2025 08:37:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEZ-0001AX-L2 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEX-0000Ny-Tr for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:43 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-Ek17Q6zXMyyPPC1n1IrRgw-1; Tue, 10 Jun 2025 08:37:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B5B78180028A; Tue, 10 Jun 2025 12:37:36 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9C05130001B1; Tue, 10 Jun 2025 12:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L0x7tEzCa1AMFXs2Pr1DEbB40HIZx+iiIsZiAtJd9qw=; b=Q9/nWZzlDxVfQIy52k3GLlw3AEnn3LXBEsdpQez7CCbV39y5xyno1CJJvoWjDsp1m+Syr7 iGiav7RzE7HzinnAVAw9Biu9L12oIq3pzYwrsotLSgp+1B1FSHBJULejsAuT1jxPDnrmSo 18AlQild9QEXC6yAerKfamN9lFNyroI= X-MC-Unique: Ek17Q6zXMyyPPC1n1IrRgw-1 X-Mimecast-MFC-AGG-ID: Ek17Q6zXMyyPPC1n1IrRgw_1749559056 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 09/31] hw/audio/es1370: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:47 +0100 Message-ID: <20250610123709.835102-10-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559121668116600 The 'es1370_transfer_audio' method has a 4k byte array used for copying data between the audio backend and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'tmpbuf' array will be fully initialized when reading data from the audio backend and/or device memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/audio/es1370.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 8efb969212..a6a32a6348 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -604,7 +604,7 @@ static uint64_t es1370_read(void *opaque, hwaddr addr, = unsigned size) static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loo= p_sel, int max, bool *irq) { - uint8_t tmpbuf[4096]; + QEMU_UNINITIALIZED uint8_t tmpbuf[4096]; size_t to_transfer; uint32_t addr =3D d->frame_addr; int sc =3D d->scount & 0xffff; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559502; cv=none; d=zohomail.com; s=zohoarc; b=k0Imwxfe+aFHsGVY7QmmmhAqbmzQ0vZJvg+gzLq1JA0xvuNA6okTHxap3NIrStxkH0TJHWgoH3QmSMDEbzw+pfjuOs3LU3nlY3C3v96TEhFLbGsEQr49meTUSE85o9Fswni2ad8FWvsrvOaUOuJzLYsVfHrKSkZngcV68btCIos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559502; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=C7RTKr9TMIEcecNoe3lz3XO90qrGqNncV53XXMM1M2g=; b=Rj6dNFpuUl0FnPwgQPoMOeVNzdInBxMI6Lmx0FahFBnEfK9RDUar1z8r9KZtNcFH+BAeWNjQuraIyH0M/A8gcjS+Ll9mYmXameN87IXN2k2fvLhe7Q7XxeZ1XL40cWnmckNctdJBpI3H30tZkduAqNqC/HsOIsyqtlxjl7WhzzU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174955950213023.188202532887885; Tue, 10 Jun 2025 05:45:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyFg-0001oa-5b; Tue, 10 Jun 2025 08:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEd-0001CS-3f for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEb-0000ON-7x for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:46 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-260-SOqxDLp0P7ay3V75-atGZg-1; Tue, 10 Jun 2025 08:37:40 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7C0D9180135B; Tue, 10 Jun 2025 12:37:39 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4C14A30001B1; Tue, 10 Jun 2025 12:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C7RTKr9TMIEcecNoe3lz3XO90qrGqNncV53XXMM1M2g=; b=DrxTAYMb41dV+HtVKZPFgCBgEqkUpODW5/IoiEbN9Hvijpmkcgb9JPTdUG9pmpS54Mzgix YPtRaa03YhRq8IC3vTdVFnXmpCT75SMVxRXhcaUukwddwn27Y28EvCRZpIlZXXetgSwRZV JtvLfih103hi1r8I6l55uP9HRh1eJoE= X-MC-Unique: SOqxDLp0P7ay3V75-atGZg-1 X-Mimecast-MFC-AGG-ID: SOqxDLp0P7ay3V75-atGZg_1749559059 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 10/31] hw/audio/gus: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:48 +0100 Message-ID: <20250610123709.835102-11-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559504353116600 The 'GUS_read_DMA' method has a 4k byte array used for copying data between the audio backend and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'tmpbuf' array will be fully initialized when reading data from device memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/audio/gus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 87e8634893..c36df0240f 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -183,7 +183,7 @@ static int GUS_read_DMA (void *opaque, int nchan, int d= ma_pos, int dma_len) { GUSState *s =3D opaque; IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); - char tmpbuf[4096]; + QEMU_UNINITIALIZED char tmpbuf[4096]; int pos =3D dma_pos, mode, left =3D dma_len - dma_pos; =20 ldebug ("read DMA %#x %d\n", dma_pos, dma_len); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559501; cv=none; d=zohomail.com; s=zohoarc; b=XFhI33cdI7VS4CUfE9hdfaKzQgHsSW2cA9QRCEdXaz3YydjEfD8UVA6Z92/DkcAVhvJeCvqXc+7hnsyR1fP4fjBAzDq23mJ4k172nd+26YvKh1R4Amai3dSjnUi4uIigBc6ciB525oIt9EG7vxrHzHtw9swoQQS2EqXdfUBq0U4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559501; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T8ay3jL27sxTINUQkztWMF7zJ75fZoHD6z9mqVgDF6o=; b=ciGwYNcFo2zub+ULaV5fAZzE3vUwvcn2yw2bVKdZOUAFWzuaB8E3hVj/iTgOt98nOP19vGcISUHwXDRchIYKc9faNJ9cHOVRAzH+vlrRq/ZlHZVNzs1dolUQc6QPNsgYOfLtBr23Otraub68CgIoFclWPa8y8LhvUnNMsQmSqE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559501899198.37420909704645; Tue, 10 Jun 2025 05:45:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyFi-00022A-Oq; Tue, 10 Jun 2025 08:38:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEh-0001E7-Vl for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEd-0000OX-Cv for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:51 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-B4vnWJhlOx-QANYZsHTaTA-1; Tue, 10 Jun 2025 08:37:43 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2634B19560BA; Tue, 10 Jun 2025 12:37:42 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F013230001B1; Tue, 10 Jun 2025 12:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T8ay3jL27sxTINUQkztWMF7zJ75fZoHD6z9mqVgDF6o=; b=fBnbulgx3T/TZR7TixzsEMxz/IEJHN2R7//RyxuhOOM1+JqwlG7kvUWHjoLDBbDXuqT3dL 6b09HBRj74ZsI4EnD9cQjWQhyCxvGy1J2KMcIMdbwV/mTUgUi4ccj/HQrQCj80+1RmaqaD uGY+BierIQCwrwK/9ozsPWs1UpcWeWI= X-MC-Unique: B4vnWJhlOx-QANYZsHTaTA-1 X-Mimecast-MFC-AGG-ID: B4vnWJhlOx-QANYZsHTaTA_1749559062 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 11/31] hw/audio/gus: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:49 +0100 Message-ID: <20250610123709.835102-12-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559502508116600 The 'mv88w8618_audio_callback' method has a 4k byte array used for copying data between the audio backend and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when reading data from device memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/audio/marvell_88w8618.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index 6d3ebbb0c8..c5c79d083a 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -66,7 +66,7 @@ static void mv88w8618_audio_callback(void *opaque, int fr= ee_out, int free_in) { mv88w8618_audio_state *s =3D opaque; int16_t *codec_buffer; - int8_t buf[4096]; + QEMU_UNINITIALIZED int8_t buf[4096]; int8_t *mem_buffer; int pos, block_size; =20 --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559266; cv=none; d=zohomail.com; s=zohoarc; b=nxdMi+HsdAhdOGUeX4SMIxl5XzKSR6mU/xwylJnGI5vz56Md2lvw8w2QfyBftYqqLqvIRErv/rqn4JrtwxU9hCMa63IrWk63OWJMI5hzZB2ck4h7xcJnsGO+b0SbK6JU8js2ZMezQ1I9cTJSRMQxI7wcQLVAELr5xrueaAqfPaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559266; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oC3bnhW/4ufRd4rICQUGkAzauGbYWqso40cbwdueTAg=; b=d4y5+iJhYIoGlqxZLUWUbFauaKOjSHVze51AQzV27UD+CMNRNwdjMfUkriXv6/ICnuhv9GQYZyxg74l91Wqsc2PridMQZb9G3qJWubrebG9wF0s9TcTvVPdR86wPBlbWahMrv/8RDgGkg1591w1GdwJ+H8y54Y9Hs9i0U6laeFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559266522224.21786795199034; Tue, 10 Jun 2025 05:41:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyFn-0002HM-HO; Tue, 10 Jun 2025 08:38:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEh-0001E5-Nl for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEf-0000Oy-TC for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:51 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-186-sdGXTp4HMOiMp92RcASgsQ-1; Tue, 10 Jun 2025 08:37:45 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A1A2818002EC; Tue, 10 Jun 2025 12:37:44 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 81D9630002C5; Tue, 10 Jun 2025 12:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oC3bnhW/4ufRd4rICQUGkAzauGbYWqso40cbwdueTAg=; b=f0XtBML1cGsTG8UBvOn+qrurb4G58MtVd1h+MjX+q78FeiTlZKwSgauOZcGkR5s//xq72l Kwj4PQT6MbxCj4Fv4m2aTPkxfG1GPKmsSpjZj4Gk+W18kFdSnj6+Lz8VXwp4LZOLMAk5cn 0a1ErnipptggKekvBDiUf1XXVaxbDO4= X-MC-Unique: sdGXTp4HMOiMp92RcASgsQ-1 X-Mimecast-MFC-AGG-ID: sdGXTp4HMOiMp92RcASgsQ_1749559064 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 12/31] hw/audio/sb16: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:50 +0100 Message-ID: <20250610123709.835102-13-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559267570116600 The 'write_audio' method has a 4k byte array used for copying data between the audio backend and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'tmpbuf' array will be fully initialized when reading data from device memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/audio/sb16.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 19fd3b9020..bac64118fe 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1181,7 +1181,7 @@ static int write_audio (SB16State *s, int nchan, int = dma_pos, IsaDma *isa_dma =3D nchan =3D=3D s->dma ? s->isa_dma : s->isa_hdma; IsaDmaClass *k =3D ISADMA_GET_CLASS(isa_dma); int temp, net; - uint8_t tmpbuf[4096]; + QEMU_UNINITIALIZED uint8_t tmpbuf[4096]; =20 temp =3D len; net =3D 0; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559603; cv=none; d=zohomail.com; s=zohoarc; b=c+cP3TmTNZAl5vEFX+rZcKWl9xgwFR4oCxskb82oYN9ZwVY5f0ynfP1Uxi6oKGd05lP5YE6fqbtT3JgVpD9zsknG0KWIZPUZuzojKQSi90PDnfVBSXQxRlhWBQhjF2nmZTgng+6E1zEUhLGU02zBYULaaIlq10HmEWq+RZ5X2kU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559603; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/ziOtHkbVXRYUSBWCtKwOP17Zb9Et/uXA8AYoC3S5Tg=; b=LG4cygnjFj2taME7bOnfxPVSUhXCh5a6OqSweL9tZS0i8xrLmT5gRlXFn8MJgr/w+3Qo+FfXOQhS+4r2tQPXBBQxIDEbx3TY1yYAvqDa4ITai0Gz+AGAyF/0ULYaVq1RpeMkGzqLPe1Ht67qerg+ocAO9cx87RHyLij5pOQq5r0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559603756393.6456977911481; Tue, 10 Jun 2025 05:46:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGC-000341-Jf; Tue, 10 Jun 2025 08:39:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEk-0001EU-GE for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEi-0000PF-Pa for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:37:54 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-65AaL7fOOGyErpF2aqa6Kg-1; Tue, 10 Jun 2025 08:37:48 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BDD9A19560B8; Tue, 10 Jun 2025 12:37:47 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1691930001B1; Tue, 10 Jun 2025 12:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/ziOtHkbVXRYUSBWCtKwOP17Zb9Et/uXA8AYoC3S5Tg=; b=Tnu7OJlW7IPRzJGhqo76Zb5T7kS0egEYHvjqsbqr6WPvzXyKIGenFXjDm5ZVS1igwjOVJL 9vT7Ra3uckHzdjq9SDlfkVAP27MLxycmHT5Q/VNlc2VkgvDRIjrBdPLa4opERbs8aCXIQI s+Rpw/xMXKL/L6Ihzt7Eq0yJYLpfDn8= X-MC-Unique: 65AaL7fOOGyErpF2aqa6Kg-1 X-Mimecast-MFC-AGG-ID: 65AaL7fOOGyErpF2aqa6Kg_1749559067 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 13/31] hw/audio/via-ac97: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:51 +0100 Message-ID: <20250610123709.835102-14-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559605944116600 The 'out_cb' method has a 4k byte array used for copying data between the audio backend and device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'tmpbuf' array will be fully initialized when reading data from device memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/audio/via-ac97.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index 1e0a5c7398..d5231e1cf2 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -175,7 +175,7 @@ static void out_cb(void *opaque, int avail) ViaAC97SGDChannel *c =3D &s->aur; int temp, to_copy, copied; bool stop =3D false; - uint8_t tmpbuf[4096]; + QEMU_UNINITIALIZED uint8_t tmpbuf[4096]; =20 if (c->stat & STAT_PAUSED) { return; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559196; cv=none; d=zohomail.com; s=zohoarc; b=RiYCWi7oYQ86EhSZ9mGDwkXxykvEZt3jUx6gsWkAz1jJgwKvaCxaJsirHGpeYvTQyqK0g6p1WFKBlggNJWxYP4kVtCWu4TCFCd5M1zl4imtObHusR4IBO1P02uYfkSQOqU5kU8bXNUdOwiRlTqpASEJdihlzLZWP2Sx6e4XnF0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559196; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tftAI8Pw8FmkswakotdIueEty9Z9QAj9034MrjRFBmo=; b=IINocn1wA+r+SOYXTru4rns3DfXb8pDXGGm0arLn0AZ2h+9JMF+iTC8GWwPKTRklwXHLaRgtA44AEBGrOH5eb0js7FikEHJPN1dqQM7e//Z6H7S2bOKnG0t95l+XWov3LtHtAgPeloA07wkArDSiFKIeKE2dtCkrXk04rOErczU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559196719454.05214833660284; Tue, 10 Jun 2025 05:39:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyFn-0002ET-9g; Tue, 10 Jun 2025 08:38:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEr-0001I8-If for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEo-0000Pv-Hf for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:00 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-489-u5-JfgJcP1SeFgLmkYAQEQ-1; Tue, 10 Jun 2025 08:37:51 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B80C1956064; Tue, 10 Jun 2025 12:37:50 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2554530001B1; Tue, 10 Jun 2025 12:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tftAI8Pw8FmkswakotdIueEty9Z9QAj9034MrjRFBmo=; b=CYnXuyCELq/IhPRjPqzA9lAj90fwT917AAmgUyk77WI8U7chc3sr311CJBdSa8aatxedzu +Zsz1/Jj4jGdwK8IZxPQf68U2yOPalVeN5j1uMdF5xprwSZ3T8yuwh+P71LGY5TSxfIlYk C8sMtnRUO5oXcyvlEFaVy4ToxFef+DQ= X-MC-Unique: u5-JfgJcP1SeFgLmkYAQEQ-1 X-Mimecast-MFC-AGG-ID: u5-JfgJcP1SeFgLmkYAQEQ_1749559070 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 14/31] hw/char/sclpconsole-lm: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:52 +0100 Message-ID: <20250610123709.835102-15-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559198658116600 The 'process_mdb' method has a 4k byte array used for copying data between the guest and the chardev backend. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buffer' array will be selectively initialized when data is converted between EBCDIC and ASCII. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/char/sclpconsole-lm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index e9580aacba..3e40d5e434 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -214,7 +214,7 @@ static int process_mdb(SCLPEvent *event, MDBO *mdbo) { int rc; int len; - uint8_t buffer[SIZE_BUFFER]; + QEMU_UNINITIALIZED uint8_t buffer[SIZE_BUFFER]; =20 len =3D be16_to_cpu(mdbo->length); len -=3D sizeof(mdbo->length) + sizeof(mdbo->type) --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559381; cv=none; d=zohomail.com; s=zohoarc; b=i6iCMinpzuBvopPA6EEzPUymSWeqas2w5X33GcpgksijOaiCXdHOTI86I5KpfZR1nvzPprJPeDjX6vGpq71Zy0aNlW/FGZz2vInBv5KOxzS8N8R1IJ58q3guG6Xj8bcrFYnUK+IJ2m+Cp288zgUmBcI8NOCGKq/m7Zaw8CSbkt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559381; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S+Yf/jmV3e4LBvtju25q+/FPCjoN9gPaEwmhnQLwbYw=; b=faLVx13U6RM5ru9+NnTtiixcc87wZev887zNKMDKvQU6ckQGBWijg+twa0x/ufacejxJ/g6AhasbKlF3baIKdM0aH7sjCMWHh1Abkh7mxyCmOpx/HjJJSTmy6PlOwuxyHgdVo4B7wPRnhKwJF7yBXuK1lLHE+0Ju9lN6re/Z2yc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559381653765.394041060555; Tue, 10 Jun 2025 05:43:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyG7-0002fy-BO; Tue, 10 Jun 2025 08:39:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEr-0001I9-IV for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEo-0000Pr-Gz for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:00 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-rTFqMD2WOJOsHV3kkhI31A-1; Tue, 10 Jun 2025 08:37:54 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1938E1809C90; Tue, 10 Jun 2025 12:37:53 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CA05130001B1; Tue, 10 Jun 2025 12:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S+Yf/jmV3e4LBvtju25q+/FPCjoN9gPaEwmhnQLwbYw=; b=hMReCPsqT/DiYNWtjukiF6Bf7UbMcJcKGko36jxWgYGGlUnbJQ1xiPLOGMpENQmAZEywAN MmG06c6zZUQwNJp266lJPl7aEYmoLgRMbY8I441vKL6EFA/dQr7FXHWZN0wPG55yL9Rr3L g2nMEPgPSzfdAEnTJhsXfyCl1VQUzV8= X-MC-Unique: rTFqMD2WOJOsHV3kkhI31A-1 X-Mimecast-MFC-AGG-ID: rTFqMD2WOJOsHV3kkhI31A_1749559073 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 15/31] hw/dma/xlnx_csu_dma: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:53 +0100 Message-ID: <20250610123709.835102-16-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559385193116600 The 'xlnx_csu_dma_src_notify' method has a 4k byte array used for copying DMA data. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when data is copied. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/dma/xlnx_csu_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c index 3db3904d83..d8c7da1a50 100644 --- a/hw/dma/xlnx_csu_dma.c +++ b/hw/dma/xlnx_csu_dma.c @@ -287,7 +287,7 @@ static uint32_t xlnx_csu_dma_advance(XlnxCSUDMA *s, uin= t32_t len) static void xlnx_csu_dma_src_notify(void *opaque) { XlnxCSUDMA *s =3D XLNX_CSU_DMA(opaque); - unsigned char buf[4 * 1024]; + QEMU_UNINITIALIZED unsigned char buf[4 * 1024]; size_t rlen =3D 0; =20 ptimer_transaction_begin(s->src_timer); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559178; cv=none; d=zohomail.com; s=zohoarc; b=DMh6L4pJvnO/asDe7WgCUQ8tf2JDDyvYf49IInfryc6gcIuOEX5obu3Fw8BNl0jtRl8T4sBXFdz9rFktEvcAitOtz57OsDKCF2m3MEn+JMWDfq3tsWyZhjLyvLaRvnyHwNlrno40vpiXJ/9xnhWj85ThRTci4z8w3mA4QcfMxcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559178; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0LwIy6f7hRyD9Dunr4Uz/exdl6L7H3XP7f8rEFJq7V4=; b=C90V6dEzcj7NPtKYtvZqtngTaaBudIuddGcL7evqp2/jJFB/Wo9Y6+nqNxz8kReuFMPPwyJR95m6RVckGUAwEGli0uyGNFVgVK601WpBjlp01aMbxKG8LtEMM3a0U9B092571xz2SPSSbT6PngDq37Z/ola3sUq07rXeqGR4css= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559178906149.69921829377404; Tue, 10 Jun 2025 05:39:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGH-0003Pk-Vf; Tue, 10 Jun 2025 08:39:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEu-0001IO-1s for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEo-0000Q6-Pv for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:01 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-jziFfLzQP_muhCwJixMBrQ-1; Tue, 10 Jun 2025 08:37:56 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 65D3E18089B8; Tue, 10 Jun 2025 12:37:55 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 70E6930001B1; Tue, 10 Jun 2025 12:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LwIy6f7hRyD9Dunr4Uz/exdl6L7H3XP7f8rEFJq7V4=; b=ixCMvR9/cItctAvJdlWPd0QmMQ2n6bXW4DDPWHQY86eSCvEsAUREXhYm0+p5zx2zcaH+E3 i2qWs/UocyR0zoxfU3BobAkW+L4i/YczH4kfXxC/OlmgRaS3soi5QAIW09OaftaCQ6o/Jp dUIXK+UDxFw/q/UnThOmLBQLAm5PJOY= X-MC-Unique: jziFfLzQP_muhCwJixMBrQ-1 X-Mimecast-MFC-AGG-ID: jziFfLzQP_muhCwJixMBrQ_1749559075 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 16/31] hw/display/vmware_vga: skip automatic zero-init of large struct Date: Tue, 10 Jun 2025 13:36:54 +0100 Message-ID: <20250610123709.835102-17-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559180412116600 The 'vmsvga_fifo_run' method has a struct which is a little over 20k in size, used for holding image data for cursor changes. Skip the automatic zero-init of this struct to eliminate the performance overhead in the I/O hot path. The cursor variable will be fully initialized only when processing a cursor definition message from the guest. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/display/vmware_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 544bb65320..bc1a8ed466 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -618,7 +618,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) uint32_t cmd, colour; int args, len, maxloop =3D 1024; int x, y, dx, dy, width, height; - struct vmsvga_cursor_definition_s cursor; + QEMU_UNINITIALIZED struct vmsvga_cursor_definition_s cursor; uint32_t cmd_start; =20 len =3D vmsvga_fifo_length(s); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559317; cv=none; d=zohomail.com; s=zohoarc; b=cHE7aoBg6Ba3xvSCisow6KPMTdErqFDm2fim2iRl7OFZ4z6WV9hjCgTAiDgmcn5faBjTTutp9IwmK90DqntBdLn851LbRsp7wxB4Nr+Esw4T2fSSArS0M2Ovs2+dMN8uvYTsvNPPTYazYZtpaTo7IcitqNtyRAF4pKMe2Gz3V1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559317; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YqfPIljuTinekI8XR0VCo3C+NV5GGVafjw/OiPlNF6g=; b=AlAfGXJfDSHWKH0tw9nlbWnsjyiAdJatFgiF5kV9j6B2yPPa8NMgULRpxn0fQbPijmWOtca9C07vSch1/EPCfsr3FQIpPUWm7VpB/E5Qk6JDe1f62Wpn0vLbg35ad8TopILC52ZXgUfDyMgMnqU2XJ1vJxXPGZXRtakptnw/iiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559317295887.8452982444695; Tue, 10 Jun 2025 05:41:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyHM-0004lZ-Ql; Tue, 10 Jun 2025 08:40:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF4-0001KO-7Z for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyEy-0000Rm-1G for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:11 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-672-pBCpXKm0MR-jMJxc3Lb4Cg-1; Tue, 10 Jun 2025 08:37:59 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF55219560B4; Tue, 10 Jun 2025 12:37:57 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BE74B30001B1; Tue, 10 Jun 2025 12:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YqfPIljuTinekI8XR0VCo3C+NV5GGVafjw/OiPlNF6g=; b=OHs+8O2XoZYJt2CaRoBPMeIk0ip+xlyPg13uxGONhDaOlfN49yGlR9wErOtUWimsFsMCax 3grgHR8KZiMdFko//UpNEvivuVc6bVKASBxWXZzp9vQjD3dycUVN9FTE1XnqQfUFFDAMBb o8nTWIEn8kIHb0BKmonzjtXtMj5tfm4= X-MC-Unique: pBCpXKm0MR-jMJxc3Lb4Cg-1 X-Mimecast-MFC-AGG-ID: pBCpXKm0MR-jMJxc3Lb4Cg_1749559078 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 17/31] hw/hyperv/syndbg: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:55 +0100 Message-ID: <20250610123709.835102-18-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559318308116600 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=C3=A9 Reviewed-by: Stefan Hajnoczi --- 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 8b8a14750d..ac7e15f6f1 100644 --- a/hw/hyperv/syndbg.c +++ b/hw/hyperv/syndbg.c @@ -192,7 +192,7 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint6= 4_t outgpa, { uint16_t ret; g_assert(MSG_BUFSZ >=3D qemu_target_page_size()); - uint8_t data_buf[MSG_BUFSZ]; + QEMU_UNINITIALIZED uint8_t data_buf[MSG_BUFSZ]; hwaddr out_len; void *out_data; ssize_t recv_byte_count; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559440; cv=none; d=zohomail.com; s=zohoarc; b=NMIyiVdzfNcOv23qZQgl9m8p+fH9E3XAhy2rcmnhA8bJAnuS/FPzdOG44IVI+hsbyodOCD8GINd31h2WfrVNm0OY8vWMGlk7+r4WEw5pSBNg/CiEdDgtzkjVlTWG5lVeSI8i3DCu37JodM8hLFhgnuVNeJDnoi5hLyaDnXDOH9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559440; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ee/NYdli3HnqooIdB4tbV7Jm18g0RefMEBG3CfHXwsA=; b=ZAt6arLtO+VvDyThqWXM8yCg5Uw/ElOT37adz9IHKrg+uKKdul8gHLNhHAMp/QufJO43hVX1dYBJPj5jdDC083chHLfGjgtNcQPFiFrN+nYsnpzPxgLnX8ERx7ZUzROH3H5eiUNTkqSl/Rs2kzOKgDwpogicLStXwz4eSPt22+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559440727189.34967971158346; Tue, 10 Jun 2025 05:44:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyIF-0006Um-6K; Tue, 10 Jun 2025 08:41:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF7-0001LV-Nj for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF5-0000SY-91 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:17 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-150-oXORVx7WPg6kd6buYQCEgw-1; Tue, 10 Jun 2025 08:38:03 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5B7BC18002A0; Tue, 10 Jun 2025 12:38:00 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 499B730001B1; Tue, 10 Jun 2025 12:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ee/NYdli3HnqooIdB4tbV7Jm18g0RefMEBG3CfHXwsA=; b=EP3CkNappbbCsSIFhq5TC3qZ6YsXLeP6TumaRBvrIOVezkMPlO9Av5KmcL3JC4rrGNpdw3 DINdkpTK4V0z+WDx4PIuUG7DQLwsUkU2vW3uPjiEKKYhhDeQfEAY6hvnYrs5gJr0OqXOGH B5aZbhji2E3HLcBncc6GmktGzceOLzk= X-MC-Unique: oXORVx7WPg6kd6buYQCEgw-1 X-Mimecast-MFC-AGG-ID: oXORVx7WPg6kd6buYQCEgw_1749559081 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 18/31] hw/misc/aspeed_hace: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:56 +0100 Message-ID: <20250610123709.835102-19-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559441607116600 The 'do_hash_operation' method has a 256 element iovec array used for holding pointers to data that is to be hashed. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'iovec' array will be selectively initialized based on data that needs to be hashed. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/misc/aspeed_hace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c index 8924a30eff..726368fbbc 100644 --- a/hw/misc/aspeed_hace.c +++ b/hw/misc/aspeed_hace.c @@ -419,7 +419,7 @@ static void hash_execute_acc_mode(AspeedHACEState *s, i= nt algo, static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, bool acc_mode) { - struct iovec iov[ASPEED_HACE_MAX_SG]; + QEMU_UNINITIALIZED struct iovec iov[ASPEED_HACE_MAX_SG]; bool acc_final_request =3D false; int iov_idx =3D -1; =20 --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559304; cv=none; d=zohomail.com; s=zohoarc; b=W/mNWgmjaa7yBO4GhHeOZCKG7K7dIKABcwoW+0otrzjBXR0RKqFOsFLSxH6s8n7cUaXBHw0d0Sm+t+m0ecoIqqGw2N+h097ZeYI5qsTtDMyxbkkLKPiYa1faGy6FIlOBBSq5f6TuNqZQoWeMKVDAqJl3NsjxjzPODeTyI7GAJzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559304; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=05Rp8do56FDLhzu6BYsbKFSleLYNMyd+uZsSfKmWg3g=; b=GsH27eqaaHvhuOyniTUr9UY1EYP55A8WPK/DByfBzAw+m8y124I/uVKg2/56zqol7ooesWRgiufh7HKqfkC4ZXVl7F4C78FJx0XrUpJO8SHVgvspg23E797wlE9llwdrhPEx027D/k7yCflou5bxW2CWrHcxV+6XsP2PWiBXTqE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559304473775.1386059383457; Tue, 10 Jun 2025 05:41:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyFi-0001yh-4B; Tue, 10 Jun 2025 08:38:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF4-0001KQ-Gs for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF0-0000SC-GR for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:13 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-j1e-1TtdMem4PdU66htR0Q-1; Tue, 10 Jun 2025 08:38:04 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9FA811809C8F; Tue, 10 Jun 2025 12:38:03 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9ACB30001B1; Tue, 10 Jun 2025 12:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=05Rp8do56FDLhzu6BYsbKFSleLYNMyd+uZsSfKmWg3g=; b=d9QnUqFm4jxNeJmyeitCN1nPp5r++reh7vUmx/3GtvxHjOn2+1ymfkhXF1tNnUoX5fNn7e PFgFohcPSTsY47B8AO7GQZkJO1oRRaXGIHZiHa4Avhv2p1f7U/t9aFcpQs+F63cjCh1RxB 6DCHzMCDay9keVrPH46unkn0YaBeVTQ= X-MC-Unique: j1e-1TtdMem4PdU66htR0Q-1 X-Mimecast-MFC-AGG-ID: j1e-1TtdMem4PdU66htR0Q_1749559083 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 19/31] hw/net/rtl8139: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:57 +0100 Message-ID: <20250610123709.835102-20-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559306018116600 The 'rtl8139_transmit_one' method has a 8k byte array used for copying data between guest and host. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'txbuffer' will be fully initialized when reading PCI DMA buffers. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/net/rtl8139.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 15b8f7501a..654a087d80 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -1816,7 +1816,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int = descriptor) =20 PCIDevice *d =3D PCI_DEVICE(s); int txsize =3D s->TxStatus[descriptor] & 0x1fff; - uint8_t txbuffer[0x2000]; + QEMU_UNINITIALIZED uint8_t txbuffer[0x2000]; =20 DPRINTF("+++ transmit reading %d bytes from host memory at 0x%08x\n", txsize, s->TxAddr[descriptor]); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559183; cv=none; d=zohomail.com; s=zohoarc; b=Z3J0r6782R769SoSwCm4gzFvdhtfhdn2+R/Tp8QhAJ3TwvXHpGesxygUrzbDVA0S062CxLYretkLyn6XtCIUZIyf2xXNZ7jE8j5jyBbbTnS7i8kj83uA+ngKSnKVLCb0bfG4clChs1f08czsPkEmIFuOJbgP+2Ngvtu7ek4HKXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559183; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3jM+VN+gHQskSuZAreLCRgyPz70ZCdlFUMDqaY1jZCo=; b=VFidId/LTZamptIqrufRiqMm3LJsEsgklCVUS/n7a+OGSgy7B3F3ZtAfo/jTS1GsDEmwoLIBExzXQNGrcvG9UBmPJmRh2Nava3LPhD12ZJlj/LniGbSp2p6AKtH6wEAi+gPbpX8ur0TmJ0CjhYkTonq8REMY5Lq2IKCH29jmL+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174955918391740.407105055988836; Tue, 10 Jun 2025 05:39:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyFs-0002KV-FU; Tue, 10 Jun 2025 08:39:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF6-0001Kf-75 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF4-0000Sl-0T for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:15 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-412-8KqAzYCpN6WE324PH92dog-1; Tue, 10 Jun 2025 08:38:07 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 67EB719560A3; Tue, 10 Jun 2025 12:38:06 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 08F6130001B1; Tue, 10 Jun 2025 12:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3jM+VN+gHQskSuZAreLCRgyPz70ZCdlFUMDqaY1jZCo=; b=ZwNryNRj+gXHwvOgJBtHTqA3VzKQSvF0QN3Tg6+c70ncfy/rMOCWqnrD+EVipDKjbS/U6V jBmCjSNagDnWgr5ojBgytxT7dhq2D+zAE1CcP9jDHCbNvMnapcA+YeRwmeCW9bPZVvdULA c2fj75R4cFA7J/cWqtSHvNJLBb0oolI= X-MC-Unique: 8KqAzYCpN6WE324PH92dog-1 X-Mimecast-MFC-AGG-ID: 8KqAzYCpN6WE324PH92dog_1749559086 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 20/31] hw/net/tulip: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:36:58 +0100 Message-ID: <20250610123709.835102-21-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559186424116600 The 'tulip_setup_frame' method has a 4k byte array used for copynig DMA data from the device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when reading data from the device. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/net/tulip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/tulip.c b/hw/net/tulip.c index 63fe513458..319af906c8 100644 --- a/hw/net/tulip.c +++ b/hw/net/tulip.c @@ -629,7 +629,7 @@ static void tulip_setup_filter_addr(TULIPState *s, uint= 8_t *buf, int n) static void tulip_setup_frame(TULIPState *s, struct tulip_descriptor *desc) { - uint8_t buf[4096]; + QEMU_UNINITIALIZED uint8_t buf[4096]; int len =3D (desc->control >> TDES1_BUF1_SIZE_SHIFT) & TDES1_BUF1_SIZE= _MASK; int i; =20 --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559261; cv=none; d=zohomail.com; s=zohoarc; b=ii3VdTSpTF2CgwuNlQSzZWNFeGYhM6+a1Qxuqbj1e8+8uNbeGhRObJmF/V7qg6ucyTItZUuAhHTRvbHqZfihLuOeNB3+N3c6zRXSaEs1U3hdVhZyQ90JEx8Ux7DHoNGIRoKCwX+UHkWkF9gZMEaLY3ftoUw8/0SM4io/ZQm/qZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559261; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+mvDwpNWQ8xeg/LgMN6K7nHPAI9N0u8M0JC8hy7d4No=; b=Ae9O5D13/B5O8kNT9jjVX7zTmwVBDjeFIFYAA+UHZhBtzTu+vzghi35+COXS8KgliqH97NiCcNkwNR5/aDnlMfZdkSjf60XqsK3Ga7Z5ZVbh99h7mwjNJpwZf9AL3v/4ZWOW/XxEndKK2sC9tRMpbj/wlGe/UQpS75ddMKPhRis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559261205861.2453366829479; Tue, 10 Jun 2025 05:41:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGH-0003Od-KN; Tue, 10 Jun 2025 08:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF9-0001Ls-0E for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF7-0000TT-8g for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:18 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-Cv50WpDwM_O_mSiDmcViLg-1; Tue, 10 Jun 2025 08:38:10 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DDAB91808993; Tue, 10 Jun 2025 12:38:08 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C398030001B1; Tue, 10 Jun 2025 12:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+mvDwpNWQ8xeg/LgMN6K7nHPAI9N0u8M0JC8hy7d4No=; b=MD83NSc110eIBteJ+xH4wpfx2Kh6aCUZ0wr0drbzv42QrG2uXes1WLXJTgis6K8B0c/k05 /qf4j22Xh0PvtXnXpr6635ujYdZyAdEib7YsNIn3LAsKCjUEfHtCi8rPTIDTvqBZz/nhyw M/6DD5bHaYdGEumjPaCmjIvZKhLE3kQ= X-MC-Unique: Cv50WpDwM_O_mSiDmcViLg-1 X-Mimecast-MFC-AGG-ID: Cv50WpDwM_O_mSiDmcViLg_1749559089 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 21/31] hw/net/virtio-net: skip automatic zero-init of large arrays Date: Tue, 10 Jun 2025 13:36:59 +0100 Message-ID: <20250610123709.835102-22-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559263412116600 The 'virtio_net_receive_rcu' method has three arrays with VIRTQUEUE_MAX_SIZE elements, which are apprixmately 32k in size used for copying data between guest and host. Skip the automatic zero-init of these arrays to eliminate the performance overhead in the I/O hot path. The three arrays will be selectively initialized as required when processing network buffers. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/net/virtio-net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 221252e00a..eb93607b8c 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1911,9 +1911,9 @@ static ssize_t virtio_net_receive_rcu(NetClientState = *nc, const uint8_t *buf, VirtIONet *n =3D qemu_get_nic_opaque(nc); VirtIONetQueue *q; VirtIODevice *vdev =3D VIRTIO_DEVICE(n); - VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE]; - size_t lens[VIRTQUEUE_MAX_SIZE]; - struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; + QEMU_UNINITIALIZED VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE]; + QEMU_UNINITIALIZED size_t lens[VIRTQUEUE_MAX_SIZE]; + QEMU_UNINITIALIZED struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; struct virtio_net_hdr_v1_hash extra_hdr; unsigned mhdr_cnt =3D 0; size_t offset, i, guest_offset, j; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559195; cv=none; d=zohomail.com; s=zohoarc; b=U7nn/mUYHGJi2Esk8gVH47ExMv+SOYOFIhonvJG6ZzaGHEBs9V6Pl6pisdtYocHRxB2f4fKpTkZ4A4xCKxtzmKi/e9vfIGQ49j4/W7KbTc/icrVbvmuryCXO/qPMciF0EZX/9goqYQgx99YrZq61AIu6YSmX4smLtWT6mwoMaFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559195; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rfv9jyv5YI08M7ggzHxF27WvksZj0F/4HtudRMJKIdw=; b=mq4If+yVhdVWTzcSz3pkCWBqGdEdAIct+8xtXotXS/vYFd0Aoo4bv2Swi3A2tletbP3c2UV9gXTelhJNWXZreoJwzPpOvaO6/WM6izNrM9aassOxrTp5I1A+aor1QcmQsFj3Ie0r5+LbvBxLxb4GL4QmDkM0NAcyiPU1v4Np3TI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559195752611.9503064013686; Tue, 10 Jun 2025 05:39:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyG9-0002u8-50; Tue, 10 Jun 2025 08:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF8-0001Ll-Qo for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyF5-0000T8-VO for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:18 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-139-E2jVuWXQNUiKtzAmXrd6dA-1; Tue, 10 Jun 2025 08:38:12 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 76482195608E; Tue, 10 Jun 2025 12:38:11 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 580FA30001B1; Tue, 10 Jun 2025 12:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rfv9jyv5YI08M7ggzHxF27WvksZj0F/4HtudRMJKIdw=; b=B2oTOGxU71h9sqwVNTYnV7PoF+VEr+FVC3tm/0ZDitp4pavwJkHljAXmsit6RbqCdVslpv X45c0nPWk6mMHoA9Wd5CJQriXsh1CRjP6LBtbW7k+MraZYeumpD3+Ap3AAVH9tbNaiiGzW TtBwoIW81LXK5mSZlRMtA+FyIjimwc0= X-MC-Unique: E2jVuWXQNUiKtzAmXrd6dA-1 X-Mimecast-MFC-AGG-ID: E2jVuWXQNUiKtzAmXrd6dA_1749559091 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 22/31] hw/net/xgamc: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:37:00 +0100 Message-ID: <20250610123709.835102-23-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559198654116600 The 'xgmac_enet_send' method has a 8k byte array used for copying data between guest and host. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'frame' buffer will be fully initialized when reading guest memory to fetch the data to send. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/net/xgmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c index 9c87c4e70f..d45f872467 100644 --- a/hw/net/xgmac.c +++ b/hw/net/xgmac.c @@ -207,7 +207,7 @@ static void xgmac_enet_send(XgmacState *s) struct desc bd; int frame_size; int len; - uint8_t frame[8192]; + QEMU_UNINITIALIZED uint8_t frame[8192]; uint8_t *ptr; =20 ptr =3D frame; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559831; cv=none; d=zohomail.com; s=zohoarc; b=eLFb9CRwp3oXSB9RsYU4eobmk1GKyWab17STOeArbFNTRA6f0p0gxd7CvCFBT+dg5FWYmm0N+rf03WQ883ZiRwwYa3hlTvLjBzbh3zr4r16GHhvjKj/NFDwVhgCL4RVTFro/O9qSNCsjmqXXCf+YdThoUGIA1E6vA7VwWo6KoxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559831; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=toEkH1s5f8vci1RuoAYo3gtCYWNbPS0arYGBo09vN/A=; b=QCLRC147QPvEsSB7r3sI5RlwApVotcATE1+VolPp5MnDiocP7vJwW0Wt2EK3EH6UnczPXaTMjdsjlDAJwevXI/maHH3Cd9UZnWRp/rR1AYuj8kvQ5YNuvrPITPyLDQphhvJOxEn1IGhIk3aWi43sW7qhd4xmOj8nEtN/6IjZ80U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559831892258.45179821776446; Tue, 10 Jun 2025 05:50:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGD-00038q-C7; Tue, 10 Jun 2025 08:39:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFU-0001bD-6M for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFJ-0000Ub-A4 for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:36 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-SNu3Yd67OuatdxZ3En6zqA-1; Tue, 10 Jun 2025 08:38:15 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 82CC418089B4; Tue, 10 Jun 2025 12:38:14 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CDAC930001B1; Tue, 10 Jun 2025 12:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=toEkH1s5f8vci1RuoAYo3gtCYWNbPS0arYGBo09vN/A=; b=MMwx+L6wavSVMyhu7CR3bqqOXiX4332CJMCbqFDjPZVxLk6wY9NDhLdXpSvx1RzouNLOoq Xm+w3kyYaS+a9L30QofLfcxRFpGH5v9ATZD9dc65NY6kgDTUYgnDQMBKs16D8sM0xhHs/v 7D/TA9GpSAU0p8TMDtcOprs+hXmh3mU= X-MC-Unique: SNu3Yd67OuatdxZ3En6zqA-1 X-Mimecast-MFC-AGG-ID: SNu3Yd67OuatdxZ3En6zqA_1749559094 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 23/31] hw/nvme/ctrl: skip automatic zero-init of large arrays Date: Tue, 10 Jun 2025 13:37:01 +0100 Message-ID: <20250610123709.835102-24-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559832744116600 The 'nvme_map_sgl' method has a 256 element array used for copying data from the device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'segment' array will be fully initialized when reading data from the device. The 'nme_changed_nslist' method has a 4k byte array that is manually initialized with memset(). The compiler ought to be intelligent enough to turn the memset() into a static initialization operation, and thus not duplicate the automatic zero-init. Replacing memset() with '{}' makes it unambiguous that the array is statically initialized. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Klaus Jensen Reviewed-by: Stefan Hajnoczi --- hw/nvme/ctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fd935507bc..220002830d 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -1057,7 +1057,8 @@ static uint16_t nvme_map_sgl(NvmeCtrl *n, NvmeSg *sg,= NvmeSglDescriptor sgl, */ #define SEG_CHUNK_SIZE 256 =20 - NvmeSglDescriptor segment[SEG_CHUNK_SIZE], *sgld, *last_sgld; + QEMU_UNINITIALIZED NvmeSglDescriptor segment[SEG_CHUNK_SIZE]; + NvmeSglDescriptor *sgld, *last_sgld; uint64_t nsgld; uint32_t seg_len; uint16_t status; @@ -5128,7 +5129,7 @@ static uint16_t nvme_error_info(NvmeCtrl *n, uint8_t = rae, uint32_t buf_len, static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf= _len, uint64_t off, NvmeRequest *req) { - uint32_t nslist[1024]; + uint32_t nslist[1024] =3D {}; uint32_t trans_len; int i =3D 0; uint32_t nsid; @@ -5138,7 +5139,6 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint= 8_t rae, uint32_t buf_len, return NVME_INVALID_FIELD | NVME_DNR; } =20 - memset(nslist, 0x0, sizeof(nslist)); trans_len =3D MIN(sizeof(nslist) - off, buf_len); =20 while ((nsid =3D find_first_bit(n->changed_nsids, NVME_CHANGED_NSID_SI= ZE)) !=3D --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559433; cv=none; d=zohomail.com; s=zohoarc; b=AI6d5nMWhYaUN4JJHCK62wksIWXe/k/0y5vZ9yFf7YI//f8ZpAxzziX9vMA1jWpwO1/hTM7Z4dGs2EYTKkJat61k1iFo6a6xfaGtCCTbzP5+yReOqIH8kcF4c7BB7nT+wQSTcwzxHRIdlIADyW2lO7YQx/pafStr2qaAEpyVHN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559433; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p+0Eft3NobaxXmgzhgvpihtVhtXWvVKbDm3yOkpCWVY=; b=JnF0rF5vujRdzb8EzoqcDnXR5SA1g4AMoi16cTkCCusV+jCFKcVgCG4GfFYnUJo4Uaegoczel52bWzIaL0GRleu0Q1Nj3Jx4R8t10nWo6BvZ/eqx3+hVQ6COvPJ5KMfqyP/TcDxnsuVa3QGVndS2yNqx2Zi1RlBQ6/lmg4YW7Jg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559433537497.0833123486891; Tue, 10 Jun 2025 05:43:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyHO-0004wI-Fr; Tue, 10 Jun 2025 08:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFW-0001bh-UC for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFT-0000Uo-Uh for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:42 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-182-gcrg2fn-N9OQwRe-miZAqg-1; Tue, 10 Jun 2025 08:38:18 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1E4EA195606A; Tue, 10 Jun 2025 12:38:17 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F278930001B1; Tue, 10 Jun 2025 12:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+0Eft3NobaxXmgzhgvpihtVhtXWvVKbDm3yOkpCWVY=; b=SMsMuwbxi1BTTccBnfKt5N/O4NYQXqarw/8LSYuOyj6mVZ/Vt27DdjL44QXGX5kEzpOGyi oj/HEYiJU3p8XGdV+HRsH5JmR7ZGnufjbQLbOpS/uoz7M4lprGTXu4zqgcRNB8PKwM7ZTw Hp2mXd+rYKugKBsqJsrYSHwXcuUvLr0= X-MC-Unique: gcrg2fn-N9OQwRe-miZAqg-1 X-Mimecast-MFC-AGG-ID: gcrg2fn-N9OQwRe-miZAqg_1749559097 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 24/31] hw/ppc/pnv_occ: skip automatic zero-init of large struct Date: Tue, 10 Jun 2025 13:37:02 +0100 Message-ID: <20250610123709.835102-25-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559435501116600 The 'occ_model_tick' method has a 12k struct used for copying data between guest and host. Skip the automatic zero-init of this struct to eliminate the performance overhead in the I/O hot path. The 'dynamic_data' buffer will be fully initialized when reading data from the guest. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Harsh Prateek Bora Reviewed-by: Stefan Hajnoczi --- hw/ppc/pnv_occ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c index fa6f31cb8d..24b789c191 100644 --- a/hw/ppc/pnv_occ.c +++ b/hw/ppc/pnv_occ.c @@ -789,7 +789,7 @@ static bool occ_opal_process_command(PnvOCC *occ, =20 static bool occ_model_tick(PnvOCC *occ) { - struct occ_dynamic_data dynamic_data; + QEMU_UNINITIALIZED struct occ_dynamic_data dynamic_data; =20 if (!occ_read_dynamic_data(occ, &dynamic_data, NULL)) { /* Can't move OCC state field to safe because we can't map it! */ --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559267; cv=none; d=zohomail.com; s=zohoarc; b=SEv+gmFQppdf7NkfBk20sPaC6GeSCrNKQAphaNNaGudmUIrbLT2OgjcvjuVCCJmEkQFyvsB3FX9CSwKTSVaKAA3zShF+QRoxjPERIxUiLxsnXGMlkYz6Y0RTu+RDXzs/9x4UTcGfD8gvirQYZoyRUKeFKwzurHzQNcIaqZLoWnA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559267; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fcKc7mPq03c9SlEVtawb5OFfJPbW/Em16y1fOBmMvWI=; b=lep19/DUJF9DVNnCfyOzCLXhG8a5CuuFsvz53iGni+ZWYJDR9xBAvavXpee9lYgfpT1KHxv3DFAiCCngThwlc8uHDbI9Monn5ROiNrjNYgzJiXbfWLDd8v9GwOGnBUyb9qy4HI6e3iNhHOiSYhfiQe6i7KitvkhGE94WfWnlA20= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559267943517.9934754188026; Tue, 10 Jun 2025 05:41:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyG8-0002nQ-AQ; Tue, 10 Jun 2025 08:39:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFb-0001gB-Eo for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFU-0000V6-0F for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:46 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-oITOk2dYP9a3cd7zyS7GEQ-1; Tue, 10 Jun 2025 08:38:20 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D1DD81956059; Tue, 10 Jun 2025 12:38:19 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 889CE30001B1; Tue, 10 Jun 2025 12:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fcKc7mPq03c9SlEVtawb5OFfJPbW/Em16y1fOBmMvWI=; b=EAiY9yQSP6Qn3Cyuc30yXmDOeTbgDlxazgyrwtp1x+7uVrvjdkeeqEc70Ma33WrHzJ0RLZ a0JJqxvVDF84B/j1WmAKC2l/oKYYN4UplQJbL4v/bOulacVLonc/tnVQBV455RyjcEe1BD 7uUInZJ+PBCNma7QeRNYpKkc2Ufde9M= X-MC-Unique: oITOk2dYP9a3cd7zyS7GEQ-1 X-Mimecast-MFC-AGG-ID: oITOk2dYP9a3cd7zyS7GEQ_1749559099 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 25/31] hw/ppc/spapr_tpm_proxy: skip automatic zero-init of large arrays Date: Tue, 10 Jun 2025 13:37:03 +0100 Message-ID: <20250610123709.835102-26-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559269653116600 The 'tpm_execute' method has a pair of 4k arrays used for copying data between guest and host. Skip the automatic zero-init of these arrays to eliminate the performance overhead in the I/O hot path. The two arrays will be fully initialized when reading data from guest memory or reading data from the proxy FD. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Harsh Prateek Bora Reviewed-by: Stefan Hajnoczi --- hw/ppc/spapr_tpm_proxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_tpm_proxy.c b/hw/ppc/spapr_tpm_proxy.c index 862eeaa50a..1297b3ad56 100644 --- a/hw/ppc/spapr_tpm_proxy.c +++ b/hw/ppc/spapr_tpm_proxy.c @@ -41,8 +41,8 @@ static ssize_t tpm_execute(SpaprTpmProxy *tpm_proxy, targ= et_ulong *args) target_ulong data_in_size =3D args[2]; uint64_t data_out =3D ppc64_phys_to_real(args[3]); target_ulong data_out_size =3D args[4]; - uint8_t buf_in[TPM_SPAPR_BUFSIZE]; - uint8_t buf_out[TPM_SPAPR_BUFSIZE]; + QEMU_UNINITIALIZED uint8_t buf_in[TPM_SPAPR_BUFSIZE]; + QEMU_UNINITIALIZED uint8_t buf_out[TPM_SPAPR_BUFSIZE]; ssize_t ret; =20 trace_spapr_tpm_execute(data_in, data_in_size, data_out, data_out_size= ); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559449; cv=none; d=zohomail.com; s=zohoarc; b=PDk6leu6UwH/GAPzgsMppyhygzry2X8L3afq5zODZAE9jB1lVvFpy4Aa7JmKzt7AsGzyo1aEopVINl4pUeeeZU2u0rJ5ucFl4Kfcwuhd1O8VvW6/L+CNn3CYyr/zw7CJIOf3IiWD3dvheslX2UNcRrRXOtfD2txZjWkkYJ/dgdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559449; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QkAVWBPN1XXg4ujBgWif1bxqLQ8Q6MO5spMflk0PHuo=; b=bj86utmTiTyemh0tNW+r0RshCp1yVtlsT7dlu4JFs8jw1WFMP7WyL54HZ2CHPNb40YEvCKIJ6WMBqCH6mjnXu2JbAdtpjNWOyePkrMSgoBi9vOFg4YWRHaZ3MjZ3AcnRc1VS6iO3YVb1GzhX/s+ah3HU8h99urQTBhx3SG69q9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559449839774.0403136685001; Tue, 10 Jun 2025 05:44:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyHg-0005lW-ON; Tue, 10 Jun 2025 08:40:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFc-0001jK-AH for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFU-0000VL-Fo for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-577-bgvBChAUOrOwAXKU7xkZtQ-1; Tue, 10 Jun 2025 08:38:23 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5D6C718002A1; Tue, 10 Jun 2025 12:38:22 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 35EDB30001B1; Tue, 10 Jun 2025 12:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QkAVWBPN1XXg4ujBgWif1bxqLQ8Q6MO5spMflk0PHuo=; b=f8qrNA2Jhd2t42w0FfXZ15PpWSKVi0JV+ytMe+zhXGxbvSVoU45+MI4vhCttQrNwoL/ISB IZeO5zXi9p45V8AiexqqWnDkCPBy3wVv9E4PJNZ2TlAEqAuYsNplepZNj341lG+dsUWcGo ItqBvF7yWahnaoxJMtFL4NSA0FW+pXc= X-MC-Unique: bgvBChAUOrOwAXKU7xkZtQ-1 X-Mimecast-MFC-AGG-ID: bgvBChAUOrOwAXKU7xkZtQ_1749559102 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 26/31] hw/usb/hcd-ohci: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:37:04 +0100 Message-ID: <20250610123709.835102-27-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559455846116600 The 'ohci_service_iso_td' method has a 8k byte array used for copying data between guest and host. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when reading data from guest memory. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/usb/hcd-ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 71b54914d3..72a9f9f474 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -577,7 +577,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct = ohci_ed *ed) USBDevice *dev; USBEndpoint *ep; USBPacket *pkt; - uint8_t buf[8192]; + QEMU_UNINITIALIZED uint8_t buf[8192]; bool int_req; struct ohci_iso_td iso_td; uint32_t addr; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559308; cv=none; d=zohomail.com; s=zohoarc; b=EIOwZi0PkXdmQrSVBdLovH+l44hkQXf4PFwuU3KsqNvxvT8t3yIZ+NakG6vzAxkvmtdIUtqQXYLYJSbaZLGJsrzC76Fop4lpf4XkQ81uk67tXZ0+DVGpGT6iHvT1Rsn4KNhG7Nj6zYL3RyRt3TE9HB/b6aqlj8a7PY4tXSyBRtg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559308; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eRb8u3MCQzztN/Eso5RxlBL5Gee0g9LlE7ej57jd6yU=; b=dcV/Cxaa6aCTIRv35Zd1iJzYRHhvwDCqaOqszFk+mKRa6fLvxRnWWBo1o4/i1sfq+msFqMXTPwo2FO1hUV/Nq65JTLGkBcfjJIweBeQIj5Km6QfRMSiR0VQvcy8ZX0wRWjiu07vLHvd/Tgwf6OEiDDWrcEzuEENiaVZFks826jw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559308250500.9659745477537; Tue, 10 Jun 2025 05:41:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGH-0003Oc-KT; Tue, 10 Jun 2025 08:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFZ-0001dz-Lc for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFU-0000VQ-DX for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:45 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-VcCG9XT4M4aUA_Efeonrxw-1; Tue, 10 Jun 2025 08:38:25 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B5EE3195608C; Tue, 10 Jun 2025 12:38:24 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B5FF430002CC; Tue, 10 Jun 2025 12:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eRb8u3MCQzztN/Eso5RxlBL5Gee0g9LlE7ej57jd6yU=; b=UiiHBL3VLXEZU2ETZpULZJknOZZOAiHf2bruHVoX1Elx3kcTlL5zkUFDLFKnQpidkiz6/K YLoQe1zBZYRpsrh0kBMxZmoi4a7AQp1gNvln++PlQiMW6pYc5LWCiplijdSkQqy1ORIBtr HN+mNBDC6ilsqZyeGTLykgPWOUG9TLo= X-MC-Unique: VcCG9XT4M4aUA_Efeonrxw-1 X-Mimecast-MFC-AGG-ID: VcCG9XT4M4aUA_Efeonrxw_1749559104 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 27/31] hw/scsi/lsi53c895a: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:37:05 +0100 Message-ID: <20250610123709.835102-28-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559310071116600 The 'lsi_memcpy' method has a 4k byte array used for copying data to/from the device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf' array will be fully initialized when data is copied. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/scsi/lsi53c895a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index f4f2ef321e..9ea4aa0a85 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -1112,7 +1112,7 @@ bad: static void lsi_memcpy(LSIState *s, uint32_t dest, uint32_t src, int count) { int n; - uint8_t buf[LSI_BUF_SIZE]; + QEMU_UNINITIALIZED uint8_t buf[LSI_BUF_SIZE]; =20 trace_lsi_memcpy(dest, src, count); while (count) { --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559821; cv=none; d=zohomail.com; s=zohoarc; b=kQ/jDLB8f6irMLwXasd+Y6z/oWP9kNwtABrLjDf59MGRNOAFy+fbT95Hk4saOsudEUduJRhfHZnQgZupgVP1T4/rgKorWxhS50vyN8SMJpIOrqJMbxGhbWXX+/aylD4p3VBpbLzT4H3ErxTbJ35LOA2ngSGtKqnJCOH7hkXEMpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559821; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dkga8yAxiWPTDYq3QtvpHFdSuxxC+fBow6wIf0iWCMg=; b=nB2FqTg3d/aK1K6FGyQyNj6JDEAh7apfeLtXiCBJXnDAkWVg7pL22doZ7BAdndqvTfTfLF6qJ2pQujMJSJdwIAO1hPueJNEXfMUPhNvTLYGtKIcH4zE0OA3Vj9phLYKxM0rLUw9/MTRRAv/oviEHCFburCm2B3Oyvduvp3wg1zs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559821224229.64032343433018; Tue, 10 Jun 2025 05:50:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGA-00030h-Mv; Tue, 10 Jun 2025 08:39:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFb-0001gG-Ep for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFU-0000Vs-EQ for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:46 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-599-CM_Ref_OPC6CQIIjVjX5cw-1; Tue, 10 Jun 2025 08:38:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 500821800292; Tue, 10 Jun 2025 12:38:27 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2001030001B1; Tue, 10 Jun 2025 12:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dkga8yAxiWPTDYq3QtvpHFdSuxxC+fBow6wIf0iWCMg=; b=h5Dl9WcAbkdZgoIWmXjxbKJPzboE/tXt+nwvXva+NMzf8tDhuUDunvJ/tTfUz62bjOco0x IHJztXsM3UFVRIYsWDB8/fJkMgWmdEgLqtBnjBZ9rS3kcEKwE2fvaRw5lIzci99QRAM8cr ABHl1zVwinWsQyxrpSkI7QOO3ubHE+A= X-MC-Unique: CM_Ref_OPC6CQIIjVjX5cw-1 X-Mimecast-MFC-AGG-ID: CM_Ref_OPC6CQIIjVjX5cw_1749559107 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 28/31] hw/scsi/megasas: skip automatic zero-init of large arrays Date: Tue, 10 Jun 2025 13:37:06 +0100 Message-ID: <20250610123709.835102-29-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559822623116600 The 'megasas_dcmd_pd_get_list' and 'megasas_dcmd_get_properties' methods have 4k structs used for copying data from the device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'info' structs are manually initialized with memset(). The compiler ought to be intelligent enough to turn the memset() into a static initialization operation, and thus not duplicate the automatic zero-init. Replacing memset() with '{}' makes it unambiguous that the arrays are statically initialized. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/scsi/megasas.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 55cd188bd5..844643d916 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -981,13 +981,11 @@ static int megasas_event_wait(MegasasState *s, Megasa= sCmd *cmd) =20 static int megasas_dcmd_pd_get_list(MegasasState *s, MegasasCmd *cmd) { - struct mfi_pd_list info; - size_t dcmd_size =3D sizeof(info); + struct mfi_pd_list info =3D {}; BusChild *kid; uint32_t offset, dcmd_limit, num_pd_disks =3D 0, max_pd_disks; dma_addr_t residual; =20 - memset(&info, 0, dcmd_size); offset =3D 8; dcmd_limit =3D offset + sizeof(struct mfi_pd_address); if (cmd->iov_size < dcmd_limit) { @@ -1429,11 +1427,10 @@ static int megasas_dcmd_cfg_read(MegasasState *s, M= egasasCmd *cmd) =20 static int megasas_dcmd_get_properties(MegasasState *s, MegasasCmd *cmd) { - struct mfi_ctrl_props info; + struct mfi_ctrl_props info =3D {}; size_t dcmd_size =3D sizeof(info); dma_addr_t residual; =20 - memset(&info, 0x0, dcmd_size); if (cmd->iov_size < dcmd_size) { trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size, dcmd_size); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559639; cv=none; d=zohomail.com; s=zohoarc; b=K9Zb8so3xZm4NfytzM+UJFd9RUmsxXJgyWKwtcrRTk3pGLuS0+rbiLnRL9h3P4YComkZ7tqvjsv5XrQDvsX5PANkuNEoeVOYrfM+T2ZvPuEnCZlqpOTWbUVypBnIhq/pRj3VSffWHQlXDhIHCWZUhmWh4cQ++8fjZogg/NJyYCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559639; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZtMFfR2rIM8+w49Udli+zdZnhzzgLyZSSJ/EWWNppMo=; b=ELXdLktoABgT/RFPq7o/DU5sTDcd911NaB8OuxvsS1MPlim9aGCaT/K3ofJu+49i4Ub8OJhr3Z2qikQJY5e5FAEUaw0Iaa+bVXJOknoustqqoXEiMuE2SelLxyfNIKnWoUXXE5It74U3tFTaGN27zO2JixKWUzG8xRnfVTs0E6I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559639038264.89509243640794; Tue, 10 Jun 2025 05:47:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyHT-0005KW-Bv; Tue, 10 Jun 2025 08:40:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFY-0001dn-EI for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFT-0000WT-UX for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:43 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-d50v6Yj9PLKjZL8mcgd_qw-1; Tue, 10 Jun 2025 08:38:32 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C834719560AD; Tue, 10 Jun 2025 12:38:30 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C405830002C4; Tue, 10 Jun 2025 12:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZtMFfR2rIM8+w49Udli+zdZnhzzgLyZSSJ/EWWNppMo=; b=MfQ/QQXWmQLypIw4544c4Q8hGz/7E5brUtfdmEW3pv8QJ67wRY5HY22ZAArppb0G8y4VI7 kNA3aVAjTRAMLGqq68uWnF8lNoT7tSauK0O8D0Aj0aTppNSZFrq7eSDFOlyzymS2D5FOOH 62t5U94xhm1Ty3kl1CcJ7Rn6woE7DrI= X-MC-Unique: d50v6Yj9PLKjZL8mcgd_qw-1 X-Mimecast-MFC-AGG-ID: d50v6Yj9PLKjZL8mcgd_qw_1749559110 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 29/31] hw/ufs/lu: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:37:07 +0100 Message-ID: <20250610123709.835102-30-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559640544116600 The 'ufs_emulate_scsi_cmd' method has a 4k byte array used for copying data from the device. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'outbuf' array will be fully initialized when data is copied from the guest. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/ufs/lu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ufs/lu.c b/hw/ufs/lu.c index 57b307ea56..2d8ffd72c5 100644 --- a/hw/ufs/lu.c +++ b/hw/ufs/lu.c @@ -194,7 +194,7 @@ static int ufs_emulate_wlun_inquiry(UfsRequest *req, ui= nt8_t *outbuf, static UfsReqResult ufs_emulate_scsi_cmd(UfsLu *lu, UfsRequest *req) { uint8_t lun =3D lu->lun; - uint8_t outbuf[4096]; + QEMU_UNINITIALIZED uint8_t outbuf[4096]; uint8_t sense_buf[UFS_SENSE_SIZE]; uint8_t scsi_status; int len =3D 0; --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559497; cv=none; d=zohomail.com; s=zohoarc; b=SsWSsuU5WiLRlA24VIJDGS8KCpdIQw82Awl2VzVrwQc8Ca5C+FCJTVGOTbl79JkBDVqslPvKanTJZo2SYLCmSgOncvMeU2uXQhz6EyRS9u5H2dF60lmjtobSgcHpgIsqGZTg0DLf2dmLmdZu0q8ipgyvu9pxFSGVlqzQgUKQ7kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559497; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=X9O7EQZ8JqxG/dF5TklEeju/NAutOcHOWcAgU5zsnSs=; b=AJeGQJv7txcJQe9KPUlZzYbK1Yk7/MCw/r41hmGqYY9nv7EH52Rp4zWHhdEnOeZD4w7jgUgpuv2E0YI2GTpExG2O7pwlBRH/dN+7LdKMr0luud03ITLAo2wm0/fKYrutiPYvyWthTDVaegaNEKHelIvmo7mNT4yVqy5TZXSR75I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559497909211.34110978132082; Tue, 10 Jun 2025 05:44:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyGE-0003EU-M9; Tue, 10 Jun 2025 08:39:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFc-0001il-8y for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFU-0000Wo-FK for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:47 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-693-Jw33HruPOKOo6fKMwq-I5g-1; Tue, 10 Jun 2025 08:38:34 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B8B7F1800282; Tue, 10 Jun 2025 12:38:33 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4537E30001B1; Tue, 10 Jun 2025 12:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X9O7EQZ8JqxG/dF5TklEeju/NAutOcHOWcAgU5zsnSs=; b=D8HLzVmSudXjzIqPlJ1kAVUcpbzBqhiSoN1GKseMF5H5HfkHaEIx/Mo5JqwfG1fVA+avHN xo0v0V5ls1QCPLJdqvlCjnErEE+e3l4BRKqCHFiyonjSg7NuLgZzLrAH0GQ5kVkG8ql0Y0 rS6Mw5WHiBuTt6iLlgAJzbKTJ6w5uaY= X-MC-Unique: Jw33HruPOKOo6fKMwq-I5g-1 X-Mimecast-MFC-AGG-ID: Jw33HruPOKOo6fKMwq-I5g_1749559113 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 30/31] net/socket: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:37:08 +0100 Message-ID: <20250610123709.835102-31-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559500653116600 The 'net_socket_send' method has a 68k byte array used for copying data between guest and host. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf1' array will be fully initialized when reading data off the network socket. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/socket.c b/net/socket.c index 8e3702e1f3..784dda686f 100644 --- a/net/socket.c +++ b/net/socket.c @@ -157,7 +157,7 @@ static void net_socket_send(void *opaque) NetSocketState *s =3D opaque; int size; int ret; - uint8_t buf1[NET_BUFSIZE]; + QEMU_UNINITIALIZED uint8_t buf1[NET_BUFSIZE]; const uint8_t *buf; =20 size =3D recv(s->fd, buf1, sizeof(buf1), 0); --=20 2.49.0 From nobody Sat Nov 15 16:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1749559830; cv=none; d=zohomail.com; s=zohoarc; b=PcPqfuEeOdq8QA3pwfNSeh/pxDiurwZNX3FtEAaS4UV0g/+/Q9nJ3Rg/xih6KySxDYxBy0UJw+Rlb1yF69LwmgKaz86/FfvpzyE+9D+DGn3IawoJpRTjYziBe7FpJf8RfozDSjPJHjE7tajOFwiDNb0xSe+GxXP7kg9ylh/bmw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749559830; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oGypf2u8pdp+ikSV2686WPuH3+TdY66joI3UN6jycPY=; b=QPJ5Tk/cfJvfl0zY19Z8H2zhI5IBJlyVqltRUwVrqNsmLYO0AJGTufctZY6Z8XWQoIYrAp2YKfqnB9gwob9Gx848bRwPKzzOqzvVZObSGpT7gPi1ylzvjbH1CbVbwyS97IjSF1aazWW7CCs/nf4NsuTJq77BTNrbNpl9GTjm6mY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749559830490153.32502017538854; Tue, 10 Jun 2025 05:50:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uOyHl-00060h-43; Tue, 10 Jun 2025 08:41:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFd-0001nY-Iz for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOyFV-0000XD-IV for qemu-devel@nongnu.org; Tue, 10 Jun 2025 08:38:49 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-fEp7_zIyNQW4Y1bmDN33DQ-1; Tue, 10 Jun 2025 08:38:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7F8E319560B0; Tue, 10 Jun 2025 12:38:36 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.87]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 22C4E30002C4; Tue, 10 Jun 2025 12:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749559120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGypf2u8pdp+ikSV2686WPuH3+TdY66joI3UN6jycPY=; b=buUY16LIjXx7BRVNz8tSWLKk+o5rfOyLJm1Twaeg5JPY2J6iLPXs7mtX93pXl05hIQpq3T RuknIie2uiZZIUn4iBIfdRRw9y8VjObBR+jmtlJusP0XCQvinyi1VVprvqFTxUJZRwuWpl JmsTvKLli+/YcYoMf2gI94Bg5MtDXug= X-MC-Unique: fEp7_zIyNQW4Y1bmDN33DQ-1 X-Mimecast-MFC-AGG-ID: fEp7_zIyNQW4Y1bmDN33DQ_1749559116 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Peter Maydell , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 31/31] net/stream: skip automatic zero-init of large array Date: Tue, 10 Jun 2025 13:37:09 +0100 Message-ID: <20250610123709.835102-32-berrange@redhat.com> In-Reply-To: <20250610123709.835102-1-berrange@redhat.com> References: <20250610123709.835102-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1749559832724116600 The 'net_stream_send' method has a 68k byte array used for copying data between guest and host. Skip the automatic zero-init of this array to eliminate the performance overhead in the I/O hot path. The 'buf1' array will be fully initialized when reading data off the network socket. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Hajnoczi --- net/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/stream.c b/net/stream.c index 4de5613844..6152d2a05e 100644 --- a/net/stream.c +++ b/net/stream.c @@ -148,7 +148,7 @@ static gboolean net_stream_send(QIOChannel *ioc, NetStreamState *s =3D data; int size; int ret; - char buf1[NET_BUFSIZE]; + QEMU_UNINITIALIZED char buf1[NET_BUFSIZE]; const char *buf; =20 size =3D qio_channel_read(s->ioc, buf1, sizeof(buf1), NULL); --=20 2.49.0