BPF List
 help / color / mirror / Atom feed
* linux-next: manual merge of the tip tree with the bpf-next tree
@ 2022-10-27  0:07 Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2022-10-27  0:07 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko
  Cc: bpf, Networking, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin KaFai Lau

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  arch/x86/net/bpf_jit_comp.c

between commit:

  271de525e1d7 ("bpf: Remove prog->active check for bpf_lsm and bpf_iter")

from the bpf-next tree and commit:

  b2e9dfe54be4 ("x86/bpf: Emit call depth accounting if required")

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 arch/x86/net/bpf_jit_comp.c
index cec5195602bc,f46b62029d91..000000000000
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@@ -11,8 -11,8 +11,9 @@@
  #include <linux/bpf.h>
  #include <linux/memory.h>
  #include <linux/sort.h>
 +#include <linux/init.h>
  #include <asm/extable.h>
+ #include <asm/ftrace.h>
  #include <asm/set_memory.h>
  #include <asm/nospec-branch.h>
  #include <asm/text-patching.h>
@@@ -1930,7 -1869,7 +1948,7 @@@ static int invoke_bpf_prog(const struc
  	/* arg2: lea rsi, [rbp - ctx_cookie_off] */
  	EMIT4(0x48, 0x8D, 0x75, -run_ctx_off);
  
- 	if (emit_call(&prog, bpf_trampoline_enter(p), prog))
 -	if (emit_rsb_call(&prog, enter, prog))
++	if (emit_rsb_call(&prog, bpf_trampoline_enter(p), prog))
  		return -EINVAL;
  	/* remember prog start time returned by __bpf_prog_enter */
  	emit_mov_reg(&prog, true, BPF_REG_6, BPF_REG_0);
@@@ -1975,7 -1914,7 +1993,7 @@@
  	emit_mov_reg(&prog, true, BPF_REG_2, BPF_REG_6);
  	/* arg3: lea rdx, [rbp - run_ctx_off] */
  	EMIT4(0x48, 0x8D, 0x55, -run_ctx_off);
- 	if (emit_call(&prog, bpf_trampoline_exit(p), prog))
 -	if (emit_rsb_call(&prog, exit, prog))
++	if (emit_rsb_call(&prog, bpf_trampoline_exit(p), prog))
  		return -EINVAL;
  
  	*pprog = prog;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* linux-next: manual merge of the tip tree with the bpf-next tree
@ 2025-09-12  2:40 Stephen Rothwell
  2025-09-12 17:55 ` Alexei Starovoitov
  2025-09-12 20:47 ` Jiri Olsa
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Rothwell @ 2025-09-12  2:40 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko
  Cc: Jiawei Zhao, Jiri Olsa, bpf, Networking,
	Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 5871 bytes --]

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  tools/testing/selftests/bpf/prog_tests/usdt.c

between commit:

  69424097ee10 ("selftests/bpf: Enrich subtest_basic_usdt case in selftests to cover SIB handling logic")

