All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@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: Mon, 21 Aug 2023 11:17:20 -0400	[thread overview]
Message-ID: <20230821151720.GA51352@fedora> (raw)
In-Reply-To: <ZN+NJvs0G4zvbOJB@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

On Fri, Aug 18, 2023 at 05:24:22PM +0200, Kevin Wolf wrote:
> 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().

I will remove AIOCBInfo.get_aio_context in v2.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2023-08-21 19:21 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 ` [PATCH 0/2] block-backend: process I/O " Kevin Wolf
2023-08-21 15:17   ` Stefan Hajnoczi [this message]

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=20230821151720.GA51352@fedora \
    --to=stefanha@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@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.