From: Stefan Hajnoczi <stefanha@redhat.com>
To: Hanna Czenczek <hreitz@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
qemu-stable@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
Subject: Re: [PATCH 2/2] scsi: Await request purging
Date: Tue, 6 Feb 2024 11:56:54 -0500 [thread overview]
Message-ID: <20240206165654.GD66397@fedora> (raw)
In-Reply-To: <20240202144755.671354-3-hreitz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1742 bytes --]
On Fri, Feb 02, 2024 at 03:47:55PM +0100, Hanna Czenczek wrote:
> scsi_device_for_each_req_async() currently does not provide any way to
> be awaited. One of its callers is scsi_device_purge_requests(), which
> therefore currently does not guarantee that all requests are fully
> settled when it returns.
>
> We want all requests to be settled, because scsi_device_purge_requests()
> is called through the unrealize path, including the one invoked by
> virtio_scsi_hotunplug() through qdev_simple_device_unplug_cb(), which
> most likely assumes that all SCSI requests are done then.
>
> In fact, scsi_device_purge_requests() already contains a blk_drain(),
> but this will not fully await scsi_device_for_each_req_async(), only the
> I/O requests it potentially cancels (not the non-I/O requests).
> However, we can have scsi_device_for_each_req_async() increment the BB
> in-flight counter, and have scsi_device_for_each_req_async_bh()
> decrement it when it is done. This way, the blk_drain() will fully
> await all SCSI requests to be purged.
>
> This also removes the need for scsi_device_for_each_req_async_bh() to
> double-check the current context and potentially re-schedule itself,
> should it now differ from the BB's context: Changing a BB's AioContext
> with a root node is done through bdrv_try_change_aio_context(), which
> creates a drained section. With this patch, we keep the BB in-flight
> counter elevated throughout, so we know the BB's context cannot change.
>
> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
> ---
> hw/scsi/scsi-bus.c | 30 +++++++++++++++++++++---------
> 1 file changed, 21 insertions(+), 9 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-02-06 16:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 14:47 [PATCH 0/2] block: Allow concurrent BB context changes Hanna Czenczek
2024-02-02 14:47 ` [PATCH 1/2] block-backend: Allow concurrent " Hanna Czenczek
2024-02-06 16:55 ` Stefan Hajnoczi
2024-02-02 14:47 ` [PATCH 2/2] scsi: Await request purging Hanna Czenczek
2024-02-06 16:56 ` Stefan Hajnoczi [this message]
2024-02-06 16:53 ` [PATCH 0/2] block: Allow concurrent BB context changes Stefan Hajnoczi
2024-02-07 9:35 ` Hanna Czenczek
2024-02-08 21:15 ` Stefan Hajnoczi
2024-02-07 13:55 ` Kevin Wolf
2024-02-09 14:08 ` Michael Tokarev
2024-02-09 16:51 ` Hanna Czenczek
2024-02-10 8:46 ` Michael Tokarev
2024-02-12 8:52 ` Hanna Czenczek
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=20240206165654.GD66397@fedora \
--to=stefanha@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.