[PATCH bpf-next v3 2/4] powerpc64/bpf: Implement bpf_addr_space_cast instruction

2025-09-07 Thread Saket Kumar Bhaskar
Rao Bagalkote Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/net/bpf_jit.h| 1 + arch/powerpc/net/bpf_jit_comp.c | 6 ++ arch/powerpc/net/bpf_jit_comp64.c | 10 ++ 4 files changed, 18 insertions(+) diff --git

Re: [PATCH bpf-next v2 5/5] selftests/bpf: Fix arena_spin_lock selftest failure

2025-09-07 Thread Saket Kumar Bhaskar
On Thu, Sep 04, 2025 at 01:39:31PM +0530, Hari Bathini wrote: > > > On 29/08/25 10:21 pm, Saket Kumar Bhaskar wrote: > > For systems having CONFIG_NR_CPUS set to > 1024 in kernel config > > the selftest fails as arena_spin_lock_irqsave() returns EOPNOTSUPP. > >

[PATCH bpf-next v3 3/4] powerpc64/bpf: Introduce bpf_jit_emit_atomic_ops() to emit atomic instructions

2025-09-07 Thread Saket Kumar Bhaskar
be used in case it causes a fault. Reviewed-by: Hari Bathini Tested-by: Venkat Rao Bagalkote Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp64.c | 203 +- 1 file changed, 115 insertions(+), 88 deletions(-) diff --git a/arch/powerpc/net

[PATCH bpf-next v3 1/4] powerpc64/bpf: Implement PROBE_MEM32 pseudo instructions

2025-09-06 Thread Saket Kumar Bhaskar
values depending on the size (byte, halfword, word, doubleword). Stack layout is adjusted to introduce a new NVR (_R26) and to make BPF_PPC_STACKFRAME quadword aligned (local_tmp_var is increased by 8 bytes). Reviewed-by: Hari Bathini Tested-by: Venkat Rao Bagalkote Signed-off-by: Saket Kumar

[PATCH bpf-next v3 0/4] powerpc64/bpf: Add support for bpf arena and arena atomics

2025-09-04 Thread Saket Kumar Bhaskar
R. v1:https://lore.kernel.org/all/20250805062747.3479221-1-sk...@linux.ibm.com/ Saket Kumar Bhaskar (4): powerpc64/bpf: Implement PROBE_MEM32 pseudo instructions powerpc64/bpf: Implement bpf_addr_space_cast instruction powerpc64/bpf: Introduce bpf_jit_emit_atomic_ops() to emit

[PATCH bpf-next v3 4/4] powerpc64/bpf: Implement PROBE_ATOMIC instructions

2025-09-04 Thread Saket Kumar Bhaskar
support as in other architectures like x86 and arm64. Reviewed-by: Hari Bathini Tested-by: Venkat Rao Bagalkote Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp.c | 16 arch/powerpc/net/bpf_jit_comp64.c | 26 ++ 2 files changed, 42

Re: [PATCH bpf-next v2 5/5] selftests/bpf: Fix arena_spin_lock selftest failure

2025-09-04 Thread Saket Kumar Bhaskar
On Thu, Sep 04, 2025 at 01:55:40PM +0530, Saket Kumar Bhaskar wrote: > On Thu, Sep 04, 2025 at 01:39:31PM +0530, Hari Bathini wrote: > > > > > > On 29/08/25 10:21 pm, Saket Kumar Bhaskar wrote: > > > For systems having CONFIG_NR_CPUS set to > 1024 in kernel c

[PATCH bpf-next v2 4/5] powerpc64/bpf: Implement PROBE_ATOMIC instructions

2025-08-29 Thread Saket Kumar Bhaskar
support as in other architectures like x86 and arm64. Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp.c | 16 arch/powerpc/net/bpf_jit_comp64.c | 26 ++ 2 files changed, 42 insertions(+) diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch

[PATCH bpf-next v2 5/5] selftests/bpf: Fix arena_spin_lock selftest failure

