[DTrace-devel] [oracle/dtrace-utils] ed0f9a: Implement TLS variables

euloh noreply at github.com
Thu Dec 2 19:07:40 UTC 2021


  Branch: refs/heads/dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: ed0f9a1560196b292c83966a65f19198ba6145b5
      https://github.com/oracle/dtrace-utils/commit/ed0f9a1560196b292c83966a65f19198ba6145b5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M bpf/Build
    M bpf/get_tvar.c
    R bpf/map_tvar.c
    R bpf/set_tvar.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dis.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_ident.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    A test/unittest/variables/tvar/err.D_OP_INCOMPAT.default_int.d
    A test/unittest/variables/tvar/err.limited_space.d
    A test/unittest/variables/tvar/err.limited_space.r
    A test/unittest/variables/tvar/tst.alignment-array.r
    A test/unittest/variables/tvar/tst.alignment-array.sh
    A test/unittest/variables/tvar/tst.alignment-char.r
    A test/unittest/variables/tvar/tst.alignment-char.sh
    A test/unittest/variables/tvar/tst.alignment-int.r
    A test/unittest/variables/tvar/tst.alignment-int.sh
    A test/unittest/variables/tvar/tst.alignment-long.r
    A test/unittest/variables/tvar/tst.alignment-long.sh
    A test/unittest/variables/tvar/tst.alignment-ptr.r
    A test/unittest/variables/tvar/tst.alignment-ptr.sh
    A test/unittest/variables/tvar/tst.alignment-short.r
    A test/unittest/variables/tvar/tst.alignment-short.sh
    A test/unittest/variables/tvar/tst.alignment-struct-2.r
    A test/unittest/variables/tvar/tst.alignment-struct-2.sh
    A test/unittest/variables/tvar/tst.alignment-struct.r
    A test/unittest/variables/tvar/tst.alignment-struct.sh
    A test/unittest/variables/tvar/tst.default_int.d
    A test/unittest/variables/tvar/tst.init.d
    A test/unittest/variables/tvar/tst.load_before_store.d
    A test/unittest/variables/tvar/tst.load_no_alloc.d
    A test/unittest/variables/tvar/tst.load_no_alloc.r
    A test/unittest/variables/tvar/tst.post_inc_lvar.d
    A test/unittest/variables/tvar/tst.post_inc_lvar.r
    A test/unittest/variables/tvar/tst.pre_inc_lvar.d
    A test/unittest/variables/tvar/tst.pre_inc_lvar.r
    A test/unittest/variables/tvar/tst.store-char.d
    A test/unittest/variables/tvar/tst.store-char.r
    A test/unittest/variables/tvar/tst.store_zero_deletes.d
    A test/unittest/variables/tvar/tst.store_zero_deletes.r
    A test/unittest/variables/tvar/tst.store_zero_nop.d
    A test/unittest/variables/tvar/tst.store_zero_nop.r
    A test/unittest/variables/tvar/tst.str-size.d
    A test/unittest/variables/tvar/tst.str-size.r
    A test/unittest/variables/tvar/tst.struct.d

  Log Message:
  -----------
  Implement TLS variables

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.

One test (variables/tvar/err.limited_space.d) is marked XFAIL because
there is no support for reporting drops just yet.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: abc4778aa02625bbd782260d5ac551746e9ce1aa
      https://github.com/oracle/dtrace-utils/commit/abc4778aa02625bbd782260d5ac551746e9ce1aa
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-02 (Thu, 02 Dec 2021)

  Changed paths:
    M bpf/basename.S
    M bpf/dirname.S

  Log Message:
  -----------
  Write 0 rather than '\0' in *.S files

Apparently, when one uses stb in a bpf/*.S file to write a '\0',
one writes a literal '0'.  This problem was not seen until the
basename/dirname patches were combined with
        cf1e9df28b95  Optimize dt_cg_store_val() for string values
Prior to that, we trusted the string-length prefix and truncated the
string before the literal '0'.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


Compare: https://github.com/oracle/dtrace-utils/compare/3e380b35cbcc...abc4778aa026



More information about the DTrace-devel mailing list