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

2021-12-06 Thread Stefan Hajnoczi
v3: - Added __attribute__((weak)) to get_ptr_*() [Florian] - Replace rdfsbase with mov %%fs:0,%0 [Florian] This patch series solves the coroutines TLS problem. Coroutines re-entered from another thread sometimes see stale TLS values. This happens because compilers may cache values across yield poi

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

2021-12-06 Thread Peter Maydell
On Mon, 6 Dec 2021 at 14:33, Stefan Hajnoczi wrote: > > v3: > - Added __attribute__((weak)) to get_ptr_*() [Florian] Do we really need it *only* on get_ptr_*() ? If we need to noinline the other two we probably also should use the same attribute weak to force no optimizations at all. -- PMM

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

2021-12-07 Thread Stefan Hajnoczi
On Mon, Dec 06, 2021 at 02:34:45PM +, Peter Maydell wrote: > On Mon, 6 Dec 2021 at 14:33, Stefan Hajnoczi wrote: > > > > v3: > > - Added __attribute__((weak)) to get_ptr_*() [Florian] > > Do we really need it *only* on get_ptr_*() ? If we need to > noinline the other two we probably also shou

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

2021-12-07 Thread Stefan Hajnoczi
On Mon, Dec 06, 2021 at 02:34:45PM +, Peter Maydell wrote: > On Mon, 6 Dec 2021 at 14:33, Stefan Hajnoczi wrote: > > > > v3: > > - Added __attribute__((weak)) to get_ptr_*() [Florian] > > Do we really need it *only* on get_ptr_*() ? If we need to > noinline the other two we probably also shou

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

2021-12-07 Thread Peter Maydell
On Tue, 7 Dec 2021 at 13:53, Stefan Hajnoczi wrote: > > On Mon, Dec 06, 2021 at 02:34:45PM +, Peter Maydell wrote: > > On Mon, 6 Dec 2021 at 14:33, Stefan Hajnoczi wrote: > > > > > > v3: > > > - Added __attribute__((weak)) to get_ptr_*() [Florian] > > > > Do we really need it *only* on get_pt

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

2021-12-07 Thread Stefan Hajnoczi
On Tue, Dec 07, 2021 at 01:55:34PM +, Peter Maydell wrote: > On Tue, 7 Dec 2021 at 13:53, Stefan Hajnoczi wrote: > > > > On Mon, Dec 06, 2021 at 02:34:45PM +, Peter Maydell wrote: > > > On Mon, 6 Dec 2021 at 14:33, Stefan Hajnoczi wrote: > > > > > > > > v3: > > > > - Added __attribute__((

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

2021-12-13 Thread Stefan Hajnoczi
On Tue, Dec 07, 2021 at 01:55:34PM +, Peter Maydell wrote: > On Tue, 7 Dec 2021 at 13:53, Stefan Hajnoczi wrote: > > > > On Mon, Dec 06, 2021 at 02:34:45PM +, Peter Maydell wrote: > > > On Mon, 6 Dec 2021 at 14:33, Stefan Hajnoczi wrote: > > > > > > > > v3: > > > > - Added __attribute__((