From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: Re: 9pfs: Twalk crash
Date: Wed, 01 Sep 2021 16:21:06 +0200 [thread overview]
Message-ID: <1825588.ABy5TKrSrS@silver> (raw)
In-Reply-To: <37058587.QroWqLRJlK@silver>
On Mittwoch, 1. September 2021 14:49:37 CEST Christian Schoenebeck wrote:
> > > And it triggered, however I am not sure if some of those functions I
> > > asserted above are indeed allowed to be executed on a different thread
> > > than main thread:
> > >
> > > Program terminated with signal SIGABRT, Aborted.
> > > #0 __GI_raise (sig=sig@entry=6) at
> > > ../sysdeps/unix/sysv/linux/raise.c:50
> > > 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> > > [Current thread is 1 (Thread 0x7fd0bcef1700 (LWP 6470))]
> >
> > Based in the thread number, it seems that the signal was raised by
> > the main event thread...
>
> No, it was not main thread actually, gdb's "current thread is 1" output is
> misleading.
>
> Following the thread id trace, I extended the thread assertion checks over
> to v9fs_walk() as well, like this:
>
> static void coroutine_fn v9fs_walk(void *opaque)
> {
> ...
> assert_thread();
> v9fs_co_run_in_worker({
> ...
> });
> assert_thread();
> ...
> }
>
> and made sure the reference thread id to be compared is really the main
> thread.
>
> And what happens here is before v9fs_co_run_in_worker() is entered,
> v9fs_walk() runs on main thread, but after returning from
> v9fs_co_run_in_worker() it runs on a different thread for some reason, not
> on main thread as it would be expected at that point.
Ok, I think I found the root cause: the block is break;-ing out too far. The
following patch should fix it:
diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index c51289903d..f83c7dda7b 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -51,7 +51,9 @@
*/ \
qemu_coroutine_yield(); \
qemu_bh_delete(co_bh); \
- code_block; \
+ do { \
+ code_block; \
+ } while (0); \
/* re-enter back to qemu thread */ \
qemu_coroutine_yield(); \
} while (0)
I haven't triggered a crash with that patch, but due to the occasional nature
of this issue I'll give it some more spins before officially proclaiming it my
bug. :)
Best regards,
Christian Schoenebeck
next prev parent reply other threads:[~2021-09-01 14:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 15:55 9pfs: Twalk crash Christian Schoenebeck
2021-08-31 10:57 ` Greg Kurz
2021-08-31 15:00 ` Christian Schoenebeck
2021-08-31 17:04 ` Greg Kurz
2021-09-01 12:49 ` Christian Schoenebeck
2021-09-01 14:21 ` Christian Schoenebeck [this message]
2021-09-01 15:41 ` Greg Kurz
2021-09-01 16:07 ` Christian Schoenebeck
2021-09-01 16:31 ` Greg Kurz
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=1825588.ABy5TKrSrS@silver \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.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 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).