From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Kevin Wolf" <kwolf@redhat.com>,
qemu-block@nongnu.org, "Hanna Reitz" <hreitz@redhat.com>
Subject: Re: [PATCH] block/nvme: use AIO_WAIT_WHILE_UNLOCKED()
Date: Tue, 4 Apr 2023 15:48:19 +0200 [thread overview]
Message-ID: <739d3d6b-8583-8ca5-edd5-36c1c881fc53@redhat.com> (raw)
In-Reply-To: <20230404112044.427062-1-stefanha@redhat.com>
On 4/4/23 13:20, Stefan Hajnoczi wrote:
> A few Admin Queue commands are submitted during nvme_file_open(). They
> are synchronous since device initialization cannot continue until the
> commands complete.
>
> AIO_WAIT_WHILE() is currently used, but the block/nvme.c code actually
> doesn't rely on the AioContext lock. Replace it with
> AIO_WAIT_WHILE_UNLOCKED(NULL, condition). There is no change in behavior
> and the dependency on the AioContext lock is eliminated.
>
> This is a step towards removing the AioContext lock.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> block/nvme.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/block/nvme.c b/block/nvme.c
> index 5b744c2bda..829b9c04db 100644
> --- a/block/nvme.c
> +++ b/block/nvme.c
> @@ -512,7 +512,6 @@ static int nvme_admin_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd)
> {
> BDRVNVMeState *s = bs->opaque;
> NVMeQueuePair *q = s->queues[INDEX_ADMIN];
> - AioContext *aio_context = bdrv_get_aio_context(bs);
> NVMeRequest *req;
> int ret = -EINPROGRESS;
> req = nvme_get_free_req_nowait(q);
> @@ -521,7 +520,7 @@ static int nvme_admin_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd)
> }
> nvme_submit_command(q, req, cmd, nvme_admin_cmd_sync_cb, &ret);
>
> - AIO_WAIT_WHILE(aio_context, ret == -EINPROGRESS);
> + AIO_WAIT_WHILE_UNLOCKED(NULL, ret == -EINPROGRESS);
> return ret;
> }
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2023-04-04 13:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 11:20 [PATCH] block/nvme: use AIO_WAIT_WHILE_UNLOCKED() Stefan Hajnoczi
2023-04-04 11:46 ` Philippe Mathieu-Daudé
2023-04-04 13:48 ` Paolo Bonzini [this message]
2023-04-27 12:49 ` Kevin Wolf
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=739d3d6b-8583-8ca5-edd5-36c1c881fc53@redhat.com \
--to=pbonzini@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).