From: Kevin Wolf <kwolf@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: fweimer@redhat.com, Fam Zheng <fam@euphon.net>,
Thomas Huth <thuth@redhat.com>,
"open list:Block layer core" <qemu-block@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
Warner Losh <imp@bsdimp.com>,
sguelton@redhat.com
Subject: Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables
Date: Wed, 27 Oct 2021 12:38:17 +0200 [thread overview]
Message-ID: <YXksGaeG9HC3Jh6M@redhat.com> (raw)
In-Reply-To: <4b8a5b71-0ec2-7c2c-6929-de303ec29a53@linaro.org>
Am 26.10.2021 um 19:10 hat Richard Henderson geschrieben:
> On 10/26/21 9:34 AM, Stefan Hajnoczi wrote:
> > On Tue, Oct 26, 2021 at 08:10:16AM -0700, Richard Henderson wrote:
> > > On 10/26/21 6:22 AM, Stefan Hajnoczi wrote:
> > > > If "safe" TLS variables are opt-in then we'll likely have obscure bugs
> > > > when code changes to access a TLS variable that was previously never
> > > > accessed from a coroutine. There is no compiler error and no way to
> > > > detect this. When it happens debugging it is painful.
> > >
> > > Co-routines are never used in user-only builds.
> >
> > If developers have the choice of using __thread then bugs can slip
> > through.
>
> Huh? How. No, really.
>
> > Are you concerned about performance, the awkwardness of calling
> > getters/setters, or something else for qemu-user?
>
> Awkwardness first, performance second.
>
> I'll also note that coroutines never run on vcpu threads, only io threads.
> So I'll resist any use of these interfaces in TCG as well.
This is wrong. Device emulation is called from vcpu threads, and it
calls into code using coroutines. Using dedicated iothreads is
possible for some devices, but not the default.
In fact, this is probably where the most visible case of the bug comes
from: A coroutine is created in the vcpu thread (while holding the BQL)
and after yielding first, it is subsequently reentered from the main
thread. This is exactly the same pattern as you often get with
callbacks, where the request is made in the vcpu thread and the callback
is run in the main thread.
Kevin
next prev parent reply other threads:[~2021-10-27 10:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 14:07 [RFC 0/2] tls: add macros for coroutine-safe TLS variables Stefan Hajnoczi
2021-10-25 14:07 ` [RFC 1/2] " Stefan Hajnoczi
2021-10-25 14:14 ` Daniel P. Berrangé
2021-10-26 13:36 ` Stefan Hajnoczi
2021-10-26 13:41 ` Stefan Hajnoczi
2021-10-26 14:10 ` Kevin Wolf
2021-10-26 16:26 ` Stefan Hajnoczi
2021-10-25 17:19 ` Richard Henderson
2021-10-26 13:30 ` Stefan Hajnoczi
2021-10-26 15:32 ` Richard Henderson
2021-10-26 16:27 ` Stefan Hajnoczi
2021-10-25 14:07 ` [RFC 2/2] util/async: replace __thread with QEMU TLS macros Stefan Hajnoczi
2021-10-25 14:20 ` [RFC 0/2] tls: add macros for coroutine-safe TLS variables Philippe Mathieu-Daudé
2021-10-25 16:16 ` Richard Henderson
2021-10-25 23:27 ` Warner Losh
2021-10-26 13:22 ` Stefan Hajnoczi
2021-10-26 15:10 ` Richard Henderson
2021-10-26 16:34 ` Stefan Hajnoczi
2021-10-26 17:10 ` Richard Henderson
2021-10-26 17:26 ` Thomas Huth
2021-10-26 18:03 ` Richard Henderson
2021-10-27 10:38 ` Kevin Wolf [this message]
2021-10-27 12:34 ` 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=YXksGaeG9HC3Jh6M@redhat.com \
--to=kwolf@redhat.com \
--cc=fam@euphon.net \
--cc=fweimer@redhat.com \
--cc=imp@bsdimp.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sguelton@redhat.com \
--cc=stefanha@redhat.com \
--cc=thuth@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).