[PATCH] MAINTAINERS: powerpc: Remove myself as a reviewer

2025-04-20 Thread Naveen N Rao (AMD)
I haven't been able to participate and help with this as much as I had hoped, and it doesn't look like I will be able to spend time on powerpc going forward. Signed-off-by: Naveen N Rao (AMD) --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAI

Re: [PATCH v2] powerpc64/bpf: fix JIT code size calculation of bpf trampoline

2025-04-19 Thread Naveen N Rao
t a/arch/powerpc/net/bpf_jit_comp64.c > b/arch/powerpc/net/bpf_jit_comp64.c > index 233703b06d7c..91f9efe8b8d7 100644 > --- a/arch/powerpc/net/bpf_jit_comp64.c > +++ b/arch/powerpc/net/bpf_jit_comp64.c > @@ -225,6 +225,15 @@ int bpf_jit_emit_func_call_rel(u32 *image, u32 *fimage, > struct codegen_context * > } > > #ifdef CONFIG_PPC_KERNEL_PCREL > + /* > + * If fimage is NULL (the initial pass to find image size), > + * account for the maximum no. of instructions possible. > + */ > + if (!fimage) { > + ctx->idx += 7; > + return 0; > + } > + I would merge this with the below if conditional so that this gets noticed if the instruction sequence below ever changes. > reladdr = func_addr - local_paca->kernelbase; > > if (reladdr < (long)SZ_8G && reladdr >= -(long)SZ_8G) { Other than that: Acked-by: Naveen N Rao (AMD) - Naveen

Re: [PATCH] powerpc64/ftrace: fix clobbered r15 during livepatching

2025-04-19 Thread Naveen N Rao
b/arch/powerpc/kernel/trace/ftrace_entry.S > @@ -212,10 +212,10 @@ > bne-1f > > mr r3, r15 > +1: mtlrr3 > .if \allregs == 0 > REST_GPR(15, r1) > .endif > -1: mtlrr3 > #endif LGTM. Acked-by: Naveen N Rao (AMD) - Naveen

Re: [RESEND PATCH] powerpc64/bpf: fix JIT code size calculation of bpf trampoline

2025-04-03 Thread Naveen N Rao
On Wed, Mar 26, 2025 at 08:04:22PM +0530, Hari Bathini wrote: > The JIT compile of ldimm instructions can be anywhere between 1-5 > instructions long depending on the value being loaded. > > arch_bpf_trampoline_size() provides JIT size of the BPF trampoline > before the buffer for JIT'ing it is al

Re: [BUG?] ppc64le: fentry BPF not triggered after live patch (v6.14)

2025-04-03 Thread Naveen N Rao
On Tue, Apr 01, 2025 at 02:48:10PM +0200, Jiri Olsa wrote: > On Mon, Mar 31, 2025 at 10:09:40AM -0400, Steven Rostedt wrote: > > On Mon, 31 Mar 2025 21:19:36 +0800 > > Shung-Hsi Yu wrote: > > > > > Hi all, > > > > > > On ppc64le (v6.14, kernel config attached), I've observed that fentry > > > BP

Re: [PATCH] powerpc64/ftrace: fix module loading without patchable function entries

2025-02-13 Thread Naveen N Rao
ze / sizeof(*stub); num_stubs = roundup(me->arch.ool_stub_count * sizeof(struct ftrace_ool_stub), sizeof(struct ppc64_stub_entry)) / sizeof(struct ppc64_stub_entry); Regardless of that, for this patch: Acked-by: Naveen N Rao (AMD) - Naveen

[PATCH 2/2] MAINTAINERS: Update powerpc BPF JIT maintainers

2024-07-14 Thread Naveen N Rao
that I can help with the odd query. Signed-off-by: Naveen N Rao --- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 05f14b67cd74..c7a931ee7a2e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3878,8 +3878,10 @@ S: Odd Fixes F

[PATCH 1/2] MAINTAINERS: Update email address of Naveen

2024-07-14 Thread Naveen N Rao
I have switched to using my @kernel.org id for my contributions. Update MAINTAINERS and mailmap to reflect the same. Cc: Naveen N. Rao Signed-off-by: Naveen N Rao --- .mailmap| 2 ++ MAINTAINERS | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.mailmap b/.mailmap

[RFC PATCH v4 02/17] powerpc/kprobes: Use ftrace to determine if a probe is at function entry

2024-07-14 Thread Naveen N Rao
fall back to using a fixed offset of 8 (two instructions) to categorize a probe as being at function entry for 64-bit elfv2, unless we are using pcrel. Acked-by: Masami Hiramatsu (Google) Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/kprobes.c | 18 -- 1 file changed, 8

[RFC PATCH v4 01/17] powerpc/trace: Account for -fpatchable-function-entry support by toolchain

2024-07-14 Thread Naveen N Rao
-entry, and is unlikely to support -mprofile-kernel. Update our Makefile checks so that we pick up the correct files to build once clang picks up support for -fpatchable-function-entry. [*] https://github.com/llvm/llvm-project/issues/57031 Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace

[RFC PATCH v4 10/17] powerpc/ftrace: Add a postlink script to validate function tracer

2024-07-14 Thread Naveen N Rao
that we can detect this at build time, and break the build if necessary. We add a dependency on !COMPILE_TEST for CONFIG_HAVE_FUNCTION_TRACER so that allyesconfig and other test builds can continue to work without enabling ftrace. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig

