[DTrace-devel] [oracle/dtrace-utils] 1abd92: Fix some typos in NEWS file.

Kris Van Hees noreply at github.com
Wed Dec 2 19:54:52 PST 2020


  Branch: refs/heads/2.0-branch-dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: 1abd9234d4e6929f3d938903eff9559ff686f5d9
      https://github.com/oracle/dtrace-utils/commit/1abd9234d4e6929f3d938903eff9559ff686f5d9
  Author: Elena Zannoni <elena.zannoni at oracle.com>
  Date:   2020-10-13 (Tue, 13 Oct 2020)

  Changed paths:
    M NEWS

  Log Message:
  -----------
  Fix some typos in NEWS file.

Fix typoes.

Formatting fixes:
	- Format the dates so they have the same pattern
	- Split Kernel release: items into their own subsections
	- Use "Known problems" all over
	- Indent by 4 spaces the indented lists
	- Remove extra "Bugfixes:" line
	- Indent regular bullet item by 1 space only

Signed-off-by: Elena Zannoni <elena.zannoni at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 203ad4cb3a603f4120751ba92a974b69925437a2
      https://github.com/oracle/dtrace-utils/commit/203ad4cb3a603f4120751ba92a974b69925437a2
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-10-14 (Wed, 14 Oct 2020)

  Changed paths:
    M GNUmakefile
    M libdtrace/Build

  Log Message:
  -----------
  Ensure that bash is used as shell for building

The makefiles depend on POSIX features such as [[ ... ]] that are not
available in the default shell on some distributions like Debian and
Ubuntu.  Explicitly require bash to be used as shell.

