[DTrace-devel] [PATCH v2 08/20] providers: allow providers with no trampoline

Kris Van Hees kris.van.hees at oracle.com
Tue Sep 20 20:06:29 UTC 2022


On Wed, Sep 07, 2022 at 01:59:56PM +0100, Nick Alcock via DTrace-devel wrote:
> Such providers can be enabled just like any other, but generate no code.
> 
> Meant for use by things like the pid provider which have two probes
> associated with each system-side probe, one of which gets fired and
> generates code for the others in its trampoline method. Right now, both
> probes get the same trampoline, but only one probe's trampoline is
> necessary. Doing this lets us drop the unnecessary ones in a future
> commit.

This is not quite accurate.  Perhaps just omit this and simply mention that
the patch is needed to support providers that do not generate trampoline code
for their probes (because the probes are alises for probes in an provider that
takes care of the trampoline code generatopn)?

> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>

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

... assuming you fix the commit message as outlined above.

> ---
>  libdtrace/dt_bpf.c | 7 +++++++
>  libdtrace/dt_cg.c  | 3 ++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
> index 5ff348ca6370..42b4b80c0a68 100644
> --- a/libdtrace/dt_bpf.c
> +++ b/libdtrace/dt_bpf.c
> @@ -719,6 +719,13 @@ dt_bpf_load_progs(dtrace_hdl_t *dtp, uint_t cflags)
>  		if (prp == dtp->dt_error)
>  			continue;
>  
> +		/*
> +		 * Enabled probes with no trampoline act like they exist but
> +		 * no code is generated for them.
> +		 */
> +		if (prp->prov->impl->trampoline == NULL)
> +			continue;
> +
>  		dp = dt_program_construct(dtp, prp, cflags, NULL);
>  		if (dp == NULL)
>  			return -1;
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index ebd4190698f7..9f9d0fb03028 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -6846,7 +6846,8 @@ dt_cg(dt_pcb_t *pcb, dt_node_t *dnp)
>  	} else if (dnp->dn_kind == DT_NODE_TRAMPOLINE) {
>  		assert(pcb->pcb_probe != NULL);
>  
> -		pcb->pcb_probe->prov->impl->trampoline(pcb);
> +		if (pcb->pcb_probe->prov->impl->trampoline != NULL)
> +			pcb->pcb_probe->prov->impl->trampoline(pcb);
>  	} else
>  		dt_cg_node(dnp, &pcb->pcb_ir, pcb->pcb_regs);
>  
> -- 
> 2.37.1.265.g363c192786.dirty
> 
> 
> _______________________________________________
> 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