Re: [RFC PATCH -tip v5 07/27] powerpc/kprobes: Remove jprobe powerpc implementation

2018-06-07 Thread Naveen N. Rao
: Michael Ellerman Cc: "Naveen N. Rao" Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/kprobes.h |2 - arch/powerpc/kernel/kprobes-ftrace.c | 15 --- arch/powerpc/kernel/kprobes.c | 54 arch/powerpc/ke

Re: [RFC PATCH -tip v5 18/27] powerpc/kprobes: Don't call the ->break_handler() in arm kprobes code

2018-06-07 Thread Naveen N. Rao
ing this function. Signed-off-by: Masami Hiramatsu Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: "Naveen N. Rao" Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/kprobes.h | 10 -- arch/powerpc/kernel/kprobes-ftrace.c | 16 +++-

Re: [RFC PATCH -tip v5 24/27] bpf: error-inject: kprobes: Clear current_kprobe and enable preempt in kprobe

2018-06-07 Thread Naveen N. Rao
Yu Cc: Ralf Baechle Cc: James Hogan Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Yoshinori Sato Cc: Rich Felker Cc: "David S. Miller" Cc: "Naveen N. Rao" Cc: Josef Bacik Cc: Alexei Starovoitov Cc

Re: [RFC PATCH -tip v5 18/27] powerpc/kprobes: Don't call the ->break_handler() in arm kprobes code

2018-06-07 Thread Naveen N. Rao
Masami Hiramatsu wrote: On Thu, 07 Jun 2018 17:07:00 +0530 "Naveen N. Rao" wrote: Masami Hiramatsu wrote: > Don't call the ->break_handler() from the arm kprobes code, ^^^ powerpc > because it was only used by jprobes whic

Re: [PATCH v06 1/9] hotplug/cpu: Conditionally acquire/release DRC index

2018-07-11 Thread Naveen N. Rao
Michael Bringmann wrote: powerpc/cpu: Modify dlpar_cpu_add and dlpar_cpu_remove to allow the skipping of DRC index acquire or release operations during the CPU add or remove operations. This is intended to support subsequent changes to provide a 'CPU readd' operation. Signed-off-by: Michael Bri

Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-03 Thread Naveen N. Rao
Gautham R Shenoy wrote: Hi Naveen, On Thu, Dec 05, 2019 at 10:23:58PM +0530, Naveen N. Rao wrote: >diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c >index 80a676d..42ade55 100644 >--- a/arch/powerpc/kernel/sysfs.c >+++ b/arch/powerpc/kernel/sysfs.c >@@ -

Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-04 Thread Naveen N. Rao
Gautham R Shenoy wrote: With repect to lparstat, the read interval is user-specified and just gets passed onto sleep(). Ok. So I guess currently you will be sending smp_call_function every time you read a PURR and SPURR. That number will now increase by 2 times when we read idle_purr and idle

Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-05 Thread Naveen N. Rao
Christophe Leroy wrote: Le 27/11/2019 à 13:01, Gautham R. Shenoy a écrit : From: "Gautham R. Shenoy" On Pseries LPARs, to calculate utilization, we need to know the [S]PURR ticks when the CPUs were busy or idle. The total PURR and SPURR ticks are already exposed via the per-cpu sysfs files

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-18 Thread Naveen N. Rao
Masami, Christophe, Apologies for pitching in late here... Masami Hiramatsu wrote: On Tue, 18 Feb 2020 12:04:41 +0100 Christophe Leroy wrote: >> Nevertheless, if one symbol has been forgotten in the blacklist, I think >> it is a problem if it generate Oopses. > > There is a long history also

Re: [PATCH 1/2] powerpc/kprobes: Remove redundant code

