qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-scsi: dataplane: suppress guest notification
@ 2014-11-12  3:24 Ming Lei
  2014-11-12 10:19 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2014-11-12  3:24 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini, Stefan Hajnoczi, Kevin Wolf
  Cc: Ming Lei, Fam Zheng, Anthony Liguori, Michael S. Tsirkin

This patch uses vring_should_notify() to suppress
guest notification, and looks notification frequency
can be decreased from ~33K/sec to ~2K/sec in my test
environment.

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 hw/scsi/virtio-scsi-dataplane.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index df17229..be3b042 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -93,9 +93,14 @@ VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s,
 
 void virtio_scsi_vring_push_notify(VirtIOSCSIReq *req)
 {
+    VirtIODevice *vdev = VIRTIO_DEVICE(req->vring->parent);
+
     vring_push(&req->vring->vring, &req->elem,
                req->qsgl.size + req->resp_iov.size);
-    event_notifier_set(&req->vring->guest_notifier);
+
+    if (vring_should_notify(vdev, &req->vring->vring)) {
+        event_notifier_set(&req->vring->guest_notifier);
+    }
 }
 
 static void virtio_scsi_iothread_handle_ctrl(EventNotifier *notifier)
-- 
1.7.9.5

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

* Re: [Qemu-devel] [PATCH] virtio-scsi: dataplane: suppress guest notification
  2014-11-12  3:24 [Qemu-devel] [PATCH] virtio-scsi: dataplane: suppress guest notification Ming Lei
@ 2014-11-12 10:19 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-11-12 10:19 UTC (permalink / raw)
  To: Ming Lei, qemu-devel, Stefan Hajnoczi, Kevin Wolf
  Cc: Fam Zheng, Anthony Liguori, Michael S. Tsirkin



On 12/11/2014 04:24, Ming Lei wrote:
> This patch uses vring_should_notify() to suppress
> guest notification, and looks notification frequency
> can be decreased from ~33K/sec to ~2K/sec in my test
> environment.
> 
> Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>  hw/scsi/virtio-scsi-dataplane.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
> index df17229..be3b042 100644
> --- a/hw/scsi/virtio-scsi-dataplane.c
> +++ b/hw/scsi/virtio-scsi-dataplane.c
> @@ -93,9 +93,14 @@ VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s,
>  
>  void virtio_scsi_vring_push_notify(VirtIOSCSIReq *req)
>  {
> +    VirtIODevice *vdev = VIRTIO_DEVICE(req->vring->parent);
> +
>      vring_push(&req->vring->vring, &req->elem,
>                 req->qsgl.size + req->resp_iov.size);
> -    event_notifier_set(&req->vring->guest_notifier);
> +
> +    if (vring_should_notify(vdev, &req->vring->vring)) {
> +        event_notifier_set(&req->vring->guest_notifier);
> +    }
>  }
>  
>  static void virtio_scsi_iothread_handle_ctrl(EventNotifier *notifier)
> 

Thanks, applied.

Paolo

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

end of thread, other threads:[~2014-11-12 10:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12  3:24 [Qemu-devel] [PATCH] virtio-scsi: dataplane: suppress guest notification Ming Lei
2014-11-12 10:19 ` Paolo Bonzini

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