[DTrace-devel] [PATCH v2 04/04] rawtp: retrieve probe arguments from CTF data

Eugene Loh eugene.loh at oracle.com
Fri Dec 1 05:35:02 UTC 2023


On 11/30/23 10:59, Kris Van Hees via DTrace-devel wrote:

> We were determining the number of arguments using a trial-and-error
> approach with minimal BPF programs.  If there is CTF type data for
> the raw tracepoints (in the form of a function prototype), we use
> that because it also gives us the types of the arguments.
>
> If no such CTF data is available, we fall back to the trial-and-error
> approach.
>
> The included test will fail if the fallback is used.  There is no way
> to force the fallback to get triggered explicitly.

I don't understand.  The fallback will be used on OL7.  So are you 
saying the test will fail on OL7?  Shouldn't it have the appropriate .x?

But the .r.p thinks that uint64_t (that is, the fallback) is okay. So 
that means the test will pass even if the fallback is used.

And that means that if the mechanism is broken and we return the garbage 
types (uint64_t) rather than the actual types (struct task_struct), the 
test will still pass.

I propose two tests:

*)  one test that tolerates the fallback (like the test that's already 
in the patch)

*)  another test that insists on the correct types;  it should have:
        - a .x file to avoid OL7 problems
        - a simpler .r.p file that doesn't filter the results so much

> diff --git a/test/unittest/providers/rawtp/tst.lv-sched_process_fork.r b/test/unittest/providers/rawtp/tst.lv-sched_process_fork.r
> +PROBE rawtp sched sched_process_fork
> +
> +	Argument Types
> +		args[0]: TYPE-OK
> +		args[1]: TYPE-OK
> +
> diff --git a/test/unittest/providers/rawtp/tst.lv-sched_process_fork.r.p b/test/unittest/providers/rawtp/tst.lv-sched_process_fork.r.p
> +#!/usr/bin/awk -f
> +NR == 1 { next; }
> +NR == 2 { print "PROBE", $2, $3, $NF; next; }
> +/args\[[0-9]+\]: uint64_t$/ { sub(/:.*$/, ": TYPE-OK"); }
> +/args\[[0-9]+\]: struct task_struct \*$/ { sub(/:.*$/, ": TYPE-OK"); }
> +/^ *[0-9]+/ { exit; }
> +{ print; }
> diff --git a/test/unittest/providers/rawtp/tst.lv-sched_process_fork.sh b/test/unittest/providers/rawtp/tst.lv-sched_process_fork.sh
> +$dtrace $dt_flags -lvn rawtp:::sched_process_fork
> +exit $?



More information about the DTrace-devel mailing list