From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: fweimer@redhat.com, "Fam Zheng" <fam@euphon.net>,
thuth@redhat.com, "Daniel P. Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
sguelton@redhat.com
Subject: Re: [RFC 1/2] tls: add macros for coroutine-safe TLS variables
Date: Tue, 26 Oct 2021 17:26:06 +0100 [thread overview]
Message-ID: <YXgsHghh2BCrb1S0@stefanha-x1.localdomain> (raw)
In-Reply-To: <YXgMSFJhfE6mdVIq@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]
On Tue, Oct 26, 2021 at 04:10:16PM +0200, Kevin Wolf wrote:
> Am 26.10.2021 um 15:41 hat Stefan Hajnoczi geschrieben:
> > Actually, nevermind what I said about the callback scenario. I don't
> > think that is a problem because the compiler cannot assume the __thread
> > variable remains unchanged across the callback. Therefore it cannot
> > safely cache the value.
>
> And additionally, I think callbacks are never coroutine_fn (especially
> not if they come from an external library), so they must not yield
> anyway.
There's a tiny chance that the third-party library was called from
coroutine context and the callback invokes a non-coroutine_fn that uses
qemu_in_coroutine() to dynamically decide it's possible to yield. But it
seems very unlikely.
> > So I think only the header file scenario is a problem.
>
> The mere existence of a __thread variable in the header file isn't a
> problem either, but if QEMU accesses it, we would have to implement
> wrappers similar to what you're proposing for QEMU's thread local
> variables.
There could be static inline functions that access it in the header
file. If QEMU calls those functions then the compiler can optimize that.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-10-26 16:29 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 [this message]
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
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=YXgsHghh2BCrb1S0@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=berrange@redhat.com \
--cc=fam@euphon.net \
--cc=fweimer@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sguelton@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).