Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-27 Thread Stefan Hajnoczi
On Tue, Oct 26, 2021 at 10:10:44AM -0700, Richard Henderson wrote: > 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

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-27 Thread Kevin Wolf
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

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-26 Thread Richard Henderson
On 10/26/21 10:26 AM, Thomas Huth wrote: Would it maybe make sense to tweak check_patch.pl to forbid __thread in certain folders only, e.g. block/ and util/ (i.e. where we know that there might be code that the iothreads are using)? This sounds plausible; hw/ too, perhaps. r~

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-26 Thread Thomas Huth
On 26/10/2021 19.10, Richard Henderson wrote: 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

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-26 Thread Richard Henderson
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

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-26 Thread Stefan Hajnoczi
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

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-26 Thread Richard Henderson
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

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-26 Thread Stefan Hajnoczi
On Mon, Oct 25, 2021 at 05:27:29PM -0600, Warner Losh wrote: > On Mon, Oct 25, 2021 at 10:18 AM Richard Henderson < > richard.hender...@linaro.org> wrote: > > > On 10/25/21 7:07 AM, Stefan Hajnoczi wrote: > > > This is a preview of how we can solve the coroutines TLS problem. > > Coroutines > > >

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-25 Thread Warner Losh
On Mon, Oct 25, 2021 at 10:18 AM Richard Henderson < richard.hender...@linaro.org> wrote: > On 10/25/21 7:07 AM, Stefan Hajnoczi wrote: > > This is a preview of how we can solve the coroutines TLS problem. > Coroutines > > re-entered from another thread sometimes see stale TLS values. This >

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-25 Thread Richard Henderson
On 10/25/21 7:07 AM, Stefan Hajnoczi wrote: This is a preview of how we can solve the coroutines TLS problem. Coroutines re-entered from another thread sometimes see stale TLS values. This happens because compilers may cache values across yield points, so a value from the previous thread will be

Re: [RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-25 Thread Philippe Mathieu-Daudé
+Richard/Peter On 10/25/21 16:07, Stefan Hajnoczi wrote: > This is a preview of how we can solve the coroutines TLS problem. Coroutines > re-entered from another thread sometimes see stale TLS values. This happens > because compilers may cache values across yield points, so a value from the >

[RFC 0/2] tls: add macros for coroutine-safe TLS variables

2021-10-25 Thread Stefan Hajnoczi
This is a preview of how we can solve the coroutines TLS problem. Coroutines re-entered from another thread sometimes see stale TLS values. This happens because compilers may cache values across yield points, so a value from the previous thread will be used when the coroutine is re-entered in