[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZbFGGPkNsvShlFkc@kbusch-mbp.dhcp.thefacebook.com>
Date: Wed, 24 Jan 2024 10:17:12 -0700
From: Keith Busch <kbusch@...nel.org>
To: yi sun <sunyibuaa@...il.com>
Cc: Yi Sun <yi.sun@...soc.com>, axboe@...nel.dk, mst@...hat.com,
jasowang@...hat.com, xuanzhuo@...ux.alibaba.com,
pbonzini@...hat.com, stefanha@...hat.com,
virtualization@...ts.linux.dev, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, zhiguo.niu@...soc.com,
hongyu.jin@...soc.com
Subject: Re: [PATCH 1/2] blk-mq: introduce
blk_mq_tagset_wait_request_completed()
On Wed, Jan 24, 2024 at 07:22:21PM +0800, yi sun wrote:
> In my case, I want all hw queues owned by this device to be clean.
> Because in the virtio device, each hw queue corresponds to a virtqueue,
> and all virtqueues will be deleted when vdev suspends.
>
> The blk_mq_tagset_wait_request_completed() function can ensure that
> the device has processed all in_flight requests , and these requests have
> become the complete state. I donĀ“t understand the blk_mq_freeze_queue()
> function very well. Can the function ensure that all requests have become
> complete status? How should I use the function to achieve the same effect?
Yeah, just do something like this:
---
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 5bf98fd6a651a..2f69675abdf29 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1593,14 +1593,14 @@ static int virtblk_freeze(struct virtio_device *vdev)
{
struct virtio_blk *vblk = vdev->priv;
+ blk_mq_freeze_queue(vblk->disk->queue);
+
/* Ensure we don't receive any more interrupts */
virtio_reset_device(vdev);
/* Make sure no work handler is accessing the device. */
flush_work(&vblk->config_work);
- blk_mq_quiesce_queue(vblk->disk->queue);
-
vdev->config->del_vqs(vdev);
kfree(vblk->vqs);
--
Powered by blists - more mailing lists