qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org, mst@redhat.com, quintela@redhat.com,
	peterx@redhat.com, leobras@redhat.com, stefanha@redhat.com,
	pbonzini@redhat.com, qemu-block@nongnu.org,
	qemu-stable@nongnu.org
Subject: Re: [PATCH 2/2] virtio: Drop out of coroutine context in virtio_load()
Date: Tue, 17 Oct 2023 10:48:02 +0200	[thread overview]
Message-ID: <ZS5KQk1fqa+dm8yE@redhat.com> (raw)
In-Reply-To: <0f479df3-2563-4186-b83b-be1dc2fcae8a@tls.msk.ru>

Am 17.10.2023 um 07:19 hat Michael Tokarev geschrieben:
> 05.09.2023 17:50, Kevin Wolf wrote:
> > virtio_load() as a whole should run in coroutine context because it
> > reads from the migration stream and we don't want this to block.
> > 
> > However, it calls virtio_set_features_nocheck() and devices don't
> > expect their .set_features callback to run in a coroutine and therefore
> > call functions that may not be called in coroutine context. To fix this,
> > drop out of coroutine context for calling virtio_set_features_nocheck().
> ...
> > Cc: qemu-stable@nongnu.org
> > Buglink: https://issues.redhat.com/browse/RHEL-832
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> 
> It looks like this change caused an interesting regression,
>   https://gitlab.com/qemu-project/qemu/-/issues/1933
> at least in -stable.  Can you take a look please?

Huh?! This is an interesting one indeed.

I can't see any direct connection between the patch and this regression.
Random memory corruption is the only explanation I have. But I'm not
sure how this patch could cause it, it's quite simple.

The next step is probably trying to find a simple reproducer on the QEMU
level. And then maybe valgrind or we could get stack traces for the
call to virtio_set_features_nocheck_maybe_co(). Also the stack trace for
the crash and maybe the content of 's' would be interesting - we can ask
the reporter for that, the core dump should be enough for that.

Another potentially interesting question is whether after yielding, the
coroutine is indeed reentered from the aio_co_wake() call in the patch
or if something else wakes it up. If it were the latter, that could
explain memory corruption.

> BTW, Kevin, do you have account @gitlab?

Yes, @kmwolf.

Kevin



  reply	other threads:[~2023-10-17  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 14:50 [PATCH 0/2] virtio: Drop out of coroutine context in virtio_load() Kevin Wolf
2023-09-05 14:50 ` [PATCH 1/2] vmstate: Mark VMStateInfo.get/put() coroutine_mixed_fn Kevin Wolf
2023-09-05 15:06   ` Peter Xu
2023-09-05 14:50 ` [PATCH 2/2] virtio: Drop out of coroutine context in virtio_load() Kevin Wolf
2023-09-07 18:40   ` Stefan Hajnoczi
2023-09-08  8:59     ` Kevin Wolf
2023-09-08 10:46       ` Stefan Hajnoczi
2023-10-17  5:19   ` Michael Tokarev
2023-10-17  8:48     ` Kevin Wolf [this message]
2023-10-17 13:06     ` Juan Quintela
2023-09-07 18:42 ` [PATCH 0/2] " Stefan Hajnoczi
2023-09-08  8:53   ` Kevin Wolf
2023-09-08 10:46 ` 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=ZS5KQk1fqa+dm8yE@redhat.com \
    --to=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=quintela@redhat.com \
    --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).