This also reverts a previous patch that replaced the [[ ... ]] construct
with the use of the 'test' command (4506ce52 "Support building when shell
is sh.").

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: bf93f27fc8f1424eb2060d7d9b6c111a75418b24
      https://github.com/oracle/dtrace-utils/commit/bf93f27fc8f1424eb2060d7d9b6c111a75418b24
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-10-14 (Wed, 14 Oct 2020)

  Changed paths:
    M bpf/Build

  Log Message:
  -----------
  Ensure linux/bpf.h can be found during the BPF compiler check

The makefile recipe to verify correct behaviour of the BPF compiler
depends on linux/bpf.h, but no dependency was in place to ensure that
the include hierarchy was set up correctly prior to executing the test.

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


  Commit: a38a40f7412987cd19f7c13e89f54dd1b4e2cf31
      https://github.com/oracle/dtrace-utils/commit/a38a40f7412987cd19f7c13e89f54dd1b4e2cf31
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2020-10-19 (Mon, 19 Oct 2020)

  Changed paths:
    M libdtrace/dt_work.c
    A test/unittest/actions/exit/tst.kill.sh

  Log Message:
  -----------
  END clause does not execute when consumer stops the producer

The END probe's clause does not execute when the consumer requests
tracing to stop.  One example is when the user sends a SIGINT to the
dtrace command-line tool and it calls dtrace_stop().  This problem
would also occur once -c is supported and the specified command finishes.

The problem is that the END probe checks that the activity state is
DRAINING before executing its clause, but DRAINING is set only by
calling the D exit() action.

Before calling END_probe(), advance the activity state to DRAINING if
it is not yet that far.  Add a test for this problem.

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


  Commit: 3a64442c390015b265af116aefc74e926cc37065
      https://github.com/oracle/dtrace-utils/commit/3a64442c390015b265af116aefc74e926cc37065
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2020-10-20 (Tue, 20 Oct 2020)

  Changed paths:
    M libdtrace/dt_program.c
    A test/unittest/syscall/tst.entry.d
    A test/unittest/syscall/tst.entry.r

  Log Message:
  -----------
  sdt and syscall probe descriptions broken when multiple probes

The sdt and syscall providers are broken in that, when a probe
description corresponds to multiple probes, a BPF program is
attached to only one of the probes.  E.g., syscall:::entry will
attach a BPF program to only one probe, even though hundreds of
probes are indicated!  The problem is that the attach function
looks for an event_id, skipping the probe if there is no such ID,
but the ID exists for only the "representative probe."

Therefore, call dt_probe_info() when we append probes to the
dt_enablings list.

What is surprising is that, with this fix, there are no XPASS
tests.  That is, there had presumably been no XFAIL tests
("expected fails") that had been failing due *only* to this
problem.  A quick survey of tests suggests that this is likely;
remarkably few tests rely on such functionality, and those that
do still fail due to other missing support (such as strings or
other providers).

Therefore, add a test to check the fix.

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


  Commit: 1ca381c528e59f52aa15ac44ae2d2aef13a6c170
      https://github.com/oracle/dtrace-utils/commit/1ca381c528e59f52aa15ac44ae2d2aef13a6c170
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

  Changed paths:
    M libdtrace/dt_ident.c
    M libdtrace/dt_ident.h

  Log Message:
  -----------
  Add storage offset support in dt_ident_t and dt_idhash_t

Variables (especially of a complex type) and aggregations will need
to be allocated from a memory block.  They will therefore require a
storage offset to be associated with them so that the code generator
can access the correct memory locations.

The dt_ident_t structure now has a di_offset member to hold the
storage offset for the identifier (if applicable) and the dt_idhash_t
structure has a dh_nextoff member to hold the offset to allocate the
next item at.

The dt_idhash_nextoff(dt_idhash_t *dhp, uint_t alignment, uint_t size)
function will return the offset where the next data item is to be
allocated.  The size argument specifies the size (in bytes) of the
data item.  The returned value is guaranteed to be properly aligned to
the number of bytes specified by the alignment argument, and the next
offset member (dh_nextoff in dt_idhash_t) will be advanced by the
given number of bytes.

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


  Commit: 287e4bf30dec9f524cfc796f9155f549c13bf96e
      https://github.com/oracle/dtrace-utils/commit/287e4bf30dec9f524cfc796f9155f549c13bf96e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_dlibs.c
    M test/unittest/codegen/tst.stack_layout.r

  Log Message:
  -----------
  Implement a 'aggs' per-CPU BPF map to store aggregation data

Aggregation data consists of data items (all uint64_t) that are updated
when an aggregation function is executed.  This is quite different from
other data recording actions that append data to an output buffer.

We need support for concurrency control to allow reading the data during
non-atomic updates.  We use a latch mechanism, i.e. a multiversion
concurrency control mechanism, to satify these requirements.

Simply put, the per-CPU aggregation data area stores a sequence id that
tracks the generation of the data updates.  Since only one aggregation
can be updated at a time on a single CPU, one latch is sufficient for
all aggregations (per CPU-buffer).  We also allocate two copies of each
aggregation, which we will call A and B.

When we update the aggregation data, we first modify A and then we modify
B, while ensuring that while we modify one, the reader is directed to
read from the other.

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


  Commit: cbba0c7b8caf7e13642abdff282f79b01fca71fd
      https://github.com/oracle/dtrace-utils/commit/cbba0c7b8caf7e13642abdff282f79b01fca71fd
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

  Changed paths:
    M include/dtrace/dif_defines.h
    M libdtrace/dt_as.c
    M libdtrace/dt_dis.c

  Log Message:
  -----------
  Include aggregates in the DIFO vartab

Aggregates used to be handled as special identifiers.  Under the new
design they will be handled more like variables and it is therefore
warranted to include them in the variable table.

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


  Commit: 85c8512318e3082abccccb69132b19b38d3546ed
      https://github.com/oracle/dtrace-utils/commit/85c8512318e3082abccccb69132b19b38d3546ed
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_cg.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    R test/unittest/aggs/err.D_AGG_FUNC.bad.d
    A test/unittest/aggs/err.D_AGG_FUNC.non_agg_func.d
    R test/unittest/aggs/err.D_AGG_MDIM.bad.d
    A test/unittest/aggs/err.D_AGG_MDIM.multi_dim.d
    R test/unittest/aggs/err.D_AGG_NULL.bad.d
    A test/unittest/aggs/err.D_AGG_NULL.idx_no_func.d
    A test/unittest/aggs/err.D_AGG_NULL.no_func.d
    A test/unittest/aggs/err.D_AGG_REDEF.diff_funcs.d
    R test/unittest/aggs/err.D_AGG_REDEF.redef.d
    A test/unittest/aggs/err.D_AGG_SCALAR.avg_str_val.d
    R test/unittest/aggs/err.D_AGG_SCALAR.avgtoofew.d
    A test/unittest/aggs/err.D_AGG_SCALAR.llquantize_str_val.d
    A test/unittest/aggs/err.D_AGG_SCALAR.lquantize_str_val.d
    A test/unittest/aggs/err.D_AGG_SCALAR.max_str_val.d
    R test/unittest/aggs/err.D_AGG_SCALAR.maxnoarg.d
    A test/unittest/aggs/err.D_AGG_SCALAR.min_str_val.d
    R test/unittest/aggs/err.D_AGG_SCALAR.mintoofew.d
    A test/unittest/aggs/err.D_AGG_SCALAR.quantize_str_val.d
    R test/unittest/aggs/err.D_AGG_SCALAR.quantizetoofew.d
    A test/unittest/aggs/err.D_AGG_SCALAR.stddev_str_val.d
    A test/unittest/aggs/err.D_AGG_SCALAR.sum_str_val.d
    R test/unittest/aggs/err.D_AGG_SCALAR.sumtoofew.d
    R test/unittest/aggs/err.D_FUNC_IDENT.bad.d
    A test/unittest/aggs/err.D_FUNC_IDENT.probe_as_func.d
    M test/unittest/aggs/err.D_FUNC_UNDEF.badaggfunc.d
    R test/unittest/aggs/err.D_IDENT_UNDEF.badexpr.d
    R test/unittest/aggs/err.D_IDENT_UNDEF.badkey3.d
    A test/unittest/aggs/err.D_IDENT_UNDEF.no_func.d
    R test/unittest/aggs/err.D_IDENT_UNDEF.noeffect.d
    A test/unittest/aggs/err.D_KEY_TYPE.agg_key.d
    R test/unittest/aggs/err.D_KEY_TYPE.badkey1.d
    R test/unittest/aggs/err.D_KEY_TYPE.badkey2.d
    R test/unittest/aggs/err.D_KEY_TYPE.badkey4.d
    A test/unittest/aggs/err.D_KEY_TYPE.dyn_expr_key.d
    A test/unittest/aggs/err.D_KEY_TYPE.void_key.d
    A test/unittest/aggs/err.D_LLQUANT_FACTORTYPE.d
    R test/unittest/aggs/err.D_LLQUANT_FACTORTYPE.llqbadfactor.d
    R test/unittest/aggs/err.D_LLQUANT_FACTORVAL.llqdividesteps.d
    R test/unittest/aggs/err.D_LLQUANT_FACTORVAL.llqfactortoobig.d
    R test/unittest/aggs/err.D_LLQUANT_FACTORVAL.llqfactortoosmall.d
    R test/unittest/aggs/err.D_LLQUANT_FACTORVAL.llqgreaterthansteps.d
    A test/unittest/aggs/err.D_LLQUANT_FACTORVAL.too_big.d
    A test/unittest/aggs/err.D_LLQUANT_FACTORVAL.too_small.d
    A test/unittest/aggs/err.D_LLQUANT_HMAGTYPE.d
    R test/unittest/aggs/err.D_LLQUANT_HMAGTYPE.llqbadhmag.d
    R test/unittest/aggs/err.D_LLQUANT_HMAGVAL.llqhmagtoobig.d
    R test/unittest/aggs/err.D_LLQUANT_HMAGVAL.llqhmagtoobig2.d
    R test/unittest/aggs/err.D_LLQUANT_HMAGVAL.llqlessthanlmag.d
    A test/unittest/aggs/err.D_LLQUANT_HMAGVAL.lt_lmag.d
    A test/unittest/aggs/err.D_LLQUANT_HMAGVAL.neg.d
    A test/unittest/aggs/err.D_LLQUANT_HMAGVAL.overflow.d
    A test/unittest/aggs/err.D_LLQUANT_HMAGVAL.too_big.d
    A test/unittest/aggs/err.D_LLQUANT_LMAGTYPE.d
    R test/unittest/aggs/err.D_LLQUANT_LMAGTYPE.llqbadlmag.d
    R test/unittest/aggs/err.D_LLQUANT_LMAGVAL.llqlmagtoobig.d
    A test/unittest/aggs/err.D_LLQUANT_LMAGVAL.neg.d
    A test/unittest/aggs/err.D_LLQUANT_LMAGVAL.too_big.d
    M test/unittest/aggs/err.D_LLQUANT_MATCHFACTOR.d
    M test/unittest/aggs/err.D_LLQUANT_MATCHHMAG.d
    M test/unittest/aggs/err.D_LLQUANT_MATCHLMAG.d
    M test/unittest/aggs/err.D_LLQUANT_MATCHSTEPS.d
    A test/unittest/aggs/err.D_LLQUANT_STEPTYPE.d
    R test/unittest/aggs/err.D_LLQUANT_STEPTYPE.llqbadsteps.d
    A test/unittest/aggs/err.D_LLQUANT_STEPVAL.factor_divides_steps_1.d
    A test/unittest/aggs/err.D_LLQUANT_STEPVAL.factor_divides_steps_2.d
    A test/unittest/aggs/err.D_LLQUANT_STEPVAL.factor_divides_steps_3.d
    R test/unittest/aggs/err.D_LLQUANT_STEPVAL.llqdividepoweroffactor.d
    R test/unittest/aggs/err.D_LLQUANT_STEPVAL.llqdividepoweroffactor2.d
    R test/unittest/aggs/err.D_LLQUANT_STEPVAL.llqstepstoobig.d
    A test/unittest/aggs/err.D_LLQUANT_STEPVAL.lt_factor.d
    A test/unittest/aggs/err.D_LLQUANT_STEPVAL.neg.d
    A test/unittest/aggs/err.D_LLQUANT_STEPVAL.too_big.d
    R test/unittest/aggs/err.D_LQUANT_BASETYPE.lqbad1.d
    R test/unittest/aggs/err.D_LQUANT_BASETYPE.lqshort.d
    A test/unittest/aggs/err.D_LQUANT_BASETYPE.var.d
    R test/unittest/aggs/err.D_LQUANT_BASEVAL.bad.d
    A test/unittest/aggs/err.D_LQUANT_BASEVAL.too_big.d
    A test/unittest/aggs/err.D_LQUANT_BASEVAL.too_small.d
    R test/unittest/aggs/err.D_LQUANT_LIMTYPE.lqbad1.d
    A test/unittest/aggs/err.D_LQUANT_LIMTYPE.var.d
    R test/unittest/aggs/err.D_LQUANT_LIMVAL.bad.d
    A test/unittest/aggs/err.D_LQUANT_LIMVAL.too_big.d
    A test/unittest/aggs/err.D_LQUANT_LIMVAL.too_small.d
    M test/unittest/aggs/err.D_LQUANT_MATCHBASE.d
    R test/unittest/aggs/err.D_LQUANT_MATCHBASE.order.d
    M test/unittest/aggs/err.D_LQUANT_MATCHLIM.d
    R test/unittest/aggs/err.D_LQUANT_MATCHLIM.order.d
    M test/unittest/aggs/err.D_LQUANT_MATCHSTEP.d
    A test/unittest/aggs/err.D_LQUANT_MISMATCH.d
    R test/unittest/aggs/err.D_LQUANT_MISMATCH.lqbadarg.d
    A test/unittest/aggs/err.D_LQUANT_STEPLARGE.d
    R test/unittest/aggs/err.D_LQUANT_STEPLARGE.lqtoofew.d
    R test/unittest/aggs/err.D_LQUANT_STEPSMALL.bad.d
    A test/unittest/aggs/err.D_LQUANT_STEPSMALL.d
    A test/unittest/aggs/err.D_LQUANT_STEPTYPE.d
    R test/unittest/aggs/err.D_LQUANT_STEPTYPE.lqbadinc.d
    A test/unittest/aggs/err.D_LQUANT_STEPTYPE.neg.d
    A test/unittest/aggs/err.D_LQUANT_STEPTYPE.zero.d
    R test/unittest/aggs/err.D_LQUANT_STEPVAL.bad.d
    A test/unittest/aggs/err.D_LQUANT_STEPVAL.too_big.d
    A test/unittest/aggs/err.D_OP_INCOMPAT.agg_in_expr.d
    A test/unittest/aggs/err.D_PROTO_ARG.llquantize_non_scalar_incr.d
    A test/unittest/aggs/err.D_PROTO_ARG.lquantize_non_scalar_incr.d
    R test/unittest/aggs/err.D_PROTO_ARG.lquantizetoofew.d
    A test/unittest/aggs/err.D_PROTO_ARG.quantize_non_scalar_incr.d
    A test/unittest/aggs/err.D_PROTO_LEN.avg_missing_arg.d
    A test/unittest/aggs/err.D_PROTO_LEN.avg_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.avgnoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.avgtoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.count_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.counttoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.llquantize_too_few_args.d
    A test/unittest/aggs/err.D_PROTO_LEN.llquantize_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.llquantizenoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.llquantizetoofew.d
    R test/unittest/aggs/err.D_PROTO_LEN.llquantizetoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.lquantize_too_few_args.d
    A test/unittest/aggs/err.D_PROTO_LEN.lquantize_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.lquantizenoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.lquantizetoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.max_missing_arg.d
    A test/unittest/aggs/err.D_PROTO_LEN.max_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.maxnoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.maxtoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.min_missing_arg.d
    A test/unittest/aggs/err.D_PROTO_LEN.min_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.minnoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.mintoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.quantize_missing_arg.d
    A test/unittest/aggs/err.D_PROTO_LEN.quantize_too_amny_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.quantizenoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.quantizetoomany.d
    A test/unittest/aggs/err.D_PROTO_LEN.stddev_missing_arg.d
    A test/unittest/aggs/err.D_PROTO_LEN.stddev_too_many_args.d
    A test/unittest/aggs/err.D_PROTO_LEN.sum_missing_arg.d
    A test/unittest/aggs/err.D_PROTO_LEN.sum_too_many_args.d
    R test/unittest/aggs/err.D_PROTO_LEN.sumnoarg.d
    R test/unittest/aggs/err.D_PROTO_LEN.sumtoomany.d
    M test/unittest/printf/err.D_PRINTF_ARG_TYPE.aggarg.d

  Log Message:
  -----------
  Implement the support code for generating aggregation data

This patch adds support for aggregations to the D compiler and provides
an implementation for the count() and lquantize() aggregation functions
as examples on how to use the aggegation support.

The aggregation functions (defined as identifiers in dt_open.c) are now
enumerated as DT_IDENT_AGGFUNC identifiers using numeric values set by
enum dt_aggfid in dt_impl.h.  This allows for specifying implementation
functions in an array indexed by aggregation function id.

The prologue generation code will emit instructions to populate the
DTrace context aggregation data pointer if the clause makes use of
aggregations.

The aggregation data buffer contains two copies of each aggregation,
stored as pairs, to allow lock-free and wait-free updates to the data
for a specific aggregation (on a per-CPU basis).  Data updates will be
done twice, once for each data copy while the other copy is marked for
reading by the consumer.  A latch sequence id is provided so that the
consumer can detect whether the data changed while it was being read.

Aggregation function implementations consist of two functions: the main
aggregation function and a function that emits the BPF instructions to
implement the actual functionality.  The first function performs checks
on any arguments to the aggregation function and performs any set up
that is needed (e.g.calling dt_cg_node() to generate instructions for
argument expressions).  It then uses the DT_CG_AGG_IMPL() macro to call
the actual implementation function.

The DT_CG_AGG_IMPL macro takes the following arguments:
    - aid: Identifier for the aggregation being worked on
    - sz: size of the data chunk used by this aggregation
    - dlp: IR list
    - drp: register set
    - f: name of the implementation function
    - any arguments to pass to the implementation function (if any)

The implementation function f takes as arguments:
    - dlp: IR list
    - drp: register set
    - dreg: register that holds a pointer to the data chunk for this
            aggregation (the copy to be updated)
    - any extra arguments that were passed to DT_CG_AGG_IMPL

The DT_CG_AGG_IMPL macro will:
    1. Prepare the first data copy for writing and redirect the consumer
       to read from the second copy.  A register 'dreg' will be reserved
       to hold a pointer to the data to be updated.
    2. Call f(dlp, drp, dreg, ...) to perform the data update.
    3. Prepare the second data copy for writing and redirect the consumer
       to read from the first copy.  A register 'dreg' will be reserved
       to hold a pointer to the data to be updated.
    4. Call f(dlp, drp, dreg, ...) to perform the data update.

The main compilation routine has been extended to handle aggregations
(nodes of type DT_NODE_AGG) similar to how actions are handled.

Support for indexing aggregations by a tuple is not implemented yet.

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


  Commit: e0e51ae76ee900d873202617b1e9b0f73e20c743
      https://github.com/oracle/dtrace-utils/commit/e0e51ae76ee900d873202617b1e9b0f73e20c743
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_as.h
    M libdtrace/dt_cg.c
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_profile.c
    M libdtrace/dt_prov_sdt.c
    M libdtrace/dt_prov_syscall.c

  Log Message:
  -----------
  Change from instr = ... + dt_irlist_append(...) to emit*(...)

BPF instructions were being generated using a pair of statements,
first creating the instruction code, and then appending it to the IR
list.  The append operation would specify an optional label.  For
some instructions an external identifier might be associated with the
last appended instruction.

So, a code fragment may look like this:

    instr = BPF_CALL_FUNC(idp->di_id);
    dt_irlist_append(dlp, dt_cg_node_alloc(lbl_call, instr));
    dlp->dl_last->di_extern = idp;
    instr = BPF_RETURN();
    dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));