[RFC PATCH v4 09/17] powerpc64/bpf: Fold bpf_jit_emit_func_call_hlp() into bpf_jit_emit_func_call_rel()

2024-07-14 Thread Naveen N Rao
f program since they all work with the kernel TOC. We only need to do it if we have to call out to a module function. So, guard TOC load/restore with appropriate conditions. Signed-off-by: Naveen N Rao --- arch/powerpc/net/bpf_jit_comp64.c | 61 +-- 1 file changed

[RFC PATCH v4 08/17] powerpc/ftrace: Move ftrace stub used for init text before _einittext

2024-07-14 Thread Naveen N Rao
Move the ftrace stub used to cover inittext before _einittext so that it is within kernel text, as seen through core_kernel_text(). This is required for a subsequent change to ftrace. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/vmlinux.lds.S | 3 +-- 1 file changed, 1 insertion(+), 2

[RFC PATCH v4 07/17] powerpc/ftrace: Skip instruction patching if the instructions are the same

2024-07-14 Thread Naveen N Rao
To simplify upcoming changes to ftrace, add a check to skip actual instruction patching if the old and new instructions are the same. We still validate that the instruction is what we expect, but don't actually patch the same instruction again. Signed-off-by: Naveen N Rao --- arch/po

[RFC PATCH v4 06/17] powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace

2024-07-14 Thread Naveen N Rao
architectures. Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h| 1 - arch/powerpc/kernel/trace/ftrace.c | 49 + arch/powerpc/kernel/trace/ftrace_64_pg.c | 69 ++-- 3 files changed, 56 insertions(+), 63

[RFC PATCH v4 05/17] powerpc/module_64: Convert #ifdef to IS_ENABLED()

2024-07-14 Thread Naveen N Rao
Minor refactor for converting #ifdef to IS_ENABLED(). Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/module_64.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c

[RFC PATCH v4 04/17] powerpc32/ftrace: Unify 32-bit and 64-bit ftrace entry code

2024-07-14 Thread Naveen N Rao
erefore is not necessary unless ftrace is enabled. Nop it out during ftrace init. When ftrace is enabled, we want the 'stw' so that stack unwinding works properly. Perform the same within the ftrace handler, similar to 64-bit powerpc. Reviewed-by: Nicholas Piggin Signed-off-by: Nav

[RFC PATCH v4 03/17] powerpc64/ftrace: Nop out additional 'std' instruction emitted by gcc v5.x

2024-07-14 Thread Naveen N Rao
nel boot. With this change, we now use the same 2-instruction profiling sequence with both -mprofile-kernel, as well as -fpatchable-function-entry on 64-bit powerpc. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff

[RFC PATCH v4 17/17] powerpc64/bpf: Add support for bpf trampolines

2024-07-14 Thread Naveen N Rao
that other cpus execute isync (or some CSI) so that they don't go back into the trampoline again. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ppc-opcode.h | 14 + arch/powerpc/net/bpf_jit.h| 12 + arch/powerpc/net/bpf_jit_comp.c | 842 +

[RFC PATCH v4 16/17] samples/ftrace: Add support for ftrace direct samples on powerpc

2024-07-14 Thread Naveen N Rao
Add powerpc 32-bit and 64-bit samples for ftrace direct. This serves to show the sample instruction sequence to be used by ftrace direct calls to adhere to the ftrace ABI. On 64-bit powerpc, TOC setup requires some additional work. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig

[RFC PATCH v4 15/17] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS

2024-07-14 Thread Naveen N Rao
pr3 that can then be tested on the return path from the ftrace trampoline to branch into the direct caller. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/ftrace.h| 15 +++ arch/powerpc/kernel/asm-offsets.c| 3 + a

[RFC PATCH v4 14/17] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_CALL_OPS

2024-07-14 Thread Naveen N Rao
entry, we load from this location and call into ftrace_ops->func(). For 64-bit powerpc, we ensure that the out-of-line stub area is doubleword aligned so that ftrace_ops address can be updated atomically. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 1 + arch

[RFC PATCH v4 13/17] powerpc64/ftrace: Support .text larger than 32MB with out-of-line stubs

2024-07-14 Thread Naveen N Rao
pport vmlinux .text size up to ~64MB. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 12 arch/powerpc/include/asm/ftrace.h | 6 -- arch/powerpc/kernel/trace/ftrace.c | 21 + arch/powerpc/kernel/trace/ftrace_en

[RFC PATCH v4 12/17] powerpc64/ftrace: Move ftrace sequence out of line

2024-07-14 Thread Naveen N Rao
r2,r2,-16028 b ftrace_ool_stub_text_end+0x11b28 mfocrf r11,8 ... The associated stub: : mflrr0 bl ftrace_caller mtlrr0 b kernel_clone+0xc ... Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig

[RFC PATCH v4 11/17] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-07-14 Thread Naveen N Rao
//tools/Makefile with .arch.vmlinux.o target, which will be invoked prior to the final vmlinux link step. Signed-off-by: Naveen N Rao --- arch/Kconfig | 6 ++ scripts/Makefile.vmlinux | 8 scripts/link-vmlinux.sh | 11 --- 3 files changed, 22 insertions(+), 3

[RFC PATCH v4 00/17] powerpc: Core ftrace rework, support for ftrace direct and bpf trampolines

