mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: yi sun <sunyibuaa@gmail.com>
Cc: Yi Sun <yi.sun@unisoc.com>,
	axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com,
	xuanzhuo@linux.alibaba.com, pbonzini@redhat.com,
	stefanha@redhat.com, virtualization@lists.linux.dev,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhiguo.niu@unisoc.com, hongyu.jin@unisoc.com
Subject: Re: [PATCH 1/2] blk-mq: introduce blk_mq_tagset_wait_request_completed()
Date: Wed, 24 Jan 2024 10:17:12 -0700	[thread overview]
Message-ID: <ZbFGGPkNsvShlFkc@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <CALpufv1XRYX7bv-NAUMmRjWr0jhDC1xrd+d48XejJZPjZZLEYQ@mail.gmail.com>

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);

--

  reply	other threads:[~2024-01-24 17:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 11:07 [PATCH 0/2] Fix requests loss during virtio-blk device suspend Yi Sun
2024-01-22 11:07 ` [PATCH 1/2] blk-mq: introduce blk_mq_tagset_wait_request_completed() Yi Sun
2024-01-23 18:45   ` kernel test robot
2024-01-23 19:14   ` Keith Busch
2024-01-24 11:22     ` yi sun
2024-01-24 17:17       ` Keith Busch [this message]
2024-01-22 11:07 ` [PATCH 2/2] virtio-blk: Ensure no requests in virtqueues before deleting vqs Yi Sun
2024-01-22 15:42   ` Stefan Hajnoczi
2024-01-23  3:27     ` yi sun
2024-01-23 15:09       ` Stefan Hajnoczi
2024-01-24  7:38         ` yi sun

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=ZbFGGPkNsvShlFkc@kbusch-mbp.dhcp.thefacebook.com \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hongyu.jin@unisoc.com \
    --cc=jasowang@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=sunyibuaa@gmail.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yi.sun@unisoc.com \
    --cc=zhiguo.niu@unisoc.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

all inboxes | Powered by JetHome®