qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Eric Blake <eblake@redhat.com>,
	kwolf@redhat.com, Fam Zheng <fam@euphon.net>,
	Juan Quintela <quintela@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	Daniel Berrange <berrange@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-block@nongnu.org, Leonardo Bras <leobras@redhat.com>,
	Coiby Xu <Coiby.Xu@gmail.com>, Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH 2/2] io: follow coroutine AioContext in qio_channel_yield()
Date: Thu, 24 Aug 2023 13:29:23 -0400	[thread overview]
Message-ID: <20230824172923.GC1690425@fedora> (raw)
In-Reply-To: <874jko8lrc.fsf@suse.de>

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

On Thu, Aug 24, 2023 at 01:09:59PM -0300, Fabiano Rosas wrote:
> Stefan Hajnoczi <stefanha@redhat.com> writes:
> 
> > @@ -2089,10 +2088,6 @@ static void nbd_attach_aio_context(BlockDriverState *bs,
> >       * the reconnect_delay_timer cannot be active here.
> >       */
> >      assert(!s->reconnect_delay_timer);
> > -
> > -    if (s->ioc) {
> > -        qio_channel_attach_aio_context(s->ioc, new_context);
> > -    }
> >  }
> >  
> >  static void nbd_detach_aio_context(BlockDriverState *bs)
> > @@ -2101,10 +2096,6 @@ static void nbd_detach_aio_context(BlockDriverState *bs)
> >  
> >      assert(!s->open_timer);
> >      assert(!s->reconnect_delay_timer);
> > -
> > -    if (s->ioc) {
> > -        qio_channel_detach_aio_context(s->ioc);
> > -    }
> >  }
> 
> The whole attach/detach functions could go away.

Yes, but at the expense of losing the assertions. Some of them have
extensive comments and I guess they are important to someone, so I
didn't drop them.

> 
> >  
> >  static BlockDriver bdrv_nbd = {
> > diff --git a/io/channel-command.c b/io/channel-command.c
> > index 7ed726c802..1f61026222 100644
> > --- a/io/channel-command.c
> > +++ b/io/channel-command.c
> > @@ -331,14 +331,21 @@ static int qio_channel_command_close(QIOChannel *ioc,
> >  
> >  
> >  static void qio_channel_command_set_aio_fd_handler(QIOChannel *ioc,
> > -                                                   AioContext *ctx,
> > +                                                   AioContext *read_ctx,
> >                                                     IOHandler *io_read,
> > +                                                   AioContext *write_ctx,
> >                                                     IOHandler *io_write,
> >                                                     void *opaque)
> >  {
> >      QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);
> > -    aio_set_fd_handler(ctx, cioc->readfd, io_read, NULL, NULL, NULL, opaque);
> > -    aio_set_fd_handler(ctx, cioc->writefd, NULL, io_write, NULL, NULL, opaque);
> > +    if (read_ctx) {
> > +        aio_set_fd_handler(read_ctx, cioc->readfd, io_read, NULL,
> > +                NULL, NULL, opaque);
> > +    }
> > +    if (write_ctx) {
> > +        aio_set_fd_handler(write_ctx, cioc->writefd, NULL, io_write,
> > +                NULL, NULL, opaque);
> > +    }
> >  }
> >  
> >  
> 
> ...
> 
> > diff --git a/nbd/client.c b/nbd/client.c
> > index 479208d5d9..81877d088d 100644
> > --- a/nbd/client.c
> > +++ b/nbd/client.c
> > @@ -948,7 +948,7 @@ static int nbd_start_negotiate(AioContext *aio_context, QIOChannel *ioc,
> >                  ioc = *outioc;
> >                  if (aio_context) {
> >                      qio_channel_set_blocking(ioc, false, NULL);
> > -                    qio_channel_attach_aio_context(ioc, aio_context);
> > +                    qio_channel_set_follow_coroutine_ctx(ioc, true);
> 
> This is actually unreachable, aio_context is always NULL here.

Interesting, I will add a patch to remove the dead code. Thanks!

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

      reply	other threads:[~2023-08-24 17:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 23:45 [PATCH 0/2] io: follow coroutine AioContext in qio_channel_yield() Stefan Hajnoczi
2023-08-23 23:45 ` [PATCH 1/2] io: check there are no qio_channel_yield() coroutines during ->finalize() Stefan Hajnoczi
2023-08-24 11:01   ` Daniel P. Berrangé
2023-08-24 18:18   ` Eric Blake
2023-08-23 23:45 ` [PATCH 2/2] io: follow coroutine AioContext in qio_channel_yield() Stefan Hajnoczi
2023-08-24 11:26   ` Daniel P. Berrangé
2023-08-24 17:07     ` Stefan Hajnoczi
2023-08-24 18:26     ` Stefan Hajnoczi
2023-08-25  8:09       ` Daniel P. Berrangé
2023-08-24 16:09   ` Fabiano Rosas
2023-08-24 17:29     ` 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=20230824172923.GC1690425@fedora \
    --to=stefanha@redhat.com \
    --cc=Coiby.Xu@gmail.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=farosas@suse.de \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    /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).