2025-08-29 Thread Saket Kumar Bhaskar
For systems having CONFIG_NR_CPUS set to > 1024 in kernel config the selftest fails as arena_spin_lock_irqsave() returns EOPNOTSUPP. The selftest is skipped incase bpf program returns EOPNOTSUPP, with a descriptive message logged. Signed-off-by: Saket Kumar Bhaskar --- .../selftests/

[PATCH bpf-next v2 3/5] powerpc64/bpf: Introduce bpf_jit_emit_atomic_ops() to emit atomic instructions

2025-08-29 Thread Saket Kumar Bhaskar
be used in case it causes a fault. Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp64.c | 203 +- 1 file changed, 115 insertions(+), 88 deletions(-) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index

[PATCH bpf-next v2 2/5] powerpc64/bpf: Implement bpf_addr_space_cast instruction

2025-08-29 Thread Saket Kumar Bhaskar
move: wX = wY. rY = addr_space_cast(rX, 1, 0) : used to convert a bpf arena pointer to a pointer in the userspace vma. This has to be converted by the JIT. PPC_RAW_RLDICL_DOT, a variant of PPC_RAW_RLDICL is introduced to set condition register as well. Signed-off-by: Saket Kumar Bhaskar

[PATCH bpf-next v2 1/5] powerpc64/bpf: Implement PROBE_MEM32 pseudo instructions

2025-08-29 Thread Saket Kumar Bhaskar
values depending on the size (byte, halfword, word, doubleword). Stack layout is adjusted to introduce a new NVR (_R26) and to make BPF_PPC_STACKFRAME quadword aligned (local_tmp_var is increased by 8 bytes). Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit.h| 5

[bpf-next v2 0/5] powerpc64/bpf: Add support for bpf arena and arena atomics

2025-08-29 Thread Saket Kumar Bhaskar
to be updated from userspace). Saket Kumar Bhaskar (5): powerpc64/bpf: Implement PROBE_MEM32 pseudo instructions powerpc64/bpf: Implement bpf_addr_space_cast instruction powerpc64/bpf: Introduce bpf_jit_emit_atomic_ops() to emit atomic instructions powerpc64/bpf: Implement PROBE_

Re: [bpf-next 6/6] selftests/bpf: Fix arena_spin_lock selftest failure

2025-08-08 Thread Saket Kumar Bhaskar
On Thu, Aug 07, 2025 at 03:21:42PM -0700, Alexei Starovoitov wrote: > On Mon, Aug 4, 2025 at 11:29 PM Saket Kumar Bhaskar > wrote: > > > > @@ -60,9 +65,16 @@ static void test_arena_spin_lock_size(int size) > > return; > >

Re: [bpf-next 2/6] bpf,powerpc: Implement PROBE_MEM32 pseudo instructions

2025-08-07 Thread Saket Kumar Bhaskar
On Tue, Aug 05, 2025 at 09:41:37AM +0200, Christophe Leroy wrote: > > > Le 05/08/2025 à 08:27, Saket Kumar Bhaskar a écrit : > > Add support for [LDX | STX | ST], PROBE_MEM32, [B | H | W | DW] > > instructions. They are similar to PROBE_MEM instructions with the >

Re: [bpf-next 0/6] bpf,powerpc: Add support for bpf arena and arena atomics

2025-08-07 Thread Saket Kumar Bhaskar
On Tue, Aug 05, 2025 at 05:37:00PM +0530, Venkat Rao Bagalkote wrote: > > On 05/08/25 11:57 am, Saket Kumar Bhaskar wrote: > > This patch series introduces support for the PROBE_MEM32, > > bpf_addr_space_cast and PROBE_ATOMIC instructions in the powerpc BPF JIT, &g

Re: [bpf-next 1/6] bpf,powerpc: Introduce bpf_jit_emit_probe_mem_store() to emit store instructions

