qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes
@ 2016-08-04  2:44 Fam Zheng
  2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 1/2] virtio-blk: Release s->rq queue at system_reset Fam Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fam Zheng @ 2016-08-04  2:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, lersek, stefanha

v3: Patch 1: add comment as Laszlo suggested, and add his r-b too. :)

Fam Zheng (2):
  virtio-blk: Release s->rq queue at system_reset
  virtio-blk: Remove stale comment about draining

 hw/block/virtio-blk.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

-- 
2.7.4

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

* [Qemu-devel] [PATCH v3 1/2] virtio-blk: Release s->rq queue at system_reset
  2016-08-04  2:44 [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes Fam Zheng
@ 2016-08-04  2:44 ` Fam Zheng
  2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 2/2] virtio-blk: Remove stale comment about draining Fam Zheng
  2016-08-04 12:46 ` [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Fam Zheng @ 2016-08-04  2:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, lersek, stefanha

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 <lersek@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 hw/block/virtio-blk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 475a822..1e348b1 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
@@ -663,6 +664,14 @@ static void virtio_blk_reset(VirtIODevice *vdev)
     aio_context_acquire(ctx);
     blk_drain(s->blk);
 
+    /* We drop queued requests after blk_drain() because blk_drain() itself can
+     * produce them. */
+    while (s->rq) {
+        req = s->rq;
+        s->rq = req->next;
+        virtio_blk_free_request(req);
+    }
+
     if (s->dataplane) {
         virtio_blk_data_plane_stop(s->dataplane);
     }
-- 
2.7.4

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

* [Qemu-devel] [PATCH v3 2/2] virtio-blk: Remove stale comment about draining
  2016-08-04  2:44 [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes Fam Zheng
  2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 1/2] virtio-blk: Release s->rq queue at system_reset Fam Zheng
@ 2016-08-04  2:44 ` Fam Zheng
  2016-08-04 12:46 ` [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Fam Zheng @ 2016-08-04  2:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, lersek, stefanha

This is stale after commit 6e40b3bf (virtio-blk: Use blk_drain() to
drain IO requests), remove it.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 hw/block/virtio-blk.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 1e348b1..331d766 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -656,10 +656,6 @@ static void virtio_blk_reset(VirtIODevice *vdev)
     AioContext *ctx;
     VirtIOBlockReq *req;
 
-    /*
-     * This should cancel pending requests, but can't do nicely until there
-     * are per-device request lists.
-     */
     ctx = blk_get_aio_context(s->blk);
     aio_context_acquire(ctx);
     blk_drain(s->blk);
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes
  2016-08-04  2:44 [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes Fam Zheng
  2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 1/2] virtio-blk: Release s->rq queue at system_reset Fam Zheng
  2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 2/2] virtio-blk: Remove stale comment about draining Fam Zheng
@ 2016-08-04 12:46 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2016-08-04 12:46 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, pbonzini, lersek

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

On Thu, Aug 04, 2016 at 10:44:12AM +0800, Fam Zheng wrote:
> v3: Patch 1: add comment as Laszlo suggested, and add his r-b too. :)
> 
> Fam Zheng (2):
>   virtio-blk: Release s->rq queue at system_reset
>   virtio-blk: Remove stale comment about draining
> 
>  hw/block/virtio-blk.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> -- 
> 2.7.4
> 

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

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

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

end of thread, other threads:[~2016-08-04 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04  2:44 [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes Fam Zheng
2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 1/2] virtio-blk: Release s->rq queue at system_reset Fam Zheng
2016-08-04  2:44 ` [Qemu-devel] [PATCH v3 2/2] virtio-blk: Remove stale comment about draining Fam Zheng
2016-08-04 12:46 ` [Qemu-devel] [PATCH v3 0/2] Two virtio-blk fixes 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).