qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "sochin.jiang" <sochin.jiang@huawei.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: notify guest directly
Date: Wed, 20 Dec 2017 01:57:44 +0100	[thread overview]
Message-ID: <7e40b768-3188-21df-cb00-38ec55fda4f8@redhat.com> (raw)
In-Reply-To: <1513690383-27269-1-git-send-email-sochin.jiang@huawei.com>

On 19/12/2017 14:33, sochin.jiang wrote:
> From: "sochin.jiang" <sochin.jiang@huawei.com>
> 
>  Till now, we've already notify guest as a batch mostly, an
>  extra BH won't decrease guest interrupts much, but cause a
>  significant notification loss. Generally, we could have 15%
>  or so performance lost in single queue IO models, as I tested.

Interesting, this was indeed done to decrease interrupt overhead:

    commit 5b2ffbe4d99843fd8305c573a100047a8c962327
    Author: Ming Lei <tom.leiming@gmail.com>
    Date:   Sat Jul 12 12:08:53 2014 +0800

    virtio-blk: dataplane: notify guest as a batch

    Now requests are submitted as a batch, so it is natural
    to notify guest as a batch too.

    This may suppress interrupt notification to VM a lot:

            - in my test, decreased by ~13K/sec

    Signed-off-by: Ming Lei <ming.lei@canonical.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Can you explain your benchmark setup?

Paolo


> Signed-off-by: sochin.jiang <sochin.jiang@huawei.com>
> ---
>  hw/block/dataplane/virtio-blk.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> index 5556f0e..a261a1d 100644
> --- a/hw/block/dataplane/virtio-blk.c
> +++ b/hw/block/dataplane/virtio-blk.c
> @@ -32,7 +32,6 @@ struct VirtIOBlockDataPlane {
>  
>      VirtIOBlkConf *conf;
>      VirtIODevice *vdev;
> -    QEMUBH *bh;                     /* bh for guest notification */
>      unsigned long *batch_notify_vqs;
>  
>      /* Note that these EventNotifiers are assigned by value.  This is
> @@ -44,14 +43,7 @@ struct VirtIOBlockDataPlane {
>      AioContext *ctx;
>  };
>  
> -/* Raise an interrupt to signal guest, if necessary */
> -void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s, VirtQueue *vq)
> -{
> -    set_bit(virtio_get_queue_index(vq), s->batch_notify_vqs);
> -    qemu_bh_schedule(s->bh);
> -}
> -
> -static void notify_guest_bh(void *opaque)
> +static void notify_guest(void *opaque)
>  {
>      VirtIOBlockDataPlane *s = opaque;
>      unsigned nvqs = s->conf->num_queues;
> @@ -75,7 +67,12 @@ static void notify_guest_bh(void *opaque)
>      }
>  }
>  
> -/* Context: QEMU global mutex held */
> +/* Raise an interrupt to signal guest, if necessary */
> +void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s, VirtQueue *vq)
> +{
> +    set_bit(virtio_get_queue_index(vq), s->batch_notify_vqs);
> +    notify_guest(s);
> +}
>  void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
>                                    VirtIOBlockDataPlane **dataplane,
>                                    Error **errp)
> @@ -122,7 +119,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
>      } else {
>          s->ctx = qemu_get_aio_context();
>      }
> -    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);
>      s->batch_notify_vqs = bitmap_new(conf->num_queues);
>  
>      *dataplane = s;
> @@ -140,7 +136,6 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
>      vblk = VIRTIO_BLK(s->vdev);
>      assert(!vblk->dataplane_started);
>      g_free(s->batch_notify_vqs);
> -    qemu_bh_delete(s->bh);
>      if (s->iothread) {
>          object_unref(OBJECT(s->iothread));
>      }
> 

  reply	other threads:[~2017-12-20  0:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 13:33 [Qemu-devel] [PATCH] virtio-blk: notify guest directly sochin.jiang
2017-12-20  0:57 ` Paolo Bonzini [this message]
2017-12-20  2:53   ` sochin.jiang
2017-12-20 16:20 ` Stefan Hajnoczi
2018-03-02 13:38 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-03-02 16:20   ` Sergio Lopez

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=7e40b768-3188-21df-cb00-38ec55fda4f8@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sochin.jiang@huawei.com \
    /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).