qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio-blk: Release s->rq queue at system_reset


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Release s->rq queue at system_reset
Date: Fri, 29 Jul 2016 12:41:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Fam,

On 07/29/16 12:22, Fam Zheng wrote:
> At system_reset, there is no point in retrying the queued request,
> because the driver that issued the request won't be around any more.
> 
> Analyzed-by: Laszlo Ersek <address@hidden>
> Reported-by: Laszlo Ersek <address@hidden>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  hw/block/virtio-blk.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index 475a822..89eca65 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -654,6 +654,7 @@ static void virtio_blk_reset(VirtIODevice *vdev)
>  {
>      VirtIOBlock *s = VIRTIO_BLK(vdev);
>      AioContext *ctx;
> +    VirtIOBlockReq *req;
>  
>      /*
>       * This should cancel pending requests, but can't do nicely until there
> @@ -661,6 +662,11 @@ static void virtio_blk_reset(VirtIODevice *vdev)
>       */
>      ctx = blk_get_aio_context(s->blk);
>      aio_context_acquire(ctx);
> +    while (s->rq) {
> +        req = s->rq;
> +        s->rq = req->next;
> +        virtio_blk_free_request(req);
> +    }
>      blk_drain(s->blk);
>  
>      if (s->dataplane) {
> 

The comment

    /*
     * This should cancel pending requests, but can't do nicely until there
     * are per-device request lists.
     */

dates back to

commit 6e02c38dadfe4cf02b0da6135adfd8d9352b90e1
Author: aliguori <address@hidden>
Date:   Thu Dec 4 19:52:44 2008 +0000

    Add virtio-blk support
    
    Virtio-blk is a paravirtual block device based on VirtIO.  It can be used by
    specifying the if=virtio parameter to the -drive parameter.
    
    When using -enable-kvm, it can achieve very good performance compared to 
IDE or
    SCSI.
    
    Signed-off-by: Anthony Liguori <address@hidden>
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/address@hidden 
c046a42c-6fe2-441c-8c8c-71466251a162

I think the comment is obsolete now, the idea that it expresses was actually 
fixed in the following commit, in my opinion:

commit 6e40b3bfc7e82823cf4df5f0bf668f56db41e53a
Author: Alexander Yarygin <address@hidden>
Date:   Wed Jun 17 13:37:20 2015 +0300

    virtio-blk: Use blk_drain() to drain IO requests
    
    Each call of the virtio_blk_reset() function calls blk_drain_all(),
    which works for all existing BlockDriverStates, while draining only
    one is needed.
    
    This patch replaces blk_drain_all() by blk_drain() in
    virtio_blk_reset(). virtio_blk_data_plane_stop() should be called
    after draining because it restores vblk->complete_request.
    
    Cc: "Michael S. Tsirkin" <address@hidden>
    Cc: Christian Borntraeger <address@hidden>
    Cc: Cornelia Huck <address@hidden>
    Cc: Kevin Wolf <address@hidden>
    Cc: Paolo Bonzini <address@hidden>
    Cc: Stefan Hajnoczi <address@hidden>
    Signed-off-by: Alexander Yarygin <address@hidden>
    Message-id: address@hidden
    Signed-off-by: Stefan Hajnoczi <address@hidden>

So how about turning this patch into a two part series: the first patch should 
drop the comment, and reference 6e40b3bfc7e82823cf4df5f0bf668f56db41e53a, while 
the second patch should be this patch?

For this patch:

Reviewed-by: Laszlo Ersek <address@hidden>

I definitely recommend that Stefan review this patch too.

Thanks!
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]