2020-02-18 Thread Naveen N. Rao
Christophe Leroy wrote: At the time being we have something like if (something) { p = get(); if (p) { if (something_wrong) goto out; ... return;

Re: [PATCH 2/2] powerpc/kprobes: Reduce depth of a test

2020-02-18 Thread Naveen N. Rao
Christophe Leroy wrote: if (a) { if (b) do_something(); } Is equivalent to if (a & b) do_something(); Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/kprobes.c | 58 +-- 1

Re: [PATCH v2] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-18 Thread Naveen N. Rao
ap happened with MSR_IR cleared, return 0 immediately. Reported-by: Larry Finger Fixes: 6cc89bad60a6 ("powerpc/kprobes: Invoke handlers directly") Cc: sta...@vger.kernel.org Cc: Naveen N. Rao Cc: Masami Hiramatsu Signed-off-by: Christophe Leroy --- v2: bailing out instead of converting re

[PATCH] powerpc: Include .BTF section

2020-02-20 Thread Naveen N. Rao
Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld: ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF' Include .BTF section in vmlinux explicitly to fix the same. Signed-off-by: Naveen N. Rao --- arch/powerpc/kerne

Re: [PATCH] powerpc: Include .BTF section

2020-02-23 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld: ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF' Include .BTF section in vmlinux explicitly to fix th

Re: [PATCH v2 4/5] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-25 Thread Naveen N. Rao
Gautham R Shenoy wrote: On Fri, Feb 21, 2020 at 10:50:12AM -0600, Nathan Lynch wrote: "Gautham R. Shenoy" writes: > diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c > index 80a676d..5b4b450 100644 > --- a/arch/powerpc/kernel/sysfs.c > +++ b/arch/powerpc/kernel/sysfs.c > @@

[PATCH] PPC Hardware Breakpoints: Fix incorrect pointer access

2012-07-06 Thread Naveen N. Rao
If arch_validate_hwbkpt_settings() fails, bp->ctx won't be valid and the kernel panics. Add a check to fix this. Reported-by: Edjunior Barbosa Machado Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/hw_breakpoint.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH RESEND] PPC Hardware Breakpoints: Fix incorrect pointer access

2012-07-18 Thread Naveen N. Rao
If arch_validate_hwbkpt_settings() fails, bp->ctx won't be valid and the kernel panics. Add a check to fix this. Reported-by: Edjunior Barbosa Machado Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/hw_breakpoint.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

Re: [RFC PATCH] bpf: handle 32-bit zext during constant blinding

2019-08-21 Thread Naveen N. Rao
Naveen N. Rao wrote: Since BPF constant blinding is performed after the verifier pass, there are certain ALU32 instructions inserted which don't have a corresponding zext instruction inserted after. This is causing a kernel oops on powerpc and can be reproduced by running 'test_cgro

Re: Regression fix for bpf in v5.3 (was Re: [RFC PATCH] bpf: handle 32-bit zext during constant blinding)

2019-08-21 Thread Naveen N. Rao
Jiong Wang wrote: Michael Ellerman writes: "Naveen N. Rao" writes: Since BPF constant blinding is performed after the verifier pass, there are certain ALU32 instructions inserted which don't have a corresponding zext instruction inserted after. This is causing a kernel oops

[PATCH] bpf: handle 32-bit zext during constant blinding

2019-08-21 Thread Naveen N. Rao
_harden=2. Fix this by emitting BPF_ZEXT during constant blinding if prog->aux->verifier_zext is set. Fixes: a4b1d3c1ddf6cb ("bpf: verifier: insert zero extension according to analysis result") Reported-by: Michael Ellerman Signed-off-by: Naveen N. Rao --- Changes since RFC:

Re: [PATCH] powerpc/64: Fix stacktrace on BE when function_graph is enabled

2019-08-24 Thread Naveen N. Rao
It will be a nop for ABIv2, which would be nice, but not really a major deal. In either case: Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH] bpf: handle 32-bit zext during constant blinding

2019-08-26 Thread Naveen N. Rao
Jiong Wang wrote: Naveen N. Rao writes: Since BPF constant blinding is performed after the verifier pass, the ALU32 instructions inserted for doubleword immediate loads don't have a corresponding zext instruction. This is causing a kernel oops on powerpc and can be reproduced by ru

[PATCH] perf arch powerpc: Sync powerpc syscall.tbl

2019-08-27 Thread Naveen N. Rao
cccd0 ("y2038: rename old time and utime syscalls") commit 00bf25d693e7 ("y2038: use time32 syscall names on 32-bit") commit 8dabe7245bbc ("y2038: syscalls: rename y2038 compat syscalls") commit 0d6040d46817 ("arch: add split IPC system calls where needed"

Re: [PATCH 1/2] ftrace: Fix NULL pointer dereference in t_probe_next()

2019-09-04 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 4 Jul 2019 20:04:41 +0530 "Naveen N. Rao" wrote: kernel/trace/ftrace.c | 4 1 file changed, 4 insertions(+) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 7b037295a1f1..0791eafb693d 100644 --- a/kernel/trace/ftrace.c +++ b/ke

Re: [PATCH v3 2/3] Powerpc64/Watchpoint: Don't ignore extraneous exceptions

2019-09-04 Thread Naveen N. Rao
Ravi Bangoria wrote: On Powerpc64, watchpoint match range is double-word granular. On a watchpoint hit, DAR is set to the first byte of overlap between actual access and watched range. And thus it's quite possible that DAR does not point inside user specified range. Ex, say user creates a watchpo

Re: [PATCH] powerpc/64: Fix stacktrace on BE when function_graph is enabled

2019-09-05 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Michael Ellerman wrote: Currently if we oops or warn while function_graph is active the stack trace looks like: .trace_graph_return+0xac/0x100 .ftrace_return_to_handler+0x98/0x140 .return_to_handler+0x20/0x40 .return_to_handle

[PATCH 0/3] powerpc/ftrace: Enable HAVE_FUNCTION_GRAPH_RET_ADDR_PTR

2019-09-05 Thread Naveen N. Rao
Enable HAVE_FUNCTION_GRAPH_RET_ADDR_PTR for more robust stack unwinding when function graph tracer is in use. Convert powerpc show_stack() to use ftrace_graph_ret_addr() for better stack unwinding. - Naveen Naveen N. Rao (3): ftrace: Look up the address of return_to_handler() using helpers

[PATCH 1/3] ftrace: Look up the address of return_to_handler() using helpers

2019-09-05 Thread Naveen N. Rao
This ensures that we use the right address on architectures that use function descriptors. Signed-off-by: Naveen N. Rao --- kernel/trace/fgraph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 8dfd5021b933

[PATCH 2/3] powerpc/ftrace: Enable HAVE_FUNCTION_GRAPH_RET_ADDR_PTR

2019-09-05 Thread Naveen N. Rao
This associates entries in the ftrace_ret_stack with corresponding stack frames, enabling more robust stack unwinding. Also update the only user of ftrace_graph_ret_addr() to pass the stack pointer. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/asm-prototypes.h | 3 ++- arch

[PATCH 3/3] powerpc: Use ftrace_graph_ret_addr() when unwinding

2019-09-05 Thread Naveen N. Rao
] return_to_handler+0x0/0x40 (vfs_read+0xb8/0x1b0) [c000d1e33dd0] [c006ab58] return_to_handler+0x0/0x40 (ksys_read+0x7c/0x140) [c000d1e33e20] [c006ab58] return_to_handler+0x0/0x40 (system_call+0x5c/0x68) Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/process.c

Re: [PATCH 2/2] powerpc/watchpoint: Disable watchpoint hit by larx/stcx instructions

2019-09-10 Thread Naveen N. Rao
telimited("Breakpoint hit on instruction that can't be emulated. " "Breakpoint at 0x%lx will be disabled.\n", addr); Otherwise: Acked-by: Naveen N. Rao - Naveen + goto disable; + } /* Do not emulate user-space instructions, instead single-step them */

