From nobody Thu Dec 18 01:17:30 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696477718; cv=none; d=zohomail.com; s=zohoarc; b=VNA//6kSUBJ1YTWEdpAIhqN+CQRmMTeSnkcp3gAfU+oDBl7frMj30Z8O/3Oj07iDcU4gaxrQDCuSGZTdsS4QGns7Z++uMy0+nHXd1PY7EZQKnWWJ3oIgUwcWy6GOaw1j+fQlGyomwgmXn0fa9/+63QK15YU/TewMUjtlEPsjous= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696477718; h=Content-Type: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=FYiqXRxzTWfTn4i/+SBced8bQTg6zrqu/s2l3fD1Gks=; b=D+hzMKWRBsa4UMzjE5UBuSAzGaqpfthzDqr+mQctrmcQBXPm2lWxhh8f5GXs0+Gp5/8DtPeq395D+r7HxVGEqVEdQVEx6KSKzoufqvlBMwO9RLGkcXLLSLoKeFMwqWWRb7wQrm7akB9or6wLBC5Jsnj82sHnisIw/9jodZlz7qs= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696477718093797.2566904107834; Wed, 4 Oct 2023 20:48:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoFJP-0000fT-GE; Wed, 04 Oct 2023 23:46:07 -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 1qoFJL-0000Xo-JG for qemu-devel@nongnu.org; Wed, 04 Oct 2023 23:46:03 -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 1qoFJG-0000pS-2q for qemu-devel@nongnu.org; Wed, 04 Oct 2023 23:46:03 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-ZLW1vzwmOhGlw1RK5w49Dw-1; Wed, 04 Oct 2023 23:45:45 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40647c6f71dso4316005e9.2 for ; Wed, 04 Oct 2023 20:45:45 -0700 (PDT) Received: from redhat.com ([2.52.137.96]) by smtp.gmail.com with ESMTPSA id bd5-20020a05600c1f0500b004030e8ff964sm2815082wmb.34.2023.10.04.20.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 20:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696477556; 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: in-reply-to:in-reply-to:references:references; bh=FYiqXRxzTWfTn4i/+SBced8bQTg6zrqu/s2l3fD1Gks=; b=U807K68wy35vvmChWOFaV85rxASauTY/WwOQMKEv3oSN2NGEfyHLVMcXsy3RRI5H49WcIM tSHGpjPbPzizAvcbAxKm/Fqm3peGD6zqRN7/UPSmkvFM+RtfoXAfJcr80eezVCpF/BYfer z2+3+yii3/bwdy27Ong/7EcmEbxcX4o= X-MC-Unique: ZLW1vzwmOhGlw1RK5w49Dw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696477543; x=1697082343; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FYiqXRxzTWfTn4i/+SBced8bQTg6zrqu/s2l3fD1Gks=; b=PQn5jMtA6rkis1x058qQf1U/BCqTiR32VFg6B1LXhI9uVYKukm14B5SUOnHlI5hUWs ers+/qFMRdGNK6Vu8pg5SclwTbopYtm/WOZDIi6pEMwPterPe+UQTffGcUOG7TnqmASx JYaLAuGh3U5W7shfOImp6EAPqy+t6MeFeZ0GsyKH1WIIezi20tyJym2yWYP/13tYv8sX Y3WVtDZ7t+r+pmcm8lWSm8mK2W++rbM4u2bthBuhwj31N1e0+N4hpyE5L2z/Um/GkTae LUwgT93m4nW57EuhvbZEt36NUdZnQQYSWcCS/dU5E+7KOXpk9xS/CmE9qPuNA+BTaiGn 86fw== X-Gm-Message-State: AOJu0YxxYpwbe5AgEbFe0JJ0mgrLf5kIzzvWhtZmb120anBcJJAbySYn M1Pb4dxr2i0w5tdP5Zhmv7MTAKfNKPULEHzI8efdNIgoeR4TUIxMfMYGsE8tRm1rHQAQCioqs3i +w8TsIP64rGeouA6KL9O4k/CfYPiZWiof4pscQezde42XwSV55medUU4PtEOBtOrpvvlG X-Received: by 2002:a05:600c:ac4:b0:406:599f:f934 with SMTP id c4-20020a05600c0ac400b00406599ff934mr3961237wmr.12.1696477543557; Wed, 04 Oct 2023 20:45:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFftP7lgNUwMrf0xOVBmqnG01o6rUvgWM+GONrO1aNv77SqA2JyXQeq+uAOpGopYCk6m+9g0A== X-Received: by 2002:a05:600c:ac4:b0:406:599f:f934 with SMTP id c4-20020a05600c0ac400b00406599ff934mr3961222wmr.12.1696477543254; Wed, 04 Oct 2023 20:45:43 -0700 (PDT) Date: Wed, 4 Oct 2023 23:45:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ilya Maximets , Stefan Hajnoczi Subject: [PULL v2 48/53] virtio: remove unnecessary thread fence while reading next descriptor Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=mst@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_H3=0.001, RCVD_IN_MSPIKE_WL=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: 1696477718377100011 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ilya Maximets It was supposed to be a compiler barrier and it was a compiler barrier initially called 'wmb' when virtio core support was introduced. Later all the instances of 'wmb' were switched to smp_wmb to fix memory ordering issues on non-x86 platforms. However, this one doesn't need to be an actual barrier, as its only purpose was to ensure that the value is not read twice. And since commit aa570d6fb6bd ("virtio: combine the read of a descriptor") there is no need for a barrier at all, since we're no longer reading guest memory here, but accessing a local structure. Signed-off-by: Ilya Maximets Message-Id: <20230927140016.2317404-2-i.maximets@ovn.org> Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 2058b838e9..87e8f990c5 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1060,8 +1060,6 @@ static int virtqueue_split_read_next_desc(VirtIODevic= e *vdev, VRingDesc *desc, =20 /* Check they're not leading us off end of descriptors. */ *next =3D desc->next; - /* Make sure compiler knows to grab that: we don't want it changing! */ - smp_wmb(); =20 if (*next >=3D max) { virtio_error(vdev, "Desc next is %u", *next); --=20 MST