qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Ming Lei <ming.lei@canonical.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 1/2] virtio-blk: data-plane: fix save/set .complete_request in start
Date: Mon, 7 Jul 2014 14:15:41 +0800	[thread overview]
Message-ID: <20140707061541.GF1119@T430.redhat.com> (raw)
In-Reply-To: <1404533935-12365-2-git-send-email-ming.lei@canonical.com>

On Sat, 07/05 12:18, Ming Lei wrote:
> The callback has to be saved and reset in virtio_blk_data_plane_start(),
> otherwise dataplane's requests will be completed in qemu aio context.

Yes, the cb is wrong once virtio_blk_data_plane_stop is called (device reset,
etc.).

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

> 
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>  hw/block/dataplane/virtio-blk.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> index 227bb15..e88862d 100644
> --- a/hw/block/dataplane/virtio-blk.c
> +++ b/hw/block/dataplane/virtio-blk.c
> @@ -125,7 +125,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
>                                    Error **errp)
>  {
>      VirtIOBlockDataPlane *s;
> -    VirtIOBlock *vblk = VIRTIO_BLK(vdev);
>      Error *local_err = NULL;
>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
> @@ -178,8 +177,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
>      bdrv_op_block_all(blk->conf.bs, s->blocker);
>  
>      *dataplane = s;
> -    s->saved_complete_request = vblk->complete_request;
> -    vblk->complete_request = complete_request_vring;
>  }
>  
>  /* Context: QEMU global mutex held */
> @@ -201,6 +198,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
>  {
>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev)));
>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
> +    VirtIOBlock *vblk = VIRTIO_BLK(s->vdev);
>      VirtQueue *vq;
>  
>      if (s->started) {
> @@ -234,6 +232,9 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
>      }
>      s->host_notifier = *virtio_queue_get_host_notifier(vq);
>  
> +    s->saved_complete_request = vblk->complete_request;
> +    vblk->complete_request = complete_request_vring;
> +
>      s->starting = false;
>      s->started = true;
>      trace_virtio_blk_data_plane_start(s);
> -- 
> 1.7.9.5
> 
> 

  reply	other threads:[~2014-07-07  6:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05  4:18 [Qemu-devel] [PATCH v1 0/2] virtio-blk: dataplane: one fix plus one optimization Ming Lei
2014-07-05  4:18 ` [Qemu-devel] [PATCH v1 1/2] virtio-blk: data-plane: fix save/set .complete_request in start Ming Lei
2014-07-07  6:15   ` Fam Zheng [this message]
2014-07-05  4:18 ` [Qemu-devel] [PATCH v1 2/2] virtio-blk: dataplane: notify guest as a batch Ming Lei

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=20140707061541.GF1119@T430.redhat.com \
    --to=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=ming.lei@canonical.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).