All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: qemu-devel@nongnu.org, "Philippe Mathieu-Daudé " <philmd@linaro.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Fam Zheng" <fam@euphon.net>, "Greg Kurz" <groug@kaod.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Cé dric Le Goater" <clg@redhat.com>,
	"Philippe Mathieu-Daudé " <philmd@linaro.org>
Subject: Re: [PATCH 4/6] hw/scsi/virtio-scsi: Use RCU_READ macro
Date: Wed, 24 Jan 2024 11:17:07 +0200	[thread overview]
Message-ID: <7re0d.o8r1pancklv@linaro.org> (raw)
In-Reply-To: <20240124074201.8239-5-philmd@linaro.org>

On Wed, 24 Jan 2024 09:41, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>Replace the manual rcu_read_(un)lock calls by the
>WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba
>"docs/style: call out the use of GUARD macros").
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> hw/scsi/virtio-scsi.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
>index 690aceec45..998227404a 100644
>--- a/hw/scsi/virtio-scsi.c
>+++ b/hw/scsi/virtio-scsi.c
>@@ -343,14 +343,14 @@ static void virtio_scsi_do_one_tmf_bh(VirtIOSCSIReq *req)
>         target = req->req.tmf.lun[1];
>         qatomic_inc(&s->resetting);
> 
>-        rcu_read_lock();
>-        QTAILQ_FOREACH_RCU(kid, &s->bus.qbus.children, sibling) {
>-            SCSIDevice *d1 = SCSI_DEVICE(kid->child);
>-            if (d1->channel == 0 && d1->id == target) {
>-                device_cold_reset(&d1->qdev);
>+        WITH_RCU_READ_LOCK_GUARD() {
>+            QTAILQ_FOREACH_RCU(kid, &s->bus.qbus.children, sibling) {
>+                SCSIDevice *d1 = SCSI_DEVICE(kid->child);
>+                if (d1->channel == 0 && d1->id == target) {
>+                    device_cold_reset(&d1->qdev);
>+                }
>             }
>         }
>-        rcu_read_unlock();
> 
>         qatomic_dec(&s->resetting);
>         break;
>-- 
>2.41.0
>

Unrelated to your patch: I just noticed in hw/scsi/virtio-scsi.c, 
s->resetting is used to flag whether the bus is resetting; but there's 
no check if a resetting is taking place before starting another. Is this 
single threaded code so it's not necessary?

As for the patch:

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>


  reply	other threads:[~2024-01-24  9:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  7:41 [PATCH 0/6] hw/accel: Use RCU_READ macros Philippe Mathieu-Daudé
2024-01-24  7:41 ` [PATCH 1/6] accel/tcg/cpu-exec: Use RCU_READ macro Philippe Mathieu-Daudé
2024-01-24  9:34   ` Manos Pitsidianakis
2024-01-24 21:14   ` Richard Henderson
2024-01-28  1:07   ` Richard Henderson
2024-01-24  7:41 ` [PATCH 2/6] hw/9pfs/9p-synth: " Philippe Mathieu-Daudé
2024-01-24  7:49   ` Greg Kurz
2024-01-24 13:15   ` Christian Schoenebeck
2024-01-24  7:41 ` [PATCH 3/6] hw/display/virtio-gpu-udmabuf: " Philippe Mathieu-Daudé
2024-01-24  9:13   ` Manos Pitsidianakis
2024-01-24  7:41 ` [PATCH 4/6] hw/scsi/virtio-scsi: " Philippe Mathieu-Daudé
2024-01-24  9:17   ` Manos Pitsidianakis [this message]
2024-01-24 10:26     ` Philippe Mathieu-Daudé
2024-01-24  7:42 ` [PATCH 5/6] hw/vfio/common: Use RCU_READ macros Philippe Mathieu-Daudé
2024-01-24  9:25   ` Manos Pitsidianakis
2024-01-24 14:09     ` Philippe Mathieu-Daudé
2024-02-16  8:49       ` Philippe Mathieu-Daudé
2024-02-16  9:13         ` Cédric Le Goater
2024-01-24  7:42 ` [PATCH 6/6] hw/virtio/vhost: Use RCU_READ macro Philippe Mathieu-Daudé
2024-01-24  9:15   ` Manos Pitsidianakis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7re0d.o8r1pancklv@linaro.org \
    --to=manos.pitsidianakis@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=clg@redhat.com \
    --cc=fam@euphon.net \
    --cc=groug@kaod.org \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.