Re: [PATCH 0/2] pseries/hotplug: Change the default behaviour of cede_offline

2019-09-18 Thread Naveen N. Rao
Michael Ellerman wrote: "Gautham R. Shenoy" writes: From: "Gautham R. Shenoy" Currently on Pseries Linux Guests, the offlined CPU can be put to one of the following two states: - Long term processor cede (also called extended cede) - Returned to the Hypervisor via RTAS "stop-self" call.

Re: [PATCH 0/2] pseries/hotplug: Change the default behaviour of cede_offline

2019-09-18 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Michael Ellerman wrote: "Gautham R. Shenoy" writes: From: "Gautham R. Shenoy" Currently on Pseries Linux Guests, the offlined CPU can be put to one of the following two states: - Long term processor c

[PATCH] powerpc: Fix build issue with LD_DEAD_CODE_DATA_ELIMINATION and FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY

2023-09-13 Thread Naveen N Rao
ction-entry") Reported-by: Michael Ellerman Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 54b9387c3691..3aaadfd2c8eb 100644 --- a/arch/powerpc/Kconfig +++ b/arch/power

Re: [RFC - is this a bug?] powerpc/lib/sstep: Asking for some light on this, please. :)

2023-11-20 Thread Naveen N Rao
On Fri, Nov 17, 2023 at 12:36:01PM -0600, Gustavo A. R. Silva wrote: > Hi all, > > I'm trying to fix the following -Wstringop-overflow warnings, and I'd like > to get your feedback on this, please: > > In function 'do_byte_reverse', > inlined from 'do_vec_store' at > /home/gus/linux/arch/pow

Re: [RFC - is this a bug?] powerpc/lib/sstep: Asking for some light on this, please. :)

2023-11-20 Thread Naveen N Rao
On Mon, Nov 20, 2023 at 08:33:45AM -0600, Gustavo A. R. Silva wrote: > > > On 11/20/23 08:25, Naveen N Rao wrote: > > On Fri, Nov 17, 2023 at 12:36:01PM -0600, Gustavo A. R. Silva wrote: > > > Hi all, > > > > > > I'm trying to fix the follo

Re: [PATCH] powerpc/lib: Avoid array bounds warnings in vec ops

2023-11-21 Thread Naveen N Rao
On Tue, Nov 21, 2023 at 10:54:36AM +1100, Michael Ellerman wrote: > Building with GCC 13 (which has -array-bounds enabled) there are several Thanks, gcc13 indeed helps reproduce the warnings. > warnings in sstep.c along the lines of: > > In function ‘do_byte_reverse’, > inlined from ‘do_

