From nobody Mon Feb 9 20:10:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630601453; cv=none; d=zohomail.com; s=zohoarc; b=MZEPHj4wJBU7JRc96LYaVprkbJTLBJf3Mfa2J7JLWU9SJQeZrXNdbA/8vq4MAuJFPXX877UlW4Iow7wYJBmOCd3qq7eZ/bR7/NJlqa6u69FjLiq7nnokbqnOFSUT4fG9MKtDogvTO8rm4Upvf9CrXtMFKGh1MlCjUoyrbBB1SzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630601453; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=VN2G/4wJSGOaP1i/981uZGnXCojQFUj+WUAJBtOHkIY=; b=IFe8UcUM02xTLgEdw6pbwNNo0nMjaGiSATJ/xGlXdD+YNrb5yEfWt404OQaVJlNGCV5lewQg2nERn4vRsLm1uBRO32KQiNNq4cAh9ShyfWPVnHxpVP1ou8ZxFqVnCxoHPhK2KBystYbybSjfaXue4y45YfDk10XVDrZWYbYDNwY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1630601453474492.9877964928869; Thu, 2 Sep 2021 09:50:53 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-83-wydODskpMTy-in9lTwLXBg-1; Thu, 02 Sep 2021 12:50:51 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5-20020a1c00050000b02902e67111d9f0so939802wma.4 for ; Thu, 02 Sep 2021 09:50:51 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id w29sm2347646wra.88.2021.09.02.09.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 09:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630601452; 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=VN2G/4wJSGOaP1i/981uZGnXCojQFUj+WUAJBtOHkIY=; b=VJDZdsSaDTIp0DUcQTZHWkHy6kry6e1nlF+LVtk/sUocMGlodknSGNT9NezZu40+qmofOC ahKWiZTKWeYZ4Q1JFPCtxU09sGI6CRhkBvNWrp2Y9+Q5lCEbis4s4jRSa8B+5lEHGhfC23 ukgCKAt9GA9n04wMV5ooVVm9Lb6ADX0= X-MC-Unique: wydODskpMTy-in9lTwLXBg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VN2G/4wJSGOaP1i/981uZGnXCojQFUj+WUAJBtOHkIY=; b=G6W+iOfhRU31MSIUqZo4KokbDn2AuP/1elSVECHOY14X/k9W8x7MZ4jgmt59OsxPZR Hr+/GOSGYWWWkR94TBBqjLLZdbdRQVEye51Dq/ZoZfc27RTktdMlvYcnXGsyxic/8qjm R8YTkukWmZa1aOjDcKV3q1Syzxpo/P+qSlVIuW9tuyxqp3YMsHQ05w7k8xT1yB54o+Bm XYJuSsK6Phptl1LDSTTjBhKruOp7Mr4RqbDE78x8w0IrDpBYFlzMFRGsreQT5bWiPKSP lLImVFei6sJIwdFzAnvGYmbkmdcxQaB+rNVEG6BJGKH5vG3Bs+pYqTcAPURMeCQ6Pt88 wwmw== X-Gm-Message-State: AOAM53241U6uk/nuEIHBOONb+e0Je1VXmXnthm4017nhu8lXSxI+G/sW ygrtFbxUQvr5cyplcdKmqbDVolOwCU1aP8IyzwEMQn7V2jpllOoY5fCQ5smkxCrazeXi0cFru20 heCcjts/y+O2sUA== X-Received: by 2002:adf:910b:: with SMTP id j11mr5126805wrj.114.1630601450181; Thu, 02 Sep 2021 09:50:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwea8iZWd3qA+Endbq2SjCFcM8b7KRnOUYgTlw5Dootfy65if7i4AgBT9x2JXBQc1DO38984A== X-Received: by 2002:adf:910b:: with SMTP id j11mr5126787wrj.114.1630601450033; Thu, 02 Sep 2021 09:50:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Stefan Hajnoczi , Cornelia Huck , Stefano Garzarella , Paolo Bonzini , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/5] hw/virtio: Comment virtqueue_flush() must be called with RCU read lock Date: Thu, 2 Sep 2021 18:50:36 +0200 Message-Id: <20210902165039.432786-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210902165039.432786-1-philmd@redhat.com> References: <20210902165039.432786-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630601454290100003 Reported-by: Stefano Garzarella Suggested-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/virtio/virtio.h | 7 +++++++ hw/virtio/virtio.c | 1 + 2 files changed, 8 insertions(+) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 8bab9cfb750..c1c5f6e53c8 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -186,6 +186,13 @@ void virtio_delete_queue(VirtQueue *vq); =20 void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len); +/** + * virtqueue_flush: + * @vq: The #VirtQueue + * @count: Number of elements to flush + * + * Must be called within RCU critical section. + */ void virtqueue_flush(VirtQueue *vq, unsigned int count); void virtqueue_detach_element(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index a5214bca612..b37344bb5e1 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -898,6 +898,7 @@ static void virtqueue_packed_flush(VirtQueue *vq, unsig= ned int count) } } =20 +/* Called within rcu_read_lock(). */ void virtqueue_flush(VirtQueue *vq, unsigned int count) { if (virtio_device_disabled(vq->vdev)) { --=20 2.31.1