2024-07-14 Thread Naveen N Rao
structions during trampoline attach/detach. - Naveen Naveen N Rao (17): powerpc/trace: Account for -fpatchable-function-entry support by toolchain powerpc/kprobes: Use ftrace to determine if a probe is at function entry powerpc64/ftrace: Nop out additional 'std' instru

Re: [RFC PATCH v3 00/11] powerpc: Add support for ftrace direct and BPF trampolines

2024-07-14 Thread Naveen N Rao
Hi Vishal, Vishal Chourasia wrote: On Fri, Jun 21, 2024 at 12:24:03AM +0530, Naveen N Rao wrote: This is v3 of the patches posted here: http://lkml.kernel.org/r/cover.1718008093.git.nav...@kernel.org Since v2, I have addressed review comments from Steven and Masahiro along with a few fixes

Re: WARNING&Oops in v6.6.37 on ppc64lea - Trying to vfree() bad address (00000000453be747)

2024-07-09 Thread Naveen N Rao
Greg Kroah-Hartman wrote: On Mon, Jul 08, 2024 at 11:16:48PM -0400, matoro wrote: On 2024-07-05 16:34, Vitaly Chikunov wrote: > Hi, > > There is new WARNING and Oops on ppc64le in v6.6.37 when running LTP tests: > bpf_prog01, bpf_prog02, bpf_prog04, bpf_prog05, prctl04. Logs excerpt > below. I

Re: [PATCH v3] PowerPC: Replace kretprobe with rethook

2024-07-09 Thread Naveen N Rao
Masami Hiramatsu wrote: On Thu, 27 Jun 2024 09:21:01 -0400 Abhishek Dubey wrote: +/* rethook initializer */ +int __init arch_init_kprobes(void) +{ + return register_kprobe(&trampoline_p); +} No, please don't use arch_init_kprobes() for initializing rethook, since rethook is used from f

Re: [RFC PATCH v3 11/11] powerpc64/bpf: Add support for bpf trampolines

2024-07-01 Thread Naveen N Rao
On Mon, Jul 01, 2024 at 09:03:52PM GMT, Nicholas Piggin wrote: > On Fri Jun 21, 2024 at 5:09 AM AEST, Naveen N Rao wrote: > > Add support for bpf_arch_text_poke() and arch_prepare_bpf_trampoline() > > for 64-bit powerpc. > > What do BPF trampolines give you? At a very basic

Re: [RFC PATCH v3 06/11] powerpc64/ftrace: Move ftrace sequence out of line

2024-07-01 Thread Naveen N Rao
On Mon, Jul 01, 2024 at 08:39:03PM GMT, Nicholas Piggin wrote: > On Fri Jun 21, 2024 at 4:54 AM AEST, Naveen N Rao wrote: > > Function profile sequence on powerpc includes two instructions at the > > beginning of each function: > > mflrr0 > > bl ftrace

Re: [RFC PATCH v3 04/11] powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace

2024-07-01 Thread Naveen N Rao
On Mon, Jul 01, 2024 at 07:27:55PM GMT, Nicholas Piggin wrote: > On Fri Jun 21, 2024 at 4:54 AM AEST, Naveen N Rao wrote: > > Pointer to struct module is only relevant for ftrace records belonging > > to kernel modules. Having this field in dyn_arch_ftrace wastes memory > > f

Re: [RFC PATCH v3 02/11] powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code

2024-07-01 Thread Naveen N Rao
On Mon, Jul 01, 2024 at 06:57:12PM GMT, Nicholas Piggin wrote: > On Fri Jun 21, 2024 at 4:54 AM AEST, Naveen N Rao wrote: > > On 32-bit powerpc, gcc generates a three instruction sequence for > > function profiling: > > mflrr0 > > stw r0, 4(r1) > &g

Re: [RFC PATCH v3 01/11] powerpc/kprobes: Use ftrace to determine if a probe is at function entry

2024-07-01 Thread Naveen N Rao
Hi Nick, Thanks for the reviews! On Mon, Jul 01, 2024 at 06:40:50PM GMT, Nicholas Piggin wrote: > On Fri Jun 21, 2024 at 4:54 AM AEST, Naveen N Rao wrote: > > Rather than hard-coding the offset into a function to be used to > > determine if a kprobe is at function entry, use ftrac

Re: [PATCH v3] PowerPC: Replace kretprobe with rethook

