From nobody Tue Feb 10 03:37:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572390899; cv=none; d=zoho.com; s=zohoarc; b=MvNY8xtcSy/gO1TJ9Yig6HvDKDnzJsHAcKsab27roTbRA/KhON2lRaWd1pRw6yr3GgGYXcp0+aNPfezEscO4IcHmRPbjNXDQUW93BCS2ubZKCrAkvw3ZClcMPYZ6bXmPKE8ZAD+rLzFx1CDcHBgSqeuB/4c0dNr2TOCvtUJGPDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572390899; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NIZIUZQMHD8MQB75aibzuLlMw0b/3b/p/eZpRql+nWE=; b=QCIxTH2fCHo9QPg+o1aAWZluBdcqN0VdJHKCGSp/GlNixUYmV/mBuGcoKI/HF6KDeZJ8Ogus4ZkD/3NfyFGaXaywWLE0vADBHdPpnfKjpmnPOS5fSP+jMZV4FS5Dg6YcVEyCaBUyyGfV8fzd7f/wxs0nii4QdHw5iC+pmOzxqho= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572390899713995.4618627457598; Tue, 29 Oct 2019 16:14:59 -0700 (PDT) Received: from localhost ([::1]:34976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPahV-0005Y6-BJ for importer@patchew.org; Tue, 29 Oct 2019 19:14:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43877) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPaUU-0000p3-H5 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 19:01:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPaUT-0004tG-F4 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 19:01:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50072) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPaUS-0004qH-K0 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 19:01:29 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 150725AFE9 for ; Tue, 29 Oct 2019 23:01:26 +0000 (UTC) Received: by mail-qk1-f198.google.com with SMTP id x186so261163qke.13 for ; Tue, 29 Oct 2019 16:01:26 -0700 (PDT) Received: from redhat.com (94.222.26.109.rev.sfr.net. [109.26.222.94]) by smtp.gmail.com with ESMTPSA id w131sm487444qka.85.2019.10.29.16.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 16:01:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NIZIUZQMHD8MQB75aibzuLlMw0b/3b/p/eZpRql+nWE=; b=ijRtHMUrTxZaF3yJYcr3lPG8YXay/0DNcP0k1+vfjr0PUnDSIVQOMW+NkqsoaSZSEM 6pX4FBVGzhxmmLfkfrP7X+ExQoYtt/NKcRNWkC+/FE+udsSq0nUFSjFlDPdh5ojGzzh+ Wmuxi4PjMBD4Qmz6WfhG8G/wY8qBDNbPvAfSINrGrwQLyD8m7eDSExYD3sYduLiLpJnZ otb4KaicTDJmTtbCRRhpssw36bndGpB/S5X+5a5o+XQnuKIPRw7YkunPhjMVlZAWxsFb au+dVQpqjY0EiZ4WJA71gdF/RkvP+U+uk5E7Zc39bdTFdSv9WfwszLezcu5257a0h+nn lLYQ== X-Gm-Message-State: APjAAAVsXYa2GJd8If9th1WWxrOkq9TwVUvkoyHro4+SKfTo+xtnZ3ro EX+PgvyRIi0Yj5ZAX976db9iY2+TrFuZCFKHuMfgnY+m6XA5SnmaVjTjEsTUqq7yHx9wzhZkCTN GwN3rkZmnwUJd6nU= X-Received: by 2002:a0c:fb06:: with SMTP id c6mr20324531qvp.249.1572390084808; Tue, 29 Oct 2019 16:01:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC6H2Qf4NmNRdcd8gqruKRp5YmZ2ttJ49a9YfOjoFugY3dZMfZ635m5NGqJxx7hqHjdZSqzQ== X-Received: by 2002:a0c:fb06:: with SMTP id c6mr20324510qvp.249.1572390084599; Tue, 29 Oct 2019 16:01:24 -0700 (PDT) Date: Tue, 29 Oct 2019 19:01:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 13/14] virtio_net: use RCU_READ_LOCK_GUARD Message-ID: <20191029225932.14585-14-mst@redhat.com> References: <20191029225932.14585-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191029225932.14585-1-mst@redhat.com> X-Mailer: git-send-email 2.22.0.678.g13338e74b8 X-Mutt-Fcc: =sent X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Use RCU_READ_LOCK_GUARD rather than the manual rcu_read_(un)lock call. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20191025103403.120616-3-dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 314f365e7c..97a5113f7e 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1490,12 +1490,9 @@ static ssize_t virtio_net_receive_rcu(NetClientState= *nc, const uint8_t *buf, static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *bu= f, size_t size) { - ssize_t r; + RCU_READ_LOCK_GUARD(); =20 - rcu_read_lock(); - r =3D virtio_net_receive_rcu(nc, buf, size); - rcu_read_unlock(); - return r; + return virtio_net_receive_rcu(nc, buf, size); } =20 static void virtio_net_rsc_extract_unit4(VirtioNetRscChain *chain, --=20 MST