2025-08-07 Thread Saket Kumar Bhaskar
On Wed, Aug 06, 2025 at 08:59:59AM +0200, Christophe Leroy wrote: > > > Le 05/08/2025 à 13:59, Venkat Rao Bagalkote a écrit : > > > > On 05/08/25 1:04 pm, Christophe Leroy wrote: > > > > > > > > > Le 05/08/2025 à 08:27, Saket Kumar Bhaskar a é

Re: [bpf-next 0/6] bpf,powerpc: Add support for bpf arena and arena atomics

2025-08-07 Thread Saket Kumar Bhaskar
On Tue, Aug 05, 2025 at 09:45:39AM +0200, Christophe Leroy wrote: > > > Le 05/08/2025 à 08:27, Saket Kumar Bhaskar a écrit : > > This patch series introduces support for the PROBE_MEM32, > > bpf_addr_space_cast and PROBE_ATOMIC instructions in the powerpc BPF JIT,

Re: [bpf-next 3/6] bpf,powerpc: Implement bpf_addr_space_cast instruction

2025-08-07 Thread Saket Kumar Bhaskar
On Tue, Aug 05, 2025 at 09:29:07AM +0200, Christophe Leroy wrote: > > > Le 05/08/2025 à 08:27, Saket Kumar Bhaskar a écrit : > > LLVM generates bpf_addr_space_cast instruction while translating > > pointers between native (zero) address space and > > __attribute

[bpf-next 0/6] bpf,powerpc: Add support for bpf arena and arena atomics

2025-08-05 Thread Saket Kumar Bhaskar
-t arena_spin_lock #6/1 arena_spin_lock/arena_spin_lock_1:OK #6/2 arena_spin_lock/arena_spin_lock_1000:OK #6/3 arena_spin_lock/arena_spin_lock_5:OK #6 arena_spin_lock:OK Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED Saket Kumar Bhaskar (6): bpf,powerpc: Introduce

[bpf-next 6/6] selftests/bpf: Fix arena_spin_lock selftest failure

2025-08-04 Thread Saket Kumar Bhaskar
and the same is passed to the bpf program using rodata. Also the selftest is skipped incase bpf program returns EOPNOTSUPP, with a descriptive message logged. Signed-off-by: Saket Kumar Bhaskar --- .../bpf/prog_tests/arena_spin_lock.c | 23 +-- .../selftests/bpf/pr

[bpf-next 4/6] bpf,powerpc: Introduce bpf_jit_emit_atomic_ops() to emit atomic instructions

2025-08-04 Thread Saket Kumar Bhaskar
be used in case it causes a fault. Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp64.c | 203 +- 1 file changed, 115 insertions(+), 88 deletions(-) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index

[bpf-next 5/6] bpf,powerpc: Implement PROBE_ATOMIC instructions

2025-08-04 Thread Saket Kumar Bhaskar
support as in other architectures like x86 and arm64. Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp.c | 16 arch/powerpc/net/bpf_jit_comp64.c | 26 ++ 2 files changed, 42 insertions(+) diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch

[bpf-next 1/6] bpf,powerpc: Introduce bpf_jit_emit_probe_mem_store() to emit store instructions

2025-08-04 Thread Saket Kumar Bhaskar
bpf_jit_emit_probe_mem_store() is introduced to emit instructions for storing memory values depending on the size (byte, halfword, word, doubleword). Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp64.c | 30 ++ 1 file changed, 30 insertions

[bpf-next 3/6] bpf,powerpc: Implement bpf_addr_space_cast instruction

2025-08-04 Thread Saket Kumar Bhaskar
move: wX = wY. rY = addr_space_cast(rX, 1, 0) : used to convert a bpf arena pointer to a pointer in the userspace vma. This has to be converted by the JIT. Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit.h| 1 + arch/powerpc/net/bpf_jit_comp.c | 6 ++ arch/powerpc

[bpf-next 2/6] bpf,powerpc: Implement PROBE_MEM32 pseudo instructions

