All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhuyangyang via <qemu-devel@nongnu.org>
To: <eblake@redhat.com>
Cc: <chenxiaoyu48@huawei.com>, <fam@euphon.net>,
	<luolongmin@huawei.com>, <qemu-block@nongnu.org>,
	<qemu-devel@nongnu.org>, <qemu-stable@nongnu.org>,
	<stefanha@redhat.com>, <suxiaodong1@huawei.com>,
	<wangyan122@huawei.com>, <yebiaoxiang@huawei.com>,
	<zhuyangyang14@huawei.com>
Subject: Re: [PATCH v1] coroutine: avoid inserting duplicate coroutine to co_queue_wakeup
Date: Tue, 26 Mar 2024 20:25:59 +0800	[thread overview]
Message-ID: <20240326122559.2777462-1-zhuyangyang14@huawei.com> (raw)
In-Reply-To: <wac6lbzuvpdyttfpuoeac4ygps2elzktf5dcw22wruaupqy5r6@sfausqavuvil>

On Mon, 25 Mar 2024 11:00:31 -0500 Eric Blake wrote:
> >  util/async.c | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/util/async.c b/util/async.c
> > index 0467890052..25fc1e6083 100644
> > --- a/util/async.c
> > +++ b/util/async.c
> > @@ -705,7 +705,18 @@ void aio_co_enter(AioContext *ctx, Coroutine *co)
> >      if (qemu_in_coroutine()) {
> >          Coroutine *self = qemu_coroutine_self();
> >          assert(self != co);
> > -        QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, co, co_queue_next);
> > +        /*
> > +         * If the Coroutine *co is already in the co_queue_wakeup, this
> > +         * repeated insertion will causes the loss of other queue element
> 
> s/causes/cause/
> 
> > +         * or infinite loop.
> > +         * For examplex:
> 
> s/examplex/example/
> 
> > +         * Head->a->b->c->NULL, after insert_tail(head, b) => Head->a->b->NULL
> > +         * Head->a-b>->NULL, after insert_tail(head, b) => Head->a->b->b...
> 
> s/b>->/b->/
> 
> > +         */
> > +        if (!co->co_queue_next.sqe_next &&
> > +            self->co_queue_wakeup.sqh_last != &co->co_queue_next.sqe_next) {
> > +            QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, co, co_queue_next);
> > +        }
> >      } else {
> >          qemu_aio_coroutine_enter(ctx, co);
> >      }
> 
> Intuitively, attacking the symptoms (avoiding bogus list insertion
> when it is already on the list) makes sense; but I want to make sure
> we attack the root cause.

Repairing the nbd_negotiate_handle_starttls() can solve this problem, therefore,
I'm not sure if this commit is still needed.

--
Best Regards,
Zhu Yangyang



  reply	other threads:[~2024-03-26 12:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25  9:18 [PATCH v1] coroutine: avoid inserting duplicate coroutine to co_queue_wakeup zhuyangyang via
2024-03-25 15:50 ` Stefan Hajnoczi
2024-03-26 11:53   ` zhuyangyang via
2024-03-27 22:13   ` Eric Blake
2024-03-28  8:54     ` Kevin Wolf
2024-03-25 16:00 ` Eric Blake
2024-03-26 12:25   ` zhuyangyang via [this message]
2024-03-28 12:40 ` Eric Blake
2024-03-29 13:09   ` Zhu Yangyang via
2024-04-01  8:04   ` Zhu Yangyang via

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=20240326122559.2777462-1-zhuyangyang14@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=chenxiaoyu48@huawei.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=luolongmin@huawei.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=suxiaodong1@huawei.com \
    --cc=wangyan122@huawei.com \
    --cc=yebiaoxiang@huawei.com \
    --cc=zhuyangyang14@huawei.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 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.