qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [PATCH 0/2] block-backend: process I/O in the current AioContext
Date: Fri, 18 Aug 2023 17:24:22 +0200	[thread overview]
Message-ID: <ZN+NJvs0G4zvbOJB@redhat.com> (raw)
In-Reply-To: <20230815160521.3357063-1-stefanha@redhat.com>

Am 15.08.2023 um 18:05 hat Stefan Hajnoczi geschrieben:
> Switch blk_aio_*() APIs over to multi-queue by using
> qemu_get_current_aio_context() instead of blk_get_aio_context(). This change
> will allow devices to process I/O in multiple IOThreads in the future.

Both code paths still use blk_aio_em_aiocb_info, which is:

    static AioContext *blk_aio_em_aiocb_get_aio_context(BlockAIOCB *acb_)
    {
        BlkAioEmAIOCB *acb = container_of(acb_, BlkAioEmAIOCB, common);

        return blk_get_aio_context(acb->rwco.blk);
    }

    static const AIOCBInfo blk_aio_em_aiocb_info = {
        .aiocb_size         = sizeof(BlkAioEmAIOCB),
        .get_aio_context    = blk_aio_em_aiocb_get_aio_context,
    };

.get_aio_context() is called by bdrv_aio_cancel(), which already looks
wrong before this patch because in theory it can end up polling the
AioContext of a different thread. After this patch, .get_aio_context()
doesn't even necessarily return the AioContext that runs the request any
more.

The only thing that might save us is that I can't find any device that
both supports iothreads and calls bdrv_aio_cancel(). But we shouldn't
rely on that.

Maybe the solution is to just remove .get_aio_context altogether and use
AIO_WAIT_WHILE(NULL, ...) in bdrv_aio_cancel().

Kevin



  parent reply	other threads:[~2023-08-18 15:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 16:05 [PATCH 0/2] block-backend: process I/O in the current AioContext Stefan Hajnoczi
2023-08-15 16:05 ` [PATCH 1/2] " Stefan Hajnoczi
2023-08-15 16:05 ` [PATCH 2/2] block-backend: process zoned requests " Stefan Hajnoczi
2023-08-18 15:24 ` Kevin Wolf [this message]
2023-08-21 15:17   ` [PATCH 0/2] block-backend: process I/O " Stefan Hajnoczi

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=ZN+NJvs0G4zvbOJB@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hreitz@redhat.com \
    --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).