From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Xu" <peterx@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Fam Zheng" <fam@euphon.net>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [PATCH 2/4] virtio-scsi: don't lock AioContext around virtio_queue_aio_attach_host_notifier()
Date: Thu, 23 Nov 2023 14:49:29 -0500 [thread overview]
Message-ID: <20231123194931.171598-3-stefanha@redhat.com> (raw)
In-Reply-To: <20231123194931.171598-1-stefanha@redhat.com>
virtio_queue_aio_attach_host_notifier() does not require the AioContext
lock. Stop taking the lock and remember add an explicit smp_wmb()
because we were relying on the implicit barrier in the AioContext lock
before.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/scsi/virtio-scsi-dataplane.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index 1e684beebe..135e23fe54 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -149,23 +149,17 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev)
memory_region_transaction_commit();
- /*
- * These fields are visible to the IOThread so we rely on implicit barriers
- * in aio_context_acquire() on the write side and aio_notify_accept() on
- * the read side.
- */
s->dataplane_starting = false;
s->dataplane_started = true;
+ smp_wmb(); /* paired with aio_notify_accept() */
if (s->bus.drain_count == 0) {
- aio_context_acquire(s->ctx);
virtio_queue_aio_attach_host_notifier(vs->ctrl_vq, s->ctx);
virtio_queue_aio_attach_host_notifier_no_poll(vs->event_vq, s->ctx);
for (i = 0; i < vs->conf.num_queues; i++) {
virtio_queue_aio_attach_host_notifier(vs->cmd_vqs[i], s->ctx);
}
- aio_context_release(s->ctx);
}
return 0;
--
2.42.0
next prev parent reply other threads:[~2023-11-23 19:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 19:49 [PATCH 0/4] scsi: eliminate AioContext lock Stefan Hajnoczi
2023-11-23 19:49 ` [PATCH 1/4] scsi: only access SCSIDevice->requests from one thread Stefan Hajnoczi
2023-11-27 15:14 ` Eric Blake
2023-12-01 16:03 ` Kevin Wolf
2023-12-04 16:30 ` Stefan Hajnoczi
2023-12-05 10:00 ` Kevin Wolf
2023-12-06 16:25 ` Stefan Hajnoczi
2023-11-23 19:49 ` Stefan Hajnoczi [this message]
2023-11-27 15:21 ` [PATCH 2/4] virtio-scsi: don't lock AioContext around virtio_queue_aio_attach_host_notifier() Eric Blake
2023-12-04 15:37 ` Stefan Hajnoczi
2023-12-01 16:11 ` Kevin Wolf
2023-11-23 19:49 ` [PATCH 3/4] scsi: don't lock AioContext in I/O code path Stefan Hajnoczi
2023-11-27 15:58 ` Eric Blake
2023-12-01 16:38 ` Kevin Wolf
2023-11-23 19:49 ` [PATCH 4/4] dma-helpers: don't lock AioContext in dma_blk_cb() Stefan Hajnoczi
2023-11-27 18:46 ` Eric Blake
2023-12-01 16:48 ` Kevin Wolf
2023-11-23 19:57 ` [PATCH 0/4] scsi: eliminate AioContext lock Stefan Hajnoczi
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=20231123194931.171598-3-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=david@redhat.com \
--cc=fam@euphon.net \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).