from the bpf-next tree and commit:

  875e1705ad99 ("selftests/bpf: Add optimized usdt variant for basic usdt test")

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 tools/testing/selftests/bpf/prog_tests/usdt.c
index 615e9c3e93bf,833eb87483a1..000000000000
--- a/tools/testing/selftests/bpf/prog_tests/usdt.c
+++ b/tools/testing/selftests/bpf/prog_tests/usdt.c
@@@ -40,73 -40,20 +40,80 @@@ static void __always_inline trigger_fun
  	}
  }
  
 +#if defined(__x86_64__) || defined(__i386__)
 +/*
 + * SIB (Scale-Index-Base) addressing format: "size@(base_reg, index_reg, scale)"
 + * - 'size' is the size in bytes of the array element, and its sign indicates
 + *   whether the type is signed (negative) or unsigned (positive).
 + * - 'base_reg' is the register holding the base address, normally rdx or edx
 + * - 'index_reg' is the register holding the index, normally rax or eax
 + * - 'scale' is the scaling factor (typically 1, 2, 4, or 8), which matches the
 + *    size of the element type.
 + *
 + * For example, for an array of 'short' (signed 2-byte elements), the SIB spec would be:
 + * - size: -2 (negative because 'short' is signed)
 + * - scale: 2 (since sizeof(short) == 2)
 + *
 + * The resulting SIB format: "-2@(%%rdx,%%rax,2)" for x86_64, "-2@(%%edx,%%eax,2)" for i386
 + */
 +static volatile short array[] = {-1, -2, -3, -4};
 +
 +#if defined(__x86_64__)
 +#define USDT_SIB_ARG_SPEC -2@(%%rdx,%%rax,2)
 +#else
 +#define USDT_SIB_ARG_SPEC -2@(%%edx,%%eax,2)
 +#endif
 +
 +unsigned short test_usdt_sib_semaphore SEC(".probes");
 +
 +static void trigger_sib_spec(void)
 +{
 +	/*
 +	 * Force SIB addressing with inline assembly.
 +	 *
 +	 * You must compile with -std=gnu99 or -std=c99 to use the
 +	 * STAP_PROBE_ASM macro.
 +	 *
 +	 * The STAP_PROBE_ASM macro generates a quoted string that gets
 +	 * inserted between the surrounding assembly instructions. In this
 +	 * case, USDT_SIB_ARG_SPEC is embedded directly into the instruction
 +	 * stream, creating a probe point between the asm statement boundaries.
 +	 * It works fine with gcc/clang.
 +	 *
 +	 * Register constraints:
 +	 * - "d"(array): Binds the 'array' variable to %rdx or %edx register
 +	 * - "a"(0): Binds the constant 0 to %rax or %eax register
 +	 * These ensure that when USDT_SIB_ARG_SPEC references %%rdx(%edx) and
 +	 * %%rax(%eax), they contain the expected values for SIB addressing.
 +	 *
 +	 * The "memory" clobber prevents the compiler from reordering memory
 +	 * accesses around the probe point, ensuring that the probe behavior
 +	 * is predictable and consistent.
 +	 */
 +	asm volatile(
 +		STAP_PROBE_ASM(test, usdt_sib, USDT_SIB_ARG_SPEC)
 +		:
 +		: "d"(array), "a"(0)
 +		: "memory"
 +	);
 +}
 +#endif
 +
- static void subtest_basic_usdt(void)
+ static void subtest_basic_usdt(bool optimized)
  {
  	LIBBPF_OPTS(bpf_usdt_opts, opts);
  	struct test_usdt *skel;
  	struct test_usdt__bss *bss;
- 	int err, i;
+ 	int err, i, called;
 +	const __u64 expected_cookie = 0xcafedeadbeeffeed;
  
+ #define TRIGGER(x) ({			\
+ 	trigger_func(x);		\
+ 	if (optimized)			\
+ 		trigger_func(x);	\
+ 	optimized ? 2 : 1;		\
+ 	})
+ 
  	skel = test_usdt__open_and_load();
  	if (!ASSERT_OK_PTR(skel, "skel_open"))
  		return;
@@@ -126,22 -73,13 +133,22 @@@
  	if (!ASSERT_OK_PTR(skel->links.usdt0, "usdt0_link"))
  		goto cleanup;
  
 +#if defined(__x86_64__) || defined(__i386__)
 +	opts.usdt_cookie = expected_cookie;
 +	skel->links.usdt_sib = bpf_program__attach_usdt(skel->progs.usdt_sib,
 +							 0 /*self*/, "/proc/self/exe",
 +							 "test", "usdt_sib", &opts);
 +	if (!ASSERT_OK_PTR(skel->links.usdt_sib, "usdt_sib_link"))
 +		goto cleanup;
 +#endif
 +
- 	trigger_func(1);
+ 	called = TRIGGER(1);
  
