[DTrace-devel] [PATCH] Fix arg3 for sched enqueue and dequeue probes

Kris Van Hees kris.van.hees at oracle.com
Sun Mar 30 21:13:21 UTC 2025


On Sun, Mar 30, 2025 at 04:57:36PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> For sched enqueue and dequeue probes, arg3 should be an int
> for enqueue and not exist for dequeue.  In the code it was
> the other way around.  Fix this and the associated tests.
> 
> The trampoline was already set up to get this argument correct.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

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

> ---
>  libdtrace/dt_prov_sched.c            | 3 ++-
>  test/unittest/sched/tst.lv-dequeue.r | 1 -
>  test/unittest/sched/tst.lv-enqueue.r | 1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libdtrace/dt_prov_sched.c b/libdtrace/dt_prov_sched.c
> index 125d58917..3a218f3cb 100644
> --- a/libdtrace/dt_prov_sched.c
> +++ b/libdtrace/dt_prov_sched.c
> @@ -46,10 +46,10 @@ static probe_arg_t probe_args[] = {
>  	{ "dequeue", 0, { 0, 0, "struct task_struct *", "lwpsinfo_t *" } },
>  	{ "dequeue", 1, { 0, 0, "struct task_struct *", "psinfo_t *" } },
>  	{ "dequeue", 2, { 1, 0, "cpuinfo_t *", } },
> -	{ "dequeue", 3, { 2, 0, "int", } },
>  	{ "enqueue", 0, { 0, 0, "struct task_struct *", "lwpsinfo_t *" } },
>  	{ "enqueue", 1, { 0, 0, "struct task_struct *", "psinfo_t *" } },
>  	{ "enqueue", 2, { 1, 0, "cpuinfo_t *", } },
> +	{ "enqueue", 3, { 2, 0, "int", } },
>  	{ "off-cpu", 0, { 0, 0, "struct task_struct *", "lwpsinfo_t *" } },
>  	{ "off-cpu", 1, { 0, 0, "struct task_struct *", "psinfo_t *" } },
>  	{ "on-cpu", },
> @@ -128,6 +128,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
>  		 *	  associated with the runqueue.
>  		 */
>  		emit(dlp, BPF_STORE_IMM(BPF_DW, BPF_REG_7, DMST_ARG(1), 0));
> +
>  		emit(dlp, BPF_LOAD(BPF_DW, BPF_REG_0, BPF_REG_7, DMST_ARG(2)));
>  		emit(dlp, BPF_ALU64_IMM(BPF_AND, BPF_REG_0, ENQUEUE_HEAD));
>  		emit(dlp, BPF_STORE(BPF_DW, BPF_REG_7, DMST_ARG(2), BPF_REG_0));
> diff --git a/test/unittest/sched/tst.lv-dequeue.r b/test/unittest/sched/tst.lv-dequeue.r
> index 7580a8abc..657667f34 100644
> --- a/test/unittest/sched/tst.lv-dequeue.r
> +++ b/test/unittest/sched/tst.lv-dequeue.r
> @@ -14,5 +14,4 @@ PROBE sched vmlinux dequeue
>  		args[0]: lwpsinfo_t *
>  		args[1]: psinfo_t *
>  		args[2]: cpuinfo_t *
> -		args[3]: int
>  
> diff --git a/test/unittest/sched/tst.lv-enqueue.r b/test/unittest/sched/tst.lv-enqueue.r
> index edc5e2c4c..2f5efa30c 100644
> --- a/test/unittest/sched/tst.lv-enqueue.r
> +++ b/test/unittest/sched/tst.lv-enqueue.r
> @@ -14,4 +14,5 @@ PROBE sched vmlinux enqueue
>  		args[0]: lwpsinfo_t *
>  		args[1]: psinfo_t *
>  		args[2]: cpuinfo_t *
> +		args[3]: int
>  
> -- 
> 2.43.5
> 



More information about the DTrace-devel mailing list