qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Daniel P . Berrangé
Subject: Re: [RFC 1/2] tls: add macros for coroutine-safe TLS variables
Date: Mon, 25 Oct 2021 15:14:36 +0100
User-agent: Mutt/2.0.7 (2021-05-04)

On Mon, Oct 25, 2021 at 03:07:15PM +0100, Stefan Hajnoczi wrote:
> Compiler optimizations can cache TLS values across coroutine yield
> points, resulting in stale values from the previous thread when a
> coroutine is re-entered by a new thread.
> 
> Serge Guelton developed an __attribute__((noinline)) wrapper and tested
> it with clang and gcc. I formatted his idea according to QEMU's coding
> style and wrote documentation.
> 
> These macros must be used instead of __thread from now on to prevent
> coroutine TLS bugs.

Does this apply to all  __thread usage in the QEMU process that can
be used from coroutine context, or just certain __thread usage ?

Mostly I'm wondering if this is going to have implications on external
libraries we use. eg if block layer is using librbd.so APIs, is librbd.sp
safe to use __thread directly in any way it desires ?


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]