From: Tao Chen <chen.dylane@linux.dev>
To: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
bpf <bpf@vger.kernel.org>
Subject: The same symbol is printed twice when use tracepoint to get stack
Date: Wed, 14 Jan 2026 23:09:21 +0800 [thread overview]
Message-ID: <e876fdea-ad0c-49dd-80ec-bd835ebfe0a4@linux.dev> (raw)
Hi guys,
When using tracepoints to retrieve stack information, I observed that
perf_trace_sched_migrate_task was printed twice. And the issue also
occurs with tools using libbpf.
sudo bpftrace -e '
tracepoint:sched:sched_migrate_task {
printf("Task %s migrated by:\n", args->comm);
print(kstack);
}'
Task kcompactd0 migrated by:
perf_trace_sched_migrate_task+9
perf_trace_sched_migrate_task+9
set_task_cpu+353
detach_task+77
detach_tasks+281
sched_balance_rq+452
sched_balance_newidle+504
pick_next_task_fair+84
__pick_next_task+66
pick_next_task+43
__schedule+332
schedule+41
schedule_hrtimeout_range+239
do_poll.constprop.0+668
do_sys_poll+499
__x64_sys_ppoll+220
x64_sys_call+5722
do_syscall_64+126
entry_SYSCALL_64_after_hwframe+118
Task jbd2/sda2-8 migrated by:
perf_trace_sched_migrate_task+9
perf_trace_sched_migrate_task+9
set_task_cpu+353
try_to_wake_up+365
default_wake_function+26
autoremove_wake_function+18
__wake_up_common+118
__wake_up+55
__jbd2_log_start_commit+195
env:
bpftrace v0.21.2
ubuntu24.04,6.14.0-36-generic
The issue is as follows:
https://github.com/bpftrace/bpftrace/issues/4949
It seems that there is no special handling in the kernel.
Does anyone has thoughts on this issue. Thanks.
BPF_CALL_4(bpf_get_stack_raw_tp, struct bpf_raw_tracepoint_args *, args,
void *, buf, u32, size, u64, flags)
{
struct pt_regs *regs = get_bpf_raw_tp_regs();
int ret;
if (IS_ERR(regs))
return PTR_ERR(regs);
perf_fetch_caller_regs(regs);
ret = bpf_get_stack((unsigned long) regs, (unsigned long) buf,
(unsigned long) size, flags, 0);
put_bpf_raw_tp_regs();
return ret;
}
--
Best Regards
Tao Chen
next reply other threads:[~2026-01-14 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 15:09 Tao Chen [this message]
2026-01-14 17:35 ` The same symbol is printed twice when use tracepoint to get stack Alan Maguire
2026-01-14 21:06 ` Jiri Olsa
2026-01-15 2:18 ` Tao Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e876fdea-ad0c-49dd-80ec-bd835ebfe0a4@linux.dev \
--to=chen.dylane@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.