2024-07-01 Thread Naveen N Rao
auses the handlers to fire > + */ > +asm(".global arch_rethook_trampoline\n" > + ".type arch_rethook_trampoline, @function\n" > + "arch_rethook_trampoline:\n" > + "nop\n" > + "blr\n" > + ".size arch_reth

[RFC PATCH v3 11/11] powerpc64/bpf: Add support for bpf trampolines

2024-06-20 Thread Naveen N Rao
with a 'blr'. The trampoline code itself closely follows x86 implementation. While the code is generic, BPF trampolines are only enabled on 64-bit powerpc. 32-bit powerpc will need testing and some updates. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ppc-opcode.h |

[RFC PATCH v3 10/11] powerpc64/bpf: Fold bpf_jit_emit_func_call_hlp() into bpf_jit_emit_func_call_rel()

2024-06-20 Thread Naveen N Rao
f program since they all work with the kernel TOC. We only need to do it if we have to call out to a module function. So, guard TOC load/restore with appropriate conditions. Signed-off-by: Naveen N Rao --- arch/powerpc/net/bpf_jit_comp64.c | 61 +-- 1 file changed

[RFC PATCH v3 09/11] samples/ftrace: Add support for ftrace direct samples on powerpc

2024-06-20 Thread Naveen N Rao
Add powerpc 32-bit and 64-bit samples for ftrace direct. This serves to show the sample instruction sequence to be used by ftrace direct calls to adhere to the ftrace ABI. On 64-bit powerpc, TOC setup requires some additional work. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig

[RFC PATCH v3 08/11] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS

2024-06-20 Thread Naveen N Rao
pr3 that can then be tested on the return path from the ftrace trampoline to branch into the direct caller. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/ftrace.h| 15 arch/powerpc/kernel/asm-offsets.c| 3 + arch/powe

[RFC PATCH v3 01/11] powerpc/kprobes: Use ftrace to determine if a probe is at function entry

2024-06-20 Thread Naveen N Rao
fall back to using a fixed offset of 8 (two instructions) to categorize a probe as being at function entry for 64-bit elfv2, unless we are using pcrel. Acked-by: Masami Hiramatsu (Google) Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/kprobes.c | 18 -- 1 file changed, 8

[RFC PATCH v3 07/11] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_CALL_OPS

2024-06-20 Thread Naveen N Rao
entry, we load from this location and call into ftrace_ops->func(). For 64-bit powerpc, we ensure that the out-of-line stub area is doubleword aligned so that ftrace_ops address can be updated atomically. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 1 + arch

[RFC PATCH v3 06/11] powerpc64/ftrace: Move ftrace sequence out of line

2024-06-20 Thread Naveen N Rao
and enabled by default only on 64-bit powerpc. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 5 + arch/powerpc/Makefile | 4 + arch/powerpc/include/asm/ftrace.h | 10 ++ arch/powerpc/include/asm/module.h | 5 + arch/pow

[RFC PATCH v3 05/11] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-06-20 Thread Naveen N Rao
//tools/Makefile with .arch.vmlinux.o target, which will be invoked prior to the final vmlinux link step. Signed-off-by: Naveen N Rao --- arch/Kconfig | 3 +++ scripts/Makefile.vmlinux | 8 scripts/link-vmlinux.sh | 11 --- 3 files changed, 19 insertions(+), 3 deletions

[RFC PATCH v3 04/11] powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace

2024-06-20 Thread Naveen N Rao
architectures. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h| 1 - arch/powerpc/kernel/trace/ftrace.c | 54 +++--- arch/powerpc/kernel/trace/ftrace_64_pg.c | 73 +++- 3 files changed, 65 insertions(+), 63 deletions(-) diff --git a/arch

[RFC PATCH v3 03/11] powerpc/module_64: Convert #ifdef to IS_ENABLED()

2024-06-20 Thread Naveen N Rao
Minor refactor for converting #ifdef to IS_ENABLED(). Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/module_64.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index e9bab599d0c2

[RFC PATCH v3 02/11] powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code

2024-06-20 Thread Naveen N Rao
used to emit a three instruction sequence for function profiling (with -mprofile-kernel) with a 'std' instruction to mimic the 'stw' above. Address that scenario also by nop-ing out the 'std' instruction during ftrace init. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/tr

[RFC PATCH v3 00/11] powerpc: Add support for ftrace direct and BPF trampolines

2024-06-20 Thread Naveen N Rao
series depends on the patch series from Benjamin Gray adding support for patch_ulong(): http://lkml.kernel.org/r/20240515024445.236364-1-bg...@linux.ibm.com - Naveen Naveen N Rao (11): powerpc/kprobes: Use ftrace to determine if a probe is at function entry powerpc/ftrace: Unify 32-bit

Re: [PATCH v2] PowerPC: Replace kretprobe with rethook

2024-06-18 Thread Naveen N Rao
On Tue, Jun 18, 2024 at 06:43:06AM GMT, Masami Hiramatsu wrote: > On Mon, 17 Jun 2024 18:28:07 +0530 > Naveen N Rao wrote: > > > Hi Abhishek, > > > > On Mon, Jun 10, 2024 at 11:45:09AM GMT, Abhishek Dubey wrote: > > > This is an adaptation of commi

Re: [PATCH v2] PowerPC: Replace kretprobe with rethook

2024-06-17 Thread Naveen N Rao
Hi Abhishek, On Mon, Jun 10, 2024 at 11:45:09AM GMT, Abhishek Dubey wrote: > This is an adaptation of commit f3a112c0c40d ("x86,rethook,kprobes: > Replace kretprobe with rethook on x86") to PowerPC. > > Replaces the kretprobe code with rethook on Power. With this patch, > kretprobe on Power uses

Re: [RFC PATCH v2 4/5] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-06-12 Thread Naveen N Rao
On Tue, Jun 11, 2024 at 11:05:56PM GMT, Naveen N Rao wrote: > On Tue, Jun 11, 2024 at 06:51:51AM GMT, Masahiro Yamada wrote: > > On Tue, Jun 11, 2024 at 2:20 AM Naveen N Rao wrote: > > > > > > On Mon, Jun 10, 2024 at 06:14:51PM GMT, Masahiro Yamada wrote: > > &g

Re: [RFC PATCH v2 4/5] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-06-11 Thread Naveen N Rao
On Tue, Jun 11, 2024 at 06:51:51AM GMT, Masahiro Yamada wrote: > On Tue, Jun 11, 2024 at 2:20 AM Naveen N Rao wrote: > > > > On Mon, Jun 10, 2024 at 06:14:51PM GMT, Masahiro Yamada wrote: > > > On Mon, Jun 10, 2024 at 5:39 PM Naveen N Rao wrote: > > > > >

Re: [RFC PATCH v2 3/5] powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code

2024-06-11 Thread Naveen N Rao
On Mon, Jun 10, 2024 at 04:06:32PM GMT, Steven Rostedt wrote: > On Mon, 10 Jun 2024 14:08:16 +0530 > Naveen N Rao wrote: > > > On 32-bit powerpc, gcc generates a three instruction sequence for > > function profiling: > > mflrr0 > > stw

Re: [RFC PATCH v2 2/5] powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace

2024-06-11 Thread Naveen N Rao
On Mon, Jun 10, 2024 at 04:03:56PM GMT, Steven Rostedt wrote: > On Mon, 10 Jun 2024 14:08:15 +0530 > Naveen N Rao wrote: > > > Pointer to struct module is only relevant for ftrace records belonging > > to kernel modules. Having this field in dyn_arch_ftrace wastes memo

Re: [RFC PATCH v2 4/5] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-06-10 Thread Naveen N Rao
On Mon, Jun 10, 2024 at 06:14:51PM GMT, Masahiro Yamada wrote: > On Mon, Jun 10, 2024 at 5:39 PM Naveen N Rao wrote: > > > > On powerpc, we would like to be able to make a pass on vmlinux.o and > > generate a new object file to be linked into vmlinux. Add a generic pass &

[RFC PATCH v2 5/5] powerpc64/ftrace: Move ftrace sequence out of line

2024-06-10 Thread Naveen N Rao
and enabled by default only on 64-bit powerpc. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 4 + arch/powerpc/Makefile| 4 + arch/powerpc/include/asm/ftrace.h| 10 ++ arch/powerpc/include/asm/module.h| 5 + arch/powerpc/kerne

[RFC PATCH v2 1/5] powerpc/kprobes: Use ftrace to determine if a probe is at function entry

2024-06-10 Thread Naveen N Rao
fall back to using a fixed offset of 8 (two instructions) to categorize a probe as being at function entry for 64-bit elfv2, unless we are using pcrel. Acked-by: Masami Hiramatsu (Google) Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/kprobes.c | 18 -- 1 file changed, 8

[RFC PATCH v2 4/5] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-06-10 Thread Naveen N Rao
/vmlinux_o.sh, which will be invoked prior to the final vmlinux link step. Signed-off-by: Naveen N Rao --- arch/Kconfig| 3 +++ scripts/link-vmlinux.sh | 18 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index

[RFC PATCH v2 3/5] powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code

2024-06-10 Thread Naveen N Rao
used to emit a three instruction sequence for function profiling (with -mprofile-kernel) with a 'std' instruction to mimic the 'stw' above. Address that scenario also by nop-ing out the 'std' instruction during ftrace init. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/tr

[RFC PATCH v2 2/5] powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace

2024-06-10 Thread Naveen N Rao
architectures. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h| 1 - arch/powerpc/kernel/trace/ftrace.c | 47 ++- arch/powerpc/kernel/trace/ftrace_64_pg.c | 73 +++- 3 files changed, 64 insertions(+), 57 deletions(-) diff --git a/arch

[RFC PATCH v2 0/5] powerpc/ftrace: Move ftrace sequence out of line

2024-06-10 Thread Naveen N Rao
roach. Thanks, Naveen Naveen N Rao (5): powerpc/kprobes: Use ftrace to determine if a probe is at function entry powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code kbuild: Add generic hook for architectures t

Re: [PATCH v2] arch/powerpc: Remove unused cede related functions

2024-05-14 Thread Naveen N Rao
enghani > --- > v1 -> v2: > 1. Remove helpers of extended_cede_processor() Acked-by: Naveen N Rao > > arch/powerpc/include/asm/plpar_wrappers.h | 28 --- > 1 file changed, 28 deletions(-) > > diff --git a/arch/powerpc/include/asm/plpar_wrapp

Re: [PATCH] arch/powerpc: Remove the definition of unused cede function

2024-05-14 Thread Naveen N Rao
On Tue, May 14, 2024 at 03:35:03PM GMT, Gautam Menghani wrote: > Remove extended_cede_processor() definition as it has no callers since > commit 48f6e7f6d948("powerpc/pseries: remove cede offline state for CPUs") extended_cede_processor() was added in commit 69ddb57cbea0 ("powerpc/pseries: Add ex

Re: [PATCH v3 3/5] powerpc/64: Convert patch_instruction() to patch_u32()

2024-05-14 Thread Naveen N Rao
On Tue, May 14, 2024 at 04:39:30AM GMT, Christophe Leroy wrote: > > > Le 14/05/2024 à 04:59, Benjamin Gray a écrit : > > On Tue, 2024-04-23 at 15:09 +0530, Naveen N Rao wrote: > >> On Mon, Mar 25, 2024 at 04:53:00PM +1100, Benjamin Gray wrote: > >>> This use

Re: [PATCH bpf v3] powerpc/bpf: enforce full ordering for ATOMIC operations with BPF_FETCH

2024-05-13 Thread Naveen N Rao
dbe6e2456fb0 ("powerpc/bpf/64: add support for atomic fetch operations") Fixes: 1e82dfaa7819 ("powerpc/bpf/64: Add instructions for atomic_[cmp]xchg") > Signed-off-by: Puranjay Mohan > Acked-by: Paul E. McKenney Cc: sta...@vger.kernel.org # v6.0+ I have tested this with test_bpf and test_progs. Reviewed-by: Naveen N Rao - Naveen

Re: [PATCH bpf v2] powerpc/bpf: enforce full ordering for ATOMIC operations with BPF_FETCH

2024-05-08 Thread Naveen N Rao
On Wed, May 08, 2024 at 11:54:04AM GMT, Puranjay Mohan wrote: > The Linux Kernel Memory Model [1][2] requires RMW operations that have a > return value to be fully ordered. > > BPF atomic operations with BPF_FETCH (including BPF_XCHG and > BPF_CMPXCHG) return a value back so they need to be JITed

Re: [PATCH v4 2/2] powerpc/bpf: enable kfunc call

2024-05-07 Thread Naveen N Rao
return -EINVAL; > > - if (IS_ENABLED(CONFIG_PPC_KERNEL_PCREL)) { > - reladdr = func_addr - local_paca->kernelbase; > +#ifdef CONFIG_PPC_KERNEL_PCREL Would be good to retain use of IS_ENABLED(). Reviewed-by: Naveen N Rao - Naveen

Re: [PATCH v4 1/2] powerpc64/bpf: fix tail calls for PCREL addressing

2024-05-07 Thread Naveen N Rao
F || reladdr < -(0x8000L)) { > @@ -233,9 +235,9 @@ static int bpf_jit_emit_func_call_hlp(u32 *image, struct > codegen_context *ctx, u > > EMIT(PPC_RAW_ADDIS(_R12, _R2, PPC_HA(reladdr))); > EMIT(PPC_RAW_ADDI(_R12, _R12, PPC_LO(reladdr))); > - EMIT(PPC_RAW_MTCTR(_R12)); > - EMIT(PPC_RAW_BCTRL()); > } > + EMIT(PPC_RAW_MTCTR(_R12)); > + EMIT(PPC_RAW_BCTRL()); This change shouldn't be necessary since these instructions are moved back into the conditional in the next patch. Other than those minor comments: Reviewed-by: Naveen N Rao - Naveen

Re: [PATCH v6] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-05-06 Thread Naveen N Rao
_to_ns(be64_to_cpu(lp->l2_to_l1_cs_tb)); > + l2_runtime_ns = tb_to_ns(be64_to_cpu(lp->l2_runtime_tb)); > + trace_kvmppc_vcpu_stats(vcpu, l1_to_l2_ns - local_paca->l1_to_l2_cs, > + l2_to_l1_ns - local_paca->l2_to_l1_cs, > +

Re: [PATCH v5 RESEND] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-04-25 Thread Naveen N Rao
On Wed, Apr 24, 2024 at 11:08:38AM +0530, Gautam Menghani wrote: > On Mon, Apr 22, 2024 at 09:15:02PM +0530, Naveen N Rao wrote: > > On Tue, Apr 02, 2024 at 12:36:54PM +0530, Gautam Menghani wrote: > > > static int kvmhv_vcpu_entry_nestedv2(struct kvm_vcpu *vcpu, u64

Re: [PATCH v3 0/5] Add generic data patching functions

2024-04-23 Thread Naveen N Rao
c/platforms/powermac/smp.c| 2 +- > 6 files changed, 132 insertions(+), 20 deletions(-) Apart from the minor comments, for this series: Acked-by: Naveen N Rao Thanks for working on this. - Naveen

Re: [PATCH v3 3/5] powerpc/64: Convert patch_instruction() to patch_u32()

2024-04-23 Thread Naveen N Rao
On Mon, Mar 25, 2024 at 04:53:00PM +1100, Benjamin Gray wrote: > This use of patch_instruction() is working on 32 bit data, and can fail > if the data looks like a prefixed instruction and the extra write > crosses a page boundary. Use patch_u32() to fix the write size. > > Fixes: 8734b41b3efe ("p

Re: [PATCH v3 5/5] powerpc/code-patching: Add boot selftest for data patching

2024-04-23 Thread Naveen N Rao
On Mon, Mar 25, 2024 at 04:53:02PM +1100, Benjamin Gray wrote: > Extend the code patching selftests with some basic coverage of the new > data patching variants too. > > Signed-off-by: Benjamin Gray > > --- > > v3: * New in v3 > --- > arch/powerpc/lib/test-code-patching.c | 36

Re: [PATCH v5 RESEND] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-04-22 Thread Naveen N Rao
On Tue, Apr 02, 2024 at 12:36:54PM +0530, Gautam Menghani wrote: > PAPR hypervisor has introduced three new counters in the VPA area of > LPAR CPUs for KVM L2 guest (see [1] for terminology) observability - 2 > for context switches from host to guest and vice versa, and 1 counter > for getting the

Re: [PATCH v3 2/2] powerpc/bpf: enable kfunc call

2024-04-15 Thread Naveen N Rao
On Tue, Apr 02, 2024 at 04:28:06PM +0530, Hari Bathini wrote: > Currently, bpf jit code on powerpc assumes all the bpf functions and > helpers to be kernel text. This is false for kfunc case, as function > addresses can be module addresses as well. So, ensure module addresses > are supported to ena

Re: [PATCH v2 2/2] powerpc/bpf: enable kfunc call

2024-02-15 Thread Naveen N Rao
On Tue, Feb 13, 2024 at 07:54:27AM +, Christophe Leroy wrote: > > > Le 01/02/2024 à 18:12, Hari Bathini a écrit : > > With module addresses supported, override bpf_jit_supports_kfunc_call() > > to enable kfunc support. Module address offsets can be more than 32-bit > > long, so override bpf_j

Re: [PATCH v2 1/2] powerpc/bpf: ensure module addresses are supported

2024-02-15 Thread Naveen N Rao
On Thu, Feb 01, 2024 at 10:42:48PM +0530, Hari Bathini wrote: > Currently, bpf jit code on powerpc assumes all the bpf functions and > helpers to be kernel text. This is false for kfunc case, as function > addresses are mostly module addresses in that case. Ensure module > addresses are supported t

[PATCH v2] powerpc/ftrace: Ignore ftrace locations in exit text sections

2024-02-13 Thread Naveen N Rao
entry") Cc: sta...@vger.kernel.org Reported-by: Michael Ellerman Signed-off-by: Naveen N Rao Reviewed-by: Benjamin Gray --- v2: - Rename exit text section variable name to match other architectures - Fix clang builds I've collected Benjamin's Reviewed-by tag since those parts of the pat

Re: [PATCH] powerpc/ftrace: Ignore ftrace locations in exit text sections

2024-02-12 Thread Naveen N Rao
On Mon, Feb 12, 2024 at 07:31:03PM +, Christophe Leroy wrote: > > > Le 09/02/2024 à 08:59, Naveen N Rao a écrit : > > diff --git a/arch/powerpc/include/asm/sections.h > > b/arch/powerpc/include/asm/sections.h > > index ea26665f82cf..d389dcecdb0b 100644 > &g

[PATCH] powerpc/ftrace: Ignore ftrace locations in exit text sections

2024-02-09 Thread Naveen N Rao
entry") Cc: sta...@vger.kernel.org Reported-by: Michael Ellerman Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h | 9 + arch/powerpc/include/asm/sections.h | 1 + arch/powerpc/kernel/trace/ftrace.c | 12 arch/powerpc/kernel/vmlinux.lds.S | 2 ++

Re: Re: [PATCH v2 1/3] powerpc/code-patching: Add generic memory patching

2024-02-05 Thread Naveen N Rao
On Mon, Feb 05, 2024 at 01:30:46PM +1100, Benjamin Gray wrote: > On Thu, 2023-11-30 at 15:55 +0530, Naveen N Rao wrote: > > On Mon, Oct 16, 2023 at 04:01:45PM +1100, Benjamin Gray wrote: > > > > > > diff --git a/arch/powerpc/include/asm/code-patching.h > >

[PATCH v2] powerpc/64: Set task pt_regs->link to the LR value on scv entry

2024-02-02 Thread Naveen N Rao
[unknown] [unknown] __clone -multipathd (698) 3001661 Fixes: 7fa95f9adaee ("powerpc/64s: system call support for scv/rfscv instructions") Cc: sta...@vger.kernel.org Reported-by: Nysal Jan K.A Signed-off-by: Naveen N Rao --- v2: Update change log,

Re: Re: [PATCH] powerpc/64: Set LR to a non-NULL value in task pt_regs on scv entry

2024-02-02 Thread Naveen N Rao
On Fri, Feb 02, 2024 at 01:02:39PM +1100, Michael Ellerman wrote: > Segher Boessenkool writes: > > Hi! > > > > On Thu, Jan 25, 2024 at 05:12:28PM +0530, Naveen N Rao wrote: > >> diff --git a/arch/powerpc/kernel/interrupt_64.S > >> b/arch/powerpc/kernel

[PATCH] powerpc/64: Set LR to a non-NULL value in task pt_regs on scv entry

2024-01-25 Thread Naveen N Rao
-python (1293) 11 clock_nanosleep clock_nanosleep nanosleep sleep [unknown] [unknown] __clone -multipathd (698) 3001661 Reported-by: Nysal Jan K.A Signed-off-by: Naveen N Rao

[PATCH v2] powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large

2024-01-10 Thread Naveen N Rao
All supported compilers today (gcc v5.1+ and clang v11+) have support for -mcmodel=medium. As such, NO_MINIMAL_TOC is no longer being set. Remove NO_MINIMAL_TOC as well as the fallback to -mminimal-toc. Reviewed-by: Christophe Leroy Signed-off-by: Naveen N Rao --- v2: Drop the call to cc-option

Re: [PATCH] powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large

2024-01-10 Thread Naveen N Rao
On Tue, Jan 09, 2024 at 12:39:36PM -0600, Segher Boessenkool wrote: > On Tue, Jan 09, 2024 at 03:15:35PM +, Christophe Leroy wrote: > > > CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) > > > endif > > > endif > > > -CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium

[PATCH] powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large

2024-01-09 Thread Naveen N Rao
All supported compilers today (gcc v5.1+ and clang v11+) have support for -mcmodel=medium. As such, NO_MINIMAL_TOC is no longer being set. Remove NO_MINIMAL_TOC as well as the fallback to -mminimal-toc. Signed-off-by: Naveen N Rao --- arch/powerpc/Makefile | 6 +- arch

Re: [RFC PATCH 6/9] powerpc/ftrace: Update and move function profile instructions out-of-line

2023-12-22 Thread Naveen N Rao
On Thu, Dec 21, 2023 at 10:46:08AM +, Christophe Leroy wrote: > > > Le 08/12/2023 à 17:30, Naveen N Rao a écrit : > > Function profile sequence on powerpc includes two instructions at the > > beginning of each function: > > > > mflrr0 > >

Re: [PATCH 1/2] powerpc/bpf: ensure module addresses are supported

2023-12-22 Thread Naveen N Rao
On Wed, Dec 20, 2023 at 10:26:21PM +0530, Hari Bathini wrote: > Currently, bpf jit code on powerpc assumes all the bpf functions and > helpers to be kernel text. This is false for kfunc case, as function > addresses are mostly module addresses in that case. Ensure module > addresses are supported t

Re: [PATCH 07/13] powerpc/kprobes: Unpoison instruction in kprobe struct

2023-12-14 Thread Naveen N Rao
On Thu, Dec 14, 2023 at 05:55:33AM +, Nicholas Miehlbradt wrote: > KMSAN does not unpoison the ainsn field of a kprobe struct correctly. > Manually unpoison it to prevent false positives. > > Signed-off-by: Nicholas Miehlbradt > --- > arch/powerpc/kernel/kprobes.c | 2 ++ > 1 file changed, 2

Re: [PATCH] MAINTAINERS: powerpc: Add Aneesh & Naveen

2023-12-13 Thread Naveen N. Rao
Michael Ellerman wrote: Aneesh and Naveen are helping out with some aspects of upstream maintenance, add them as reviewers. Signed-off-by: Michael Ellerman --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) Acked-by: Naveen N. Rao Thanks, Naveen diff --git a/MAINTAINERS b

[RFC PATCH 1/9] powerpc/ftrace: Fix indentation in ftrace.h

2023-12-08 Thread Naveen N Rao
Replace seven spaces with a tab character to fix an indentation issue reported by the kernel test robot. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202311221731.aluwtdim-...@intel.com/ Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h | 2

[RFC PATCH 9/9] samples/ftrace: Add support for ftrace direct samples on powerpc

2023-12-08 Thread Naveen N Rao
Add powerpc 32-bit and 64-bit samples for ftrace direct. This serves to show the sample instruction sequence to be used by ftrace direct calls to adhere to the ftrace ABI. On 64-bit powerpc, TOC setup requires some additional work. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig

[RFC PATCH 8/9] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS

2023-12-08 Thread Naveen N Rao
pr3 that can then be tested on the return path from the ftrace trampoline to branch into the direct caller. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/ftrace.h| 15 arch/powerpc/kernel/asm-offsets.c| 3 + arch/powe

[RFC PATCH 7/9] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_CALL_OPS

2023-12-08 Thread Naveen N Rao
call into ftrace_ops->func(). For 64-bit powerpc, we also select FUNCTION_ALIGNMENT_8B so that the ftrace_ops pointer is double word aligned and can be updated atomically. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 2 + arch/powerpc/kernel/asm-offsets.c

[RFC PATCH 6/9] powerpc/ftrace: Update and move function profile instructions out-of-line

2023-12-08 Thread Naveen N Rao
on (excluding the one or two instructions for supporting DYNAMIC_FTRACE_WITH_CALL_OPS). On 64-bit powerpc with the current implementation of -fpatchable-function-entry though, this is not avoidable since we are forced to emit 6 instructions between the GEP and the LEP even if we are to only supp

[RFC PATCH 5/9] powerpc/kprobes: Use ftrace to determine if a probe is at function entry

2023-12-08 Thread Naveen N Rao
fall back to using a fixed offset of 8 (two instructions) to categorize a probe as being at function entry for 64-bit elfv2. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/kprobes.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel

[RFC PATCH 4/9] powerpc/Kconfig: Select FUNCTION_ALIGNMENT_4B

2023-12-08 Thread Naveen N Rao
From: Sathvika Vasireddy Commit d49a0626216b95 ("arch: Introduce CONFIG_FUNCTION_ALIGNMENT") introduced a generic function-alignment infrastructure. Move to using FUNCTION_ALIGNMENT_4B on powerpc, to use the same alignment as that of the existing _GLOBAL macro. Signed-off-by: Sathvika Vasireddy

[RFC PATCH 3/9] powerpc/ftrace: Remove nops after the call to ftrace_stub

2023-12-08 Thread Naveen N Rao
ftrace_stub is within the same CU, so there is no need for a subsequent nop instruction. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace_entry.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace_entry.S b/arch/powerpc/kernel/trace

[RFC PATCH 2/9] powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code

2023-12-08 Thread Naveen N Rao
used to emit a three instruction sequence for function profiling (with -mprofile-kernel) with a 'std' instruction to mimic the 'stw' above. Address that scenario also by nop-ing out the 'std' instruction during ftrace init. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/tr

[RFC PATCH 0/9] powerpc: ftrace updates

2023-12-08 Thread Naveen N Rao
se ok. - Naveen Naveen N Rao (8): powerpc/ftrace: Fix indentation in ftrace.h powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code powerpc/ftrace: Remove nops after the call to ftrace_stub powerpc/kprobes: Use ftrace to determine if a probe is at function entry powerpc/ftrace: Updat

  1   2   3   4   5   6   7   8   9   10   >