[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cbee1f3b-49df-4228-898c-f6dc07e52add@linux.dev>
Date: Wed, 22 Oct 2025 23:59:32 +0800
From: Tao Chen <chen.dylane@...ux.dev>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mingo@...hat.com, acme@...nel.org, namhyung@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
irogers@...gle.com, adrian.hunter@...el.com, kan.liang@...ux.intel.com,
song@...nel.org, ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, eddyz87@...il.com, yonghong.song@...ux.dev,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me,
haoluo@...gle.com, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 2/2] bpf: Use per-cpu BPF callchain entry to
save callchain
在 2025/10/20 19:03, Peter Zijlstra 写道:
> On Mon, Oct 20, 2025 at 01:01:18AM +0800, Tao Chen wrote:
>> As Alexei noted, get_perf_callchain() return values may be reused
>> if a task is preempted after the BPF program enters migrate disable
>> mode. Drawing on the per-cpu design of bpf_bprintf_buffers,
>> per-cpu BPF callchain entry is used here.
>
> And now you can only unwind 3 tasks, and then start failing. This is
> acceptable, why?
Yes it is, if we use per-cpu-bpf-callchain-entry like
bpf_bprintf_buffers, this is a proposal from Andrii and Alexei,
In my understanding, is it a low-probability event to be preempted three
times in a row in the same cpu?
>
>> - if (may_fault)
>> - rcu_read_lock(); /* need RCU for perf's callchain below */
>> -
>
> I know you propose to remove this code; but how was that correct? The
> perf callchain code hard relies on non-preemptible context, RCU does not
> imply such a thing.
>
Alexei mentioned this rcu-lock issue before,
It seems we need preemption protection.
https://lore.kernel.org/bpf/CAADnVQ+s8B7-fvR1TNO-bniSyKv57cH_ihRszmZV7pQDyV=VDQ@mail.gmail.com
>> if (trace_in)
>> trace = trace_in;
>> - else if (kernel && task)
>> trace = get_callchain_entry_for_task(task, max_depth);
>> - else
>> - trace = get_perf_callchain(regs, NULL, kernel, user, max_depth,
>> - crosstask, false);
>
>
--
Best Regards
Tao Chen
Powered by blists - more mailing lists