Hi all,
Today's linux-next merge of the tip tree got a conflict in:
kernel/bpf/stackmap.c
between commit:
e17d62fedd10 ("bpf: Refactor stack map trace depth calculation into helper function")
from the bpf-next tree and commit:
c69993ecdd4d ("perf: Support deferred user unwind")
from the tip tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc kernel/bpf/stackmap.c
index 2365541c81dd,8f1dacaf01fe..000000000000
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@@ -333,9 -310,12 +333,9 @@@ BPF_CALL_3(bpf_get_stackid, struct pt_r
BPF_F_FAST_STACK_CMP | BPF_F_REUSE_STACKID)))
return -EINVAL;
- max_depth += skip;
- if (max_depth > sysctl_perf_event_max_stack)
- max_depth = sysctl_perf_event_max_stack;
-
+ max_depth = stack_map_calculate_max_depth(map->value_size, elem_size, flags);
trace = get_perf_callchain(regs, kernel, user, max_depth,
- false, false);
+ false, false, 0);
if (unlikely(!trace))
/* couldn't fetch the stack trace */
@@@ -463,15 -446,13 +463,15 @@@ static long __bpf_get_stack(struct pt_r
if (may_fault)
rcu_read_lock(); /* need RCU for perf's callchain below */
- if (trace_in)
+ if (trace_in) {
trace = trace_in;
- else if (kernel && task)
+ trace->nr = min_t(u32, trace->nr, max_depth);
+ } else if (kernel && task) {
trace = get_callchain_entry_for_task(task, max_depth);
- else
+ } else {
trace = get_perf_callchain(regs, kernel, user, max_depth,
- crosstask, false);
+ crosstask, false, 0);
+ }
if (unlikely(!trace) || trace->nr < skip) {
if (may_fault)
Hi all,
On Wed, 5 Nov 2025 13:31:59 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the tip tree got a conflict in:
>
> kernel/bpf/stackmap.c
>
> between commit:
>
> e17d62fedd10 ("bpf: Refactor stack map trace depth calculation into helper function")
>
> from the bpf-next tree and commit:
>
> c69993ecdd4d ("perf: Support deferred user unwind")
>
> from the tip tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>
> --
> Cheers,
> Stephen Rothwell
>
> diff --cc kernel/bpf/stackmap.c
> index 2365541c81dd,8f1dacaf01fe..000000000000
> --- a/kernel/bpf/stackmap.c
> +++ b/kernel/bpf/stackmap.c
> @@@ -333,9 -310,12 +333,9 @@@ BPF_CALL_3(bpf_get_stackid, struct pt_r
> BPF_F_FAST_STACK_CMP | BPF_F_REUSE_STACKID)))
> return -EINVAL;
>
> - max_depth += skip;
> - if (max_depth > sysctl_perf_event_max_stack)
> - max_depth = sysctl_perf_event_max_stack;
> -
> + max_depth = stack_map_calculate_max_depth(map->value_size, elem_size, flags);
> trace = get_perf_callchain(regs, kernel, user, max_depth,
> - false, false);
> + false, false, 0);
>
> if (unlikely(!trace))
> /* couldn't fetch the stack trace */
> @@@ -463,15 -446,13 +463,15 @@@ static long __bpf_get_stack(struct pt_r
> if (may_fault)
> rcu_read_lock(); /* need RCU for perf's callchain below */
>
> - if (trace_in)
> + if (trace_in) {
> trace = trace_in;
> - else if (kernel && task)
> + trace->nr = min_t(u32, trace->nr, max_depth);
> + } else if (kernel && task) {
> trace = get_callchain_entry_for_task(task, max_depth);
> - else
> + } else {
> trace = get_perf_callchain(regs, kernel, user, max_depth,
> - crosstask, false);
> + crosstask, false, 0);
> + }
>
> if (unlikely(!trace) || trace->nr < skip) {
> if (may_fault)
This is now a conflict between the bpf-next tree and Linus' tree.
--
Cheers,
Stephen Rothwell
© 2016 - 2025 Red Hat, Inc.