qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-scsi: introduce virtio_scsi_acquire/release
@ 2016-11-29 15:37 Paolo Bonzini
  2016-11-30  6:55 ` Fam Zheng
  2016-11-30 10:37 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-11-29 15:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

These will be used more as soon as the acquire/release is pushed down to
the ioeventfd handlers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 10fd687..34bba35 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -420,6 +420,20 @@ static void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s, VirtIOSCSIReq *req)
     }
 }
 
+static inline void virtio_scsi_acquire(VirtIOSCSI *s)
+{
+    if (s->ctx) {
+        aio_context_acquire(s->ctx);
+    }
+}
+
+static inline void virtio_scsi_release(VirtIOSCSI *s)
+{
+    if (s->ctx) {
+        aio_context_release(s->ctx);
+    }
+}
+
 void virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq)
 {
     VirtIOSCSIReq *req;
@@ -691,10 +705,7 @@ void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
         return;
     }
 
-    if (s->dataplane_started) {
-        assert(s->ctx);
-        aio_context_acquire(s->ctx);
-    }
+    virtio_scsi_acquire(s);
 
     req = virtio_scsi_pop_req(s, vs->event_vq);
     if (!req) {
@@ -730,9 +741,7 @@ void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
     }
     virtio_scsi_complete_req(req);
 out:
-    if (s->dataplane_started) {
-        aio_context_release(s->ctx);
-    }
+    virtio_scsi_release(s);
 }
 
 void virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq)
@@ -778,9 +787,9 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
         if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
             return;
         }
-        aio_context_acquire(s->ctx);
+        virtio_scsi_acquire(s);
         blk_set_aio_context(sd->conf.blk, s->ctx);
-        aio_context_release(s->ctx);
+        virtio_scsi_release(s);
 
     }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-scsi: introduce virtio_scsi_acquire/release
  2016-11-29 15:37 [Qemu-devel] [PATCH] virtio-scsi: introduce virtio_scsi_acquire/release Paolo Bonzini
@ 2016-11-30  6:55 ` Fam Zheng
  2016-11-30 10:37 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2016-11-30  6:55 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, stefanha

On Tue, 11/29 16:37, Paolo Bonzini wrote:
> These will be used more as soon as the acquire/release is pushed down to
> the ioeventfd handlers.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Looks sane.

Reviewed-by: Fam Zheng <famz@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-scsi: introduce virtio_scsi_acquire/release
  2016-11-29 15:37 [Qemu-devel] [PATCH] virtio-scsi: introduce virtio_scsi_acquire/release Paolo Bonzini
  2016-11-30  6:55 ` Fam Zheng
@ 2016-11-30 10:37 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-11-30 10:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

On Tue, Nov 29, 2016 at 04:37:01PM +0100, Paolo Bonzini wrote:
> These will be used more as soon as the acquire/release is pushed down to
> the ioeventfd handlers.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/scsi/virtio-scsi.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-30 11:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 15:37 [Qemu-devel] [PATCH] virtio-scsi: introduce virtio_scsi_acquire/release Paolo Bonzini
2016-11-30  6:55 ` Fam Zheng
2016-11-30 10:37 ` Stefan Hajnoczi

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).