[DTrace-devel] [PATCH v2] Implement TLS variables

Kris Van Hees kris.van.hees at oracle.com
Wed Nov 24 05:22:45 UTC 2021


On Tue, Nov 23, 2021 at 08:54:35PM -0500, Eugene Loh via DTrace-devel wrote:
> The tests refer often to "clause-local" variables, though I suspect
> "thread-local" is intended.

Correct.  Fixed in v3.

> On 11/23/21 2:46 AM, Kris Van Hees via DTrace-devel wrote:
> > Thread-local storage (TLS) variables are a form of dynamic variables in
> > DTrace.  They are implemented using a global BPF hash map, indexed using
> > a key value that is derived from the task ID and the variable ID (with
> > some special magic to handle the idle task that has TID 0 on all CPUs).
> > 
> > Access to the TLS variables is handled through a pre-compiled BPF
> > function : dt_get_tvar.  It returns the address of the storage location
> > for the given variable in the current task.  This is used for both load
> > and store operations.
> > 
> > The dvars BPF map contains an element at key 0 that contains a value of
> > all zeros.  This is used to initialize new TLS variables.
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list