We introduce four macros to rewrite this (and more complex) code:

    emit(dlp, instr)
        Emit a BPF instruction (instr) in the given IR list (dlp).
    emite(dlp, instr, idp)
        Emit a BPF instruction (instr) in the given IR list (dlp)
        and associate an external identifier (idp) with it.
    emitl(dlp, lbl, instr)
        Emit a labelled BPF instruction (instr) in the given IR
        list (dlp).
    emitle(dlp, lbl, instr, idp)
        Emit a labelled BPF instruction (instr) in the given IR
        list (dlp) and associate an external identifier (idp) with
        it.

With these new macros, the code shown above becomes:

    emitle(dlp, lbl_call,
                BPF_CALL_FUNC(idp->di_id), idp);
    emit(dlp,   BPF_RETURN());

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


  Commit: 4510a4b4f95d2a94ec3be3acac5ad1a23ced0d77
      https://github.com/oracle/dtrace-utils/commit/4510a4b4f95d2a94ec3be3acac5ad1a23ced0d77
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    R libdtrace/dt_bpf_builtins.h
    M libdtrace/dt_cg.c
    M libdtrace/dt_dis.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_sdt.c
    M libdtrace/dt_prov_syscall.c

  Log Message:
  -----------
  Remove obsolete dt_bpf_builtins.h header file

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


Compare: https://github.com/oracle/dtrace-utils/compare/57605c12259d...4510a4b4f95d



More information about the DTrace-devel mailing list