Re: [PATCH] perf test: Skip perf bench breakpoint run if no breakpoints available

2023-08-23 Thread Naveen N Rao
bench/breakpoint.c | 24 +--- > 1 file changed, 21 insertions(+), 3 deletions(-) Thanks for fixing this to not report an error. A minor nit below, but otherwise: Acked-by: Naveen N Rao > > diff --git a/tools/perf/bench/breakpoint.c b/tools/perf/bench/breakpoint.c

Re: [PATCH] powerpc/bpf: populate extable entries only during the last pass

2023-04-24 Thread Naveen N. Rao
Hari Bathini wrote: Hello Christophe, Thanks for the review. On 07/04/23 11:31 am, Christophe Leroy wrote: Le 06/04/2023 à 09:35, Hari Bathini a écrit : Since commit 85e031154c7c ("powerpc/bpf: Perform complete extra passes to update addresses"), two additional passes are performed to avoid

Re: [PATCH v2] powerpc/bpf: populate extable entries only during the last pass

2023-04-25 Thread Naveen N. Rao
a...@vger.kernel.org Signed-off-by: Hari Bathini --- arch/powerpc/net/bpf_jit_comp.c | 2 ++ 1 file changed, 2 insertions(+) Reviewed-by: Naveen N. Rao - Naveen diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index e93aefcfb83f..37043dfc1add 100644 --

Re: [PATCH 0/4] powerpc/64: ELFv2 conversion

2023-05-05 Thread Naveen N. Rao
Michael Ellerman wrote: Christophe Leroy writes: Le 05/05/2023 à 09:18, Nicholas Piggin a écrit : This series has the steps to remove ELFv1 from the kernel build. Patch 1 is a build fix, 2 defaults everything to ELFv2, 3 is really a separate issue that concerns userspace. 4 removes v1 support.

Re: [PATCH] powerpc/64: Use -mprofile-kernel for big endian ELFv2 kernels

2023-05-09 Thread Naveen N. Rao
Nicholas Piggin wrote: -mprofile-kernel is an optimised calling convention for mcount that Linux has only implemented with the ELFv2 ABI, so it was disabled for big endian kernels. However it does work with ELFv2 big endian, so let's allow that if the compiler supports it. Cc: Naveen N

[RFC PATCH] powerpc/ftrace: Refactoring and support for -fpatchable-function-entry

2023-05-19 Thread Naveen N Rao
-1-npig...@gmail.com/ - https://lore.kernel.org/all/20230506011814.8766-1-npig...@gmail.com/ This builds for me and passes a quick test, posting this as an early RFC. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 10 + arch/powerpc/Makefile |

Re: [RFC PATCH] powerpc/ftrace: Refactoring and support for -fpatchable-function-entry

2023-05-20 Thread Naveen N Rao
Christophe Leroy wrote: Le 20/05/2023 à 12:34, Christophe Leroy a écrit : Le 19/05/2023 à 21:26, Naveen N Rao a écrit : [Vous ne recevez pas souvent de courriers de nav...@kernel.org. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] Refactor ftrace

Re: [RFC PATCH] powerpc/ftrace: Refactoring and support for -fpatchable-function-entry

2023-05-20 Thread Naveen N Rao
Christophe Leroy wrote: Le 19/05/2023 à 21:26, Naveen N Rao a écrit : [Vous ne recevez pas souvent de courriers de nav...@kernel.org. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] Refactor ftrace code and move to using ftrace_replace_code() to help

Re: [RFC PATCH] powerpc/ftrace: Refactoring and support for -fpatchable-function-entry

2023-05-23 Thread Naveen N Rao
Christophe Leroy wrote: That's better, but still more time than original implementation: +20% to activate function tracer (was +40% with your RFC) +21% to activate nop tracer (was +24% with your RFC) perf record (without strict kernel rwx) : 17.75% echo [kernel.kallsyms] [k] ftrac

[PATCH] powerpc: Fail build if using recordmcount with binutils v2.37

2023-05-29 Thread Naveen N Rao
recordmcount. Fail the build and print a warning if binutils v2.37 is detected and if we are using recordmcount. Cc: sta...@vger.kernel.org Suggested-by: Joel Stanley Signed-off-by: Naveen N Rao --- arch/powerpc/Makefile | 8 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/Makefile b

[PATCH v2] powerpc: Fail build if using recordmcount with binutils v2.37

2023-05-29 Thread Naveen N Rao
recordmcount. Fail the build and print a warning if binutils v2.37 is detected and if we are using recordmcount. Cc: sta...@vger.kernel.org Suggested-by: Joel Stanley Signed-off-by: Naveen N Rao --- v2: Check directly against $CONFIG_LD_VERSION arch/powerpc/Makefile | 8 1 file changed, 8

Re: [PATCH] powerpc: Fail build if using recordmcount with binutils v2.37

2023-05-29 Thread Naveen N Rao
Michael Ellerman wrote: Naveen N Rao writes: binutils v2.37 drops unused section symbols, which prevents recordmcount from capturing mcount locations in sections that have no non-weak symbols. This results in a build failure with a message such as: Cannot find symbol for section 12

[PATCH] powerpc/tools: Pass -mabi=elfv2 to gcc-check-mprofile-kernel.sh

2023-05-30 Thread Naveen N Rao
Toolchains don't always default to the ELFv2 ABI. This is true with at least the kernel.org toolchains. As such, pass -mabi=elfv2 explicitly to ensure that we are testing against the correct compiler output. Signed-off-by: Naveen N Rao --- The script works fine without this change, so th

[RFC PATCH 00/15] powerpc/ftrace: refactoring and support for -fpatchable-function-entry

2023-06-07 Thread Naveen N Rao
This is a follow-on RFC to the patch I previously posted here: http://lore.kernel.org/20230519192600.2593506-1-nav...@kernel.org Since then, I have split up the patches, picked up a few more changes and given this more testing. More details in the individual patches. - Naveen Naveen N Rao

[RFC PATCH 11/15] powerpc/ftrace: Simplify ftrace_make_call()

2023-06-07 Thread Naveen N Rao
patching it. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 187 + 1 file changed, 31 insertions(+), 156 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index 67773cd14da71a..8d5d91b8ae85a0 100644

[RFC PATCH 12/15] powerpc/ftrace: Simplify ftrace_modify_call()

2023-06-07 Thread Naveen N Rao
instruction at the ftrace location before patching it with the updated branch destination. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 161 - 1 file changed, 21 insertions(+), 140 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b

[RFC PATCH 13/15] powerpc/ftrace: Replace use of ftrace_call_replace() with ftrace_create_branch_inst()

2023-06-07 Thread Naveen N Rao
ftrace_create_branch_inst() is clearer about its intent than ftrace_call_replace(). Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel

[RFC PATCH 14/15] powerpc/ftrace: Implement ftrace_replace_code()

2023-06-07 Thread Naveen N Rao
should no longer be called. This lays the groundwork to enable better control in patching ftrace locations, including the ability to nop-out preceding profiling instructions when ftrace is disabled. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 173

[RFC PATCH 15/15] powerpc/ftrace: Add support for -fpatchable-function-entry

2023-06-07 Thread Naveen N Rao
reasons apply for ppc32 so we only patch in a 'mflr r0'. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 14 +++--- arch/powerpc/Makefile | 5 arch/powerpc/include/asm/ftrace.h | 6 +++-- arch/power

[RFC PATCH 02/15] powerpc64/ftrace: Move ELFv1 and -pg support code into a separate file

2023-06-07 Thread Naveen N Rao
_pg.c. ftrace.c can then be refactored and enhanced with a focus on ppc32 and ppc64 ELFv2. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/Makefile| 13 +- arch/powerpc/kernel/trace/ftrace.c| 10 - arch/powerpc/kernel/trace/ftrace_pg.c | 846 ++ 3

[RFC PATCH 03/15] powerpc/ftrace: Simplify function_graph support in ftrace.c

2023-06-07 Thread Naveen N Rao
Since we now support DYNAMIC_FTRACE_WITH_ARGS across ppc32 and ppc64 ELFv2, we can simplify function_graph tracer support code in ftrace.c Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 64 -- 1 file changed, 7 insertions(+), 57 deletions

[RFC PATCH 04/15] powerpc/ftrace: Use FTRACE_REGS_ADDR to identify the correct ftrace trampoline

2023-06-07 Thread Naveen N Rao
Instead of keying off DYNAMIC_FTRACE_WITH_REGS, use FTRACE_REGS_ADDR to identify the proper ftrace trampoline address to use. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/trace

[RFC PATCH 05/15] powerpc/ftrace: Extend ftrace support for large kernels to ppc32

2023-06-07 Thread Naveen N Rao
r the stub from 64 bytes to 32 bytes since the different stub variants are all less than 8 instructions. To reduce use of #ifdef, a stub implementation is provided for kernel_toc_address() and -SZ_2G is cast to 'long long' to prevent errors on ppc32. Signed-off-by: Naveen N Rao ---

[RFC PATCH 06/15] powerpc/ftrace: Consolidate ftrace support into fewer files

2023-06-07 Thread Naveen N Rao
: Naveen N Rao --- arch/powerpc/kernel/trace/Makefile| 17 +++-- arch/powerpc/kernel/trace/ftrace_64_pg.S | 67 --- .../trace/{ftrace_pg.c => ftrace_64_pg.c} | 0 .../{ftrace_low.S => ftrace_64_pg_entry.S}| 58 +++- .../{ftrace_mpro

[RFC PATCH 07/15] powerpc/ftrace: Refactor ftrace_modify_code()

2023-06-07 Thread Naveen N Rao
Split up ftrace_modify_code() into a few helpers for future use. Also update error messages accordingly. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 51 +- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/kernel

[RFC PATCH 08/15] powerpc/ftrace: Stop re-purposing linker generated long branches for ftrace

2023-06-07 Thread Naveen N Rao
. Stop re-purposing the linker-generated long branches for ftrace to simplify the code. If there are good reasons to support ftrace on kernels beyond 64MB, we can consider adding support by using -fpatchable-function-entry. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftra

[RFC PATCH 09/15] powerpc/ftrace: Add separate ftrace_init_nop() with additional validation

2023-06-07 Thread Naveen N Rao
. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h | 6 +++ arch/powerpc/kernel/trace/ftrace.c | 71 ++ 2 files changed, 77 insertions(+) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 1a5d365523e160

[RFC PATCH 10/15] powerpc/ftrace: Simplify ftrace_make_nop()

2023-06-07 Thread Naveen N Rao
ftrace location before nop-ing it out. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 220 + 1 file changed, 32 insertions(+), 188 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index c0d185742c23ca

[RFC PATCH 01/15] powerpc/module: Remove unused .ftrace.tramp section

2023-06-07 Thread Naveen N Rao
.ftrace.tramp section is not used for any purpose. This code was added all the way back in the original commit introducing support for dynamic ftrace on ppc64 modules. Remove it. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/module.h | 4 1 file changed, 4 deletions(-) diff

Re: [RFC PATCH] powerpc/ftrace: Refactoring and support for -fpatchable-function-entry

2023-06-07 Thread Naveen N Rao
Christophe Leroy wrote: Le 23/05/2023 à 11:31, Naveen N Rao a écrit : Christophe Leroy wrote: Ok, I simplified this further, and this is as close to the previous fast path as we can get (applies atop the original RFC). The only difference left is the ftrace_rec iterator. That'

[PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang

2023-06-08 Thread Naveen N Rao
, similar to the pre -mprofile-kernel ABI on ppc64. This is not supported. Disable ftrace on ppc32 if using clang for now. This can be re-enabled later if clang picks up support for -fpatchable-function-entry on ppc32. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1

[PATCH] powerpc/trace: Add support for HAVE_FUNCTION_ARG_ACCESS_API

2023-06-14 Thread Naveen N Rao
When creating a kprobe on function entry through tracefs, enable arguments to be recorded to be specified using $argN syntax. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/ptrace.h | 17 + 2 files changed, 18 insertions

[PATCH] powerpc/ftrace: Fix dropping weak symbols with older toolchains

2023-06-15 Thread Naveen N Rao
Fixes: 7af82ff90a2b06 ("powerpc/ftrace: Ignore weak functions") Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 91c0

[RFC PATCH] powerpc/ftrace: Create a dummy stackframe to fix stack unwind

2023-06-15 Thread Naveen N Rao
lts in two additional stores in the ftrace entry code, but produces reliable backtraces. Note that this change now aligns with other architectures (arm64, s390, x86). Signed-off-by: Naveen N Rao --- This applies atop the below RFC patchset: http://lore.kernel.org/cover.1686151854.git.

Re: ppc64le vmlinuz is huge when building with BTF

2023-06-16 Thread Naveen N Rao
[Cc linuxppc-dev] Dominique Martinet wrote: Alan Maguire wrote on Thu, Jun 15, 2023 at 03:31:49PM +0100: However the problem I suspect is this: 51 .debug_info 0a488b55 026f8d20 2**0 CONTENTS, READONLY, DEBUGGING [...] The debug info

Re: ppc64le vmlinuz is huge when building with BTF

2023-06-16 Thread Naveen N Rao
Dominique Martinet wrote: Naveen N Rao wrote on Fri, Jun 16, 2023 at 04:28:53PM +0530: > We're not stripping anything in vmlinuz for other archs -- the linker > script already should be including only the bare minimum to decompress > itself (+compressed useful bits), so I guess

[PATCH 00/17] powerpc/ftrace: refactor and add support for -fpatchable-function-entry

2023-06-19 Thread Naveen N Rao
good to me. Christophe mentioned that this results in a slowdown with ftrace [de-]activation on ppc32, but that isn't performance critical and we can address that separately. (*) http://lore.kernel.org/cover.1686151854.git.nav...@kernel.org - Naveen Naveen N Rao (17): powerpc/ftrace

[PATCH 02/17] powerpc/module: Remove unused .ftrace.tramp section

2023-06-19 Thread Naveen N Rao
.ftrace.tramp section is not used for any purpose. This code was added all the way back in the original commit introducing support for dynamic ftrace on ppc64 modules. Remove it. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/module.h | 4 1 file changed, 4 deletions(-) diff

[PATCH 03/17] powerpc64/ftrace: Move ELFv1 and -pg support code into a separate file

2023-06-19 Thread Naveen N Rao
_pg.c. ftrace.c can then be refactored and enhanced with a focus on ppc32 and ppc64 ELFv2. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/Makefile| 13 +- arch/powerpc/kernel/trace/ftrace.c| 10 - arch/powerpc/kernel/trace/ftrace_pg.c | 846 ++ 3

[PATCH 01/17] powerpc/ftrace: Fix dropping weak symbols with older toolchains

2023-06-19 Thread Naveen N Rao
Fixes: 7af82ff90a2b06 ("powerpc/ftrace: Ignore weak functions") Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 91c0

[PATCH 14/17] powerpc/ftrace: Replace use of ftrace_call_replace() with ftrace_create_branch_inst()

2023-06-19 Thread Naveen N Rao
ftrace_create_branch_inst() is clearer about its intent than ftrace_call_replace(). Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel

[PATCH 15/17] powerpc/ftrace: Implement ftrace_replace_code()

2023-06-19 Thread Naveen N Rao
should no longer be called. This lays the groundwork to enable better control in patching ftrace locations, including the ability to nop-out preceding profiling instructions when ftrace is disabled. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 173

[PATCH 16/17] powerpc/ftrace: Add support for -fpatchable-function-entry

2023-06-19 Thread Naveen N Rao
reasons apply for ppc32 so we only patch in a 'mflr r0'. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig | 14 +++--- arch/powerpc/Makefile | 5 arch/powerpc/include/asm/ftrace.h | 6 +++-- arch/power

[PATCH 17/17] powerpc/ftrace: Create a dummy stackframe to fix stack unwind

2023-06-19 Thread Naveen N Rao
lts in two additional stores in the ftrace entry code, but produces reliable backtraces. Note that this change now aligns with other architectures (arm64, s390, x86). Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 6 -- arch/powerpc/kernel/trace/ftrace_entry.S |

[PATCH 05/17] powerpc/ftrace: Use FTRACE_REGS_ADDR to identify the correct ftrace trampoline

2023-06-19 Thread Naveen N Rao
Instead of keying off DYNAMIC_FTRACE_WITH_REGS, use FTRACE_REGS_ADDR to identify the proper ftrace trampoline address to use. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/trace

[PATCH 06/17] powerpc/ftrace: Extend ftrace support for large kernels to ppc32

2023-06-19 Thread Naveen N Rao
r the stub from 64 bytes to 32 bytes since the different stub variants are all less than 8 instructions. To reduce use of #ifdef, a stub implementation is provided for kernel_toc_address() and -SZ_2G is cast to 'long long' to prevent errors on ppc32. Signed-off-by: Naveen N Rao ---

[PATCH 07/17] powerpc/ftrace: Consolidate ftrace support into fewer files

2023-06-19 Thread Naveen N Rao
: Naveen N Rao --- arch/powerpc/kernel/trace/Makefile| 17 +++-- arch/powerpc/kernel/trace/ftrace_64_pg.S | 67 --- .../trace/{ftrace_pg.c => ftrace_64_pg.c} | 0 .../{ftrace_low.S => ftrace_64_pg_entry.S}| 58 +++- .../{ftrace_mpro

[PATCH 08/17] powerpc/ftrace: Refactor ftrace_modify_code()

2023-06-19 Thread Naveen N Rao
Split up ftrace_modify_code() into a few helpers for future use. Also update error messages accordingly. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 51 +- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/kernel

[PATCH 09/17] powerpc/ftrace: Stop re-purposing linker generated long branches for ftrace

2023-06-19 Thread Naveen N Rao
. Stop re-purposing the linker-generated long branches for ftrace to simplify the code. If there are good reasons to support ftrace on kernels beyond 64MB, we can consider adding support by using -fpatchable-function-entry. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftra

[PATCH 10/17] powerpc/ftrace: Add separate ftrace_init_nop() with additional validation

2023-06-19 Thread Naveen N Rao
. Signed-off-by: Naveen N Rao --- arch/powerpc/include/asm/ftrace.h | 6 +++ arch/powerpc/kernel/trace/ftrace.c | 71 ++ 2 files changed, 77 insertions(+) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 702aaf2efa966c

[PATCH 11/17] powerpc/ftrace: Simplify ftrace_make_nop()

2023-06-19 Thread Naveen N Rao
ftrace location before nop-ing it out. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 220 + 1 file changed, 32 insertions(+), 188 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index 98bd099c428ee0

[PATCH 12/17] powerpc/ftrace: Simplify ftrace_make_call()

2023-06-19 Thread Naveen N Rao
patching it. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 187 + 1 file changed, 31 insertions(+), 156 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index 05153a1038fdff..6ea8b90246a540 100644

[PATCH 13/17] powerpc/ftrace: Simplify ftrace_modify_call()

2023-06-19 Thread Naveen N Rao
instruction at the ftrace location before patching it with the updated branch destination. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 161 - 1 file changed, 21 insertions(+), 140 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b

[PATCH 04/17] powerpc/ftrace: Simplify function_graph support in ftrace.c

2023-06-19 Thread Naveen N Rao
Since we now support DYNAMIC_FTRACE_WITH_ARGS across ppc32 and ppc64 ELFv2, we can simplify function_graph tracer support code in ftrace.c Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 64 -- 1 file changed, 7 insertions(+), 57 deletions

Re: [RFC PATCH v1 1/3] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto"

2023-06-19 Thread Naveen N Rao
nablement, I think it might be better to disable it for now. Acked-by: Naveen N Rao - Naveen

Re: [RFC PATCH v1 2/3] powerpc: Mark all .S files invalid for objtool

2023-06-19 Thread Naveen N Rao
Christophe Leroy wrote: A lot of work is required in .S files in order to get them ready for objtool checks. For the time being, exclude them from the checks. This is done with the script below: #!/bin/sh DIRS=`find arch/powerpc -name "*.S" -exec dirname {} \; | sort | uniq`

Re: [RFC PATCH v1 2/3] powerpc: Mark all .S files invalid for objtool

2023-06-19 Thread Naveen N Rao
Christophe Leroy wrote: Le 20/06/2023 à 08:04, Naveen N Rao a écrit : Christophe Leroy wrote: A lot of work is required in .S files in order to get them ready for objtool checks. For the time being, exclude them from the checks. This is done with the script below: #!/bin/sh DIRS

[PATCH] powerpc/ftrace: Create a dummy stackframe to fix stack unwind

2023-06-20 Thread Naveen N Rao
try code, but produces reliable backtraces. Fixes: 153086644fd1 ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI") Cc: sta...@vger.kernel.org Signed-off-by: Naveen N Rao --- Per Nick's suggestion, I'm posting a minimal fix separately to make this easier to back

Re: [PATCH 07/17] powerpc/ftrace: Consolidate ftrace support into fewer files

2023-06-28 Thread Naveen N Rao
Hi Christophe, Christophe Leroy wrote: Le 19/06/2023 à 11:47, Naveen N Rao a écrit : ftrace_low.S has just the _mcount stub and return_to_handler(). Merge this back into ftrace_mprofile.S and ftrace_64_pg.S to keep all ftrace code together, and to allow those to evolve independently

Re: [PATCH 16/17] powerpc/ftrace: Add support for -fpatchable-function-entry

2023-06-28 Thread Naveen N Rao
Christophe Leroy wrote: Le 19/06/2023 à 11:47, Naveen N Rao a écrit : GCC v13.1 updated support for -fpatchable-function-entry on ppc64le to emit nops after the local entry point, rather than before it. This allows us to use this in the kernel for ftrace purposes. A new script is added under

Re: [PATCH 17/17] powerpc/ftrace: Create a dummy stackframe to fix stack unwind

2023-06-28 Thread Naveen N Rao
Christophe Leroy wrote: Le 19/06/2023 à 11:47, Naveen N Rao a écrit : With ppc64 -mprofile-kernel and ppc32 -pg, profiling instructions to call into ftrace are emitted right at function entry. The instruction sequence used is minimal to reduce overhead. Crucially, a stackframe is not created

Re: [PATCH 01/16] powerpc: Replace unreachable() with it's builtin variant in WARN_ON()

2022-08-18 Thread Naveen N. Rao
Christophe Leroy wrote: Le 08/08/2022 à 13:48, Sathvika Vasireddy a écrit : objtool is throwing *unannotated intra-function call* warnings with a few instructions that are marked unreachable. Replace unreachable() with __builtin_unreachable() to fix these warnings, as the codegen remains same

Re: [PATCH 01/16] powerpc: Replace unreachable() with it's builtin variant in WARN_ON()

2022-08-18 Thread Naveen N. Rao
Christophe Leroy wrote: Le 18/08/2022 à 12:46, Naveen N. Rao a écrit : Christophe Leroy wrote: Le 08/08/2022 à 13:48, Sathvika Vasireddy a écrit : objtool is throwing *unannotated intra-function call* warnings with a few instructions that are marked unreachable. Replace unreachable() with

<    1   2   3   4   5   6   7   8   9   10   >