2025-08-04 Thread Saket Kumar Bhaskar
destination register is zeroed. To support these on powerpc, we do tmp1 = _R26 + src/dst reg and then use tmp1 as the new src/dst register. This allows us to reuse most of the code for normal [LDX | STX | ST]. Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit.h| 5 +- arch/powerpc

Re: [PATCH RESEND bpf-next 1/1] powerpc64/bpf: Add jit support for load_acquire and store_release

2025-07-24 Thread Saket Kumar Bhaskar
eak pointer to map:OK #566/22 verifier_store_release/store-release, leak pointer to map @unpriv:OK #566/23 verifier_store_release/store-release with invalid register R15:OK #566/24 verifier_store_release/store-release with invalid register R15 @unpriv:OK #566/25 verifier_store_release/store-release to pkt pointer:OK #566/26 verifier_store_release/store-release to flow_keys pointer:OK #566/27 verifier_store_release/store-release to sock pointer:OK #566 verifier_store_release:OK Summary: 3/55 PASSED, 0 SKIPPED, 0 FAILED Tested-by: Saket Kumar Bhaskar Regards, Saket

Re: [PATCH 2/2] powerpc, bpf: Inline bpf_get_smp_processor_id()

2025-04-29 Thread Saket Kumar Bhaskar
On Tue, Mar 11, 2025 at 06:51:28PM +0100, Christophe Leroy wrote: > > > Le 11/03/2025 à 17:09, Saket Kumar Bhaskar a écrit : > > [Vous ne recevez pas souvent de courriers de sk...@linux.ibm.com. Découvrez > > pourquoi ceci est important à https://aka.ms/LearnAbou

Re: [PATCH 1/2] powerpc, bpf: Support internal-only MOV instruction to resolve per-CPU addrs

2025-04-29 Thread Saket Kumar Bhaskar
On Tue, Mar 11, 2025 at 06:38:23PM +0100, Christophe Leroy wrote: > > > Le 11/03/2025 à 17:09, Saket Kumar Bhaskar a écrit : > > [Vous ne recevez pas souvent de courriers de sk...@linux.ibm.com. Découvrez > > pourquoi ceci est important à https://aka.ms/LearnAbou

Re: [linux-next-20250324]/tool/bpf/bpftool fails to complie on linux-next-20250324

2025-04-04 Thread Saket Kumar Bhaskar
On Tue, Mar 25, 2025 at 11:09:24AM +, Quentin Monnet wrote: > 2025-03-25 16:02 UTC+0530 ~ Venkat Rao Bagalkote > > Greetings!!! > > > > > > bpftool fails to complie on linux-next-20250324 repo. > > > > > > Error: > > > > make: *** No rule to make target 'bpftool', needed by '/home/linux/

[PATCH 0/2] bpf: Inline helper in powerpc JIT

2025-03-11 Thread Saket Kumar Bhaskar
This series adds the support of internal only per-CPU instructions and inlines the bpf_get_smp_processor_id() helper call for powerpc BPF JIT. Saket Kumar Bhaskar (2): powerpc, bpf: Support internal-only MOV instruction to resolve per-CPU addrs powerpc, bpf: Inline

[PATCH 1/2] powerpc, bpf: Support internal-only MOV instruction to resolve per-CPU addrs

2025-03-11 Thread Saket Kumar Bhaskar
0.014M/s [1] https://github.com/anakryiko/linux/commit/8dec900975ef Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp.c | 5 + arch/powerpc/net/bpf_jit_comp64.c | 8 2 files changed, 13 insertions(+) diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerp

[PATCH 2/2] powerpc, bpf: Inline bpf_get_smp_processor_id()

2025-03-11 Thread Saket Kumar Bhaskar
± 0.058M/s | + 1.78%| +---+---+---+--+ [1] https://github.com/anakryiko/linux/commit/8dec900975ef Signed-off-by: Saket Kumar Bhaskar --- arch/powerpc/net/bpf_jit_comp.c | 10 ++ arch/powerpc/net/bpf_jit_comp64.c | 5 + 2