- 	ASSERT_EQ(bss->usdt0_called, 1, "usdt0_called");
- 	ASSERT_EQ(bss->usdt3_called, 1, "usdt3_called");
- 	ASSERT_EQ(bss->usdt12_called, 1, "usdt12_called");
+ 	ASSERT_EQ(bss->usdt0_called, called, "usdt0_called");
+ 	ASSERT_EQ(bss->usdt3_called, called, "usdt3_called");
+ 	ASSERT_EQ(bss->usdt12_called, called, "usdt12_called");
  
 -	ASSERT_EQ(bss->usdt0_cookie, 0xcafedeadbeeffeed, "usdt0_cookie");
 +	ASSERT_EQ(bss->usdt0_cookie, expected_cookie, "usdt0_cookie");
  	ASSERT_EQ(bss->usdt0_arg_cnt, 0, "usdt0_arg_cnt");
  	ASSERT_EQ(bss->usdt0_arg_ret, -ENOENT, "usdt0_arg_ret");
  	ASSERT_EQ(bss->usdt0_arg_size, -ENOENT, "usdt0_arg_size");
@@@ -225,18 -163,9 +232,19 @@@
  	ASSERT_EQ(bss->usdt3_args[1], 42, "usdt3_arg2");
  	ASSERT_EQ(bss->usdt3_args[2], (uintptr_t)&bla, "usdt3_arg3");
  
 +#if defined(__x86_64__) || defined(__i386__)
 +	trigger_sib_spec();
 +	ASSERT_EQ(bss->usdt_sib_called, 1, "usdt_sib_called");
 +	ASSERT_EQ(bss->usdt_sib_cookie, expected_cookie, "usdt_sib_cookie");
 +	ASSERT_EQ(bss->usdt_sib_arg_cnt, 1, "usdt_sib_arg_cnt");
 +	ASSERT_EQ(bss->usdt_sib_arg, nums[0], "usdt_sib_arg");
 +	ASSERT_EQ(bss->usdt_sib_arg_ret, 0, "usdt_sib_arg_ret");
 +	ASSERT_EQ(bss->usdt_sib_arg_size, sizeof(nums[0]), "usdt_sib_arg_size");
 +#endif
 +
  cleanup:
  	test_usdt__destroy(skel);
+ #undef TRIGGER
  }
  
  unsigned short test_usdt_100_semaphore SEC(".probes");

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux-next: manual merge of the tip tree with the bpf-next tree
  2025-09-12  2:40 Stephen Rothwell
@ 2025-09-12 17:55 ` Alexei Starovoitov
  2025-09-12 20:47 ` Jiri Olsa
  1 sibling, 0 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2025-09-12 17:55 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko, Jiawei Zhao,
	Jiri Olsa, bpf, Networking, Linux Kernel Mailing List,
	Linux Next Mailing List

On Thu, Sep 11, 2025 at 7:41 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Today's linux-next merge of the tip tree got a conflict in:
>
>   tools/testing/selftests/bpf/prog_tests/usdt.c
>
> between commit:
>
>   69424097ee10 ("selftests/bpf: Enrich subtest_basic_usdt case in selftests to cover SIB handling logic")
>
> from the bpf-next tree and commit:
>
>   875e1705ad99 ("selftests/bpf: Add optimized usdt variant for basic usdt test")
>
> 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.

Thanks for headsup. Looks good.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux-next: manual merge of the tip tree with the bpf-next tree
  2025-09-12  2:40 Stephen Rothwell
  2025-09-12 17:55 ` Alexei Starovoitov
@ 2025-09-12 20:47 ` Jiri Olsa
  1 sibling, 0 replies; 6+ messages in thread
From: Jiri Olsa @ 2025-09-12 20:47 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko, Jiawei Zhao,
	bpf, Networking, Linux Kernel Mailing List,
	Linux Next Mailing List

On Fri, Sep 12, 2025 at 12:40:59PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got a conflict in:
> 
>   tools/testing/selftests/bpf/prog_tests/usdt.c
> 
> between commit:
> 
>   69424097ee10 ("selftests/bpf: Enrich subtest_basic_usdt case in selftests to cover SIB handling logic")
> 
> from the bpf-next tree and commit:
> 
>   875e1705ad99 ("selftests/bpf: Add optimized usdt variant for basic usdt test")
> 
> 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.

hi,
fwiw the conflict was mentioned in here:
  https://lore.kernel.org/bpf/aMAiMrLlfmG9FbQ3@krava/

the fix looks good, thanks

jirka

> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc tools/testing/selftests/bpf/prog_tests/usdt.c
> index 615e9c3e93bf,833eb87483a1..000000000000
> --- a/tools/testing/selftests/bpf/prog_tests/usdt.c
> +++ b/tools/testing/selftests/bpf/prog_tests/usdt.c
> @@@ -40,73 -40,20 +40,80 @@@ static void __always_inline trigger_fun
>   	}
>   }
>   
>  +#if defined(__x86_64__) || defined(__i386__)
>  +/*
>  + * SIB (Scale-Index-Base) addressing format: "size@(base_reg, index_reg, scale)"
>  + * - 'size' is the size in bytes of the array element, and its sign indicates
>  + *   whether the type is signed (negative) or unsigned (positive).
>  + * - 'base_reg' is the register holding the base address, normally rdx or edx
>  + * - 'index_reg' is the register holding the index, normally rax or eax
>  + * - 'scale' is the scaling factor (typically 1, 2, 4, or 8), which matches the
>  + *    size of the element type.
>  + *
>  + * For example, for an array of 'short' (signed 2-byte elements), the SIB spec would be:
>  + * - size: -2 (negative because 'short' is signed)
>  + * - scale: 2 (since sizeof(short) == 2)
>  + *
>  + * The resulting SIB format: "-2@(%%rdx,%%rax,2)" for x86_64, "-2@(%%edx,%%eax,2)" for i386
>  + */
>  +static volatile short array[] = {-1, -2, -3, -4};
>  +
>  +#if defined(__x86_64__)
>  +#define USDT_SIB_ARG_SPEC -2@(%%rdx,%%rax,2)
>  +#else
>  +#define USDT_SIB_ARG_SPEC -2@(%%edx,%%eax,2)
>  +#endif
>  +
>  +unsigned short test_usdt_sib_semaphore SEC(".probes");
>  +
>  +static void trigger_sib_spec(void)
>  +{
>  +	/*
>  +	 * Force SIB addressing with inline assembly.
>  +	 *
>  +	 * You must compile with -std=gnu99 or -std=c99 to use the
>  +	 * STAP_PROBE_ASM macro.
>  +	 *
>  +	 * The STAP_PROBE_ASM macro generates a quoted string that gets
>  +	 * inserted between the surrounding assembly instructions. In this
>  +	 * case, USDT_SIB_ARG_SPEC is embedded directly into the instruction
>  +	 * stream, creating a probe point between the asm statement boundaries.
>  +	 * It works fine with gcc/clang.
>  +	 *
>  +	 * Register constraints:
>  +	 * - "d"(array): Binds the 'array' variable to %rdx or %edx register
>  +	 * - "a"(0): Binds the constant 0 to %rax or %eax register
>  +	 * These ensure that when USDT_SIB_ARG_SPEC references %%rdx(%edx) and
>  +	 * %%rax(%eax), they contain the expected values for SIB addressing.
>  +	 *
>  +	 * The "memory" clobber prevents the compiler from reordering memory
>  +	 * accesses around the probe point, ensuring that the probe behavior
>  +	 * is predictable and consistent.
>  +	 */
>  +	asm volatile(
>  +		STAP_PROBE_ASM(test, usdt_sib, USDT_SIB_ARG_SPEC)
>  +		:
>  +		: "d"(array), "a"(0)
>  +		: "memory"
>  +	);
>  +}
>  +#endif
>  +
> - static void subtest_basic_usdt(void)
> + static void subtest_basic_usdt(bool optimized)
>   {
>   	LIBBPF_OPTS(bpf_usdt_opts, opts);
>   	struct test_usdt *skel;
>   	struct test_usdt__bss *bss;
> - 	int err, i;
> + 	int err, i, called;
>  +	const __u64 expected_cookie = 0xcafedeadbeeffeed;
>   
> + #define TRIGGER(x) ({			\
> + 	trigger_func(x);		\
> + 	if (optimized)			\
> + 		trigger_func(x);	\
> + 	optimized ? 2 : 1;		\
> + 	})
> + 
>   	skel = test_usdt__open_and_load();
>   	if (!ASSERT_OK_PTR(skel, "skel_open"))
>   		return;
> @@@ -126,22 -73,13 +133,22 @@@
>   	if (!ASSERT_OK_PTR(skel->links.usdt0, "usdt0_link"))
>   		goto cleanup;
>   
>  +#if defined(__x86_64__) || defined(__i386__)
>  +	opts.usdt_cookie = expected_cookie;
>  +	skel->links.usdt_sib = bpf_program__attach_usdt(skel->progs.usdt_sib,
>  +							 0 /*self*/, "/proc/self/exe",
>  +							 "test", "usdt_sib", &opts);
>  +	if (!ASSERT_OK_PTR(skel->links.usdt_sib, "usdt_sib_link"))
>  +		goto cleanup;
>  +#endif
>  +
> - 	trigger_func(1);
> + 	called = TRIGGER(1);
>   
> - 	ASSERT_EQ(bss->usdt0_called, 1, "usdt0_called");
> - 	ASSERT_EQ(bss->usdt3_called, 1, "usdt3_called");
> - 	ASSERT_EQ(bss->usdt12_called, 1, "usdt12_called");
> + 	ASSERT_EQ(bss->usdt0_called, called, "usdt0_called");
> + 	ASSERT_EQ(bss->usdt3_called, called, "usdt3_called");
> + 	ASSERT_EQ(bss->usdt12_called, called, "usdt12_called");
>   
>  -	ASSERT_EQ(bss->usdt0_cookie, 0xcafedeadbeeffeed, "usdt0_cookie");
>  +	ASSERT_EQ(bss->usdt0_cookie, expected_cookie, "usdt0_cookie");
>   	ASSERT_EQ(bss->usdt0_arg_cnt, 0, "usdt0_arg_cnt");
>   	ASSERT_EQ(bss->usdt0_arg_ret, -ENOENT, "usdt0_arg_ret");
>   	ASSERT_EQ(bss->usdt0_arg_size, -ENOENT, "usdt0_arg_size");
> @@@ -225,18 -163,9 +232,19 @@@
>   	ASSERT_EQ(bss->usdt3_args[1], 42, "usdt3_arg2");
>   	ASSERT_EQ(bss->usdt3_args[2], (uintptr_t)&bla, "usdt3_arg3");
>   
>  +#if defined(__x86_64__) || defined(__i386__)
>  +	trigger_sib_spec();
>  +	ASSERT_EQ(bss->usdt_sib_called, 1, "usdt_sib_called");
>  +	ASSERT_EQ(bss->usdt_sib_cookie, expected_cookie, "usdt_sib_cookie");
>  +	ASSERT_EQ(bss->usdt_sib_arg_cnt, 1, "usdt_sib_arg_cnt");
>  +	ASSERT_EQ(bss->usdt_sib_arg, nums[0], "usdt_sib_arg");
>  +	ASSERT_EQ(bss->usdt_sib_arg_ret, 0, "usdt_sib_arg_ret");
>  +	ASSERT_EQ(bss->usdt_sib_arg_size, sizeof(nums[0]), "usdt_sib_arg_size");
>  +#endif
>  +
>   cleanup:
>   	test_usdt__destroy(skel);
> + #undef TRIGGER
>   }
>   
>   unsigned short test_usdt_100_semaphore SEC(".probes");



^ permalink raw reply	[flat|nested] 6+ messages in thread

* linux-next: manual merge of the tip tree with the bpf-next tree
@ 2025-11-05  2:31 Stephen Rothwell
  2025-12-03  2:35 ` Stephen Rothwell
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2025-11-05  2:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko
  Cc: Arnaud Lecomte, bpf, Networking, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

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)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux-next: manual merge of the tip tree with the bpf-next tree
  2025-11-05  2:31 linux-next: manual merge of the tip tree with the bpf-next tree Stephen Rothwell
@ 2025-12-03  2:35 ` Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2025-12-03  2:35 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Arnaud Lecomte, bpf, Networking, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 2359 bytes --]

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-03  2:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05  2:31 linux-next: manual merge of the tip tree with the bpf-next tree Stephen Rothwell
2025-12-03  2:35 ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2025-09-12  2:40 Stephen Rothwell
2025-09-12 17:55 ` Alexei Starovoitov
2025-09-12 20:47 ` Jiri Olsa
2022-10-27  0:07 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox