[DTrace-devel] [PATCH 03/04] rawtp: report lockmem issues when determining rawtp argument count

Eugene Loh eugene.loh at oracle.com
Thu Nov 23 03:01:37 UTC 2023


On 11/22/23 10:49, Kris Van Hees via DTrace-devel wrote:

> diff --git a/libdtrace/dt_prov_rawtp.c b/libdtrace/dt_prov_rawtp.c
> @@ -181,7 +181,9 @@ static int probe_info(dtrace_hdl_t *dtp, const dt_probe_t *prp,
>   		dif.dtdo_len = 2;
>   
>   		bpf_fd = dt_bpf_prog_load(dt_rawtp.prog_type, &dif, 0, NULL, 0);
> -		if (bpf_fd == -1)
> +		if (bpf_fd == -EPERM)

Is that right?  I think the only negative value is -1.  Might it be that 
you want to test errno==+EPERM?  And do we know that EPERM really means 
lockmem?  Or are we simply guessing that that's the most likely explanation?

How about a test?  E.g.,

# dtrace -lv > out.default
# dtrace -xlockmem=1 -lv > out.small
# wc -l out.*
  1445230 out.default
  1380822 out.small
  2826052 total
# grep lockmem out.small
# grep Cannot out.small
#

Are things working as expected?

> +			return dt_bpf_lockmem_error(dtp, "Cannot retrieve argument count");
> +		else if (bpf_fd < 0)
>   			continue;
>   		rtp_fd = dt_bpf_raw_tracepoint_open(prp->desc->prb, bpf_fd);
>   		close(bpf_fd);



More information about the DTrace-devel mailing list