Re: [PATCH v1 2/4] powerpc/ftrace: Refactor ftrace_{regs_}caller

2022-03-03 Thread Naveen N. Rao
LOBAL(ftrace_regs_caller) beq ftrace_no_trace #endif The ability to disable ftrace in certain code paths through paca_struct->ftrace_enabled will also be relevant on ppc32 - it will be nice if it can be introduced there. For this series though: Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH v1 2/4] powerpc/ftrace: Refactor ftrace_{regs_}caller

2022-03-09 Thread Naveen N. Rao
Christophe Leroy wrote: Le 03/03/2022 à 17:59, Naveen N. Rao a écrit : Christophe Leroy wrote: The ability to disable ftrace in certain code paths through paca_struct->ftrace_enabled will also be relevant on ppc32 - it will be nice if it can be introduced there. Ah ? I understood f

Re: [RFC PATCH 3/3] objtool/mcount: Add powerpc specific functions

2022-03-20 Thread Naveen N. Rao
Peter Zijlstra wrote: On Fri, Mar 18, 2022 at 04:21:40PM +0530, Sathvika Vasireddy wrote: This patch adds powerpc specific functions required for 'objtool mcount' to work, and enables mcount for ppc. I would love to see more objtool enablement for Power :-) diff --git a/tools/objtool/arch/p

Re: [RFC PATCH 2/3] objtool: Enable and implement 'mcount' subcommand

2022-03-21 Thread Naveen N. Rao
Christophe Leroy wrote: Le 18/03/2022 à 11:51, Sathvika Vasireddy a écrit : This patch adds 'mcount' as a subcommand to objtool, and enables the same for x86. objtool is built if CONFIG_FTRACE_MCOUNT_USE_OBJTOOL is selected. Additionally, architectures can select HAVE_NOP_MCOUNT if they choose

Re: [RFC PATCH 2/3] objtool: Enable and implement 'mcount' subcommand

2022-03-21 Thread Naveen N. Rao
Christophe Leroy wrote: Le 21/03/2022 à 09:19, Naveen N. Rao a écrit : Christophe Leroy wrote: We don't enable ftrace for vdso, so I suspect objtool run above will be a no-op. This needs to be confirmed, of course. I just checked without the series: recordmcount isn't run fo

[PATCH 1/2] powerpc: Reject probes on instructions that can't be single stepped

2022-03-23 Thread Naveen N. Rao
t allow probing interrupt vectors. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/probes.h | 55 +++ arch/powerpc/kernel/kprobes.c | 4 +-- arch/powerpc/kernel/uprobes.c | 5 +++ arch/powerpc/xmon/xmon.c | 11 +++ 4 files changed, 67 i

[PATCH 0/2] powerpc: Remove system call emulation

2022-03-23 Thread Naveen N. Rao
rpc64. - Naveen Naveen N. Rao (1): powerpc: Reject probes on instructions that can't be single stepped Nicholas Piggin (1): powerpc/64: remove system call instruction emulation arch/powerpc/include/asm/probes.h | 55 ++ arch/powerpc/kernel/interrupt

[PATCH 2/2] powerpc/64: remove system call instruction emulation

2022-03-23 Thread Naveen N. Rao
omplication, but it is a big complexity for unclear real benefit. This patch removes system call emulation and disables stepping system calls (because they don't work with trace interrupts, as commented). Signed-off-by: Nicholas Piggin [also get rid of '#ifdef CONFIG_PPC64'] Si

[PATCH] powerpc/ftrace: Remove ftrace init tramp once kernel init is complete

2022-03-23 Thread Naveen N. Rao
Stop using the ftrace trampoline for init section once kernel init is complete. Fixes: 67361cf8071286 ("powerpc/ftrace: Handle large kernel configs") Cc: sta...@vger.kernel.org # v4.20+ Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/ftrace.h | 2 ++ arch/powerpc/ke

Re: [PATCH 1/2] powerpc: Reject probes on instructions that can't be single stepped

2022-03-28 Thread Naveen N. Rao
Michael Ellerman wrote: Murilo Opsfelder Araújo writes: On 3/23/22 08:51, Naveen N. Rao wrote: +static inline bool can_single_step(u32 inst) +{ + switch (inst >> 26) { Can't ppc_inst_primary_opcode() be used instead? I didn't want to add a dependency on inst.h. B

Re: [PATCH 1/2] powerpc: Reject probes on instructions that can't be single stepped

2022-03-30 Thread Naveen N. Rao
Christophe Leroy wrote: Le 28/03/2022 à 19:20, Naveen N. Rao a écrit : Michael Ellerman wrote: Murilo Opsfelder Araújo writes: On 3/23/22 08:51, Naveen N. Rao wrote: +static inline bool can_single_step(u32 inst) +{ +    switch (inst >> 26) { Can't ppc_inst_primary_opcod

[PATCH v2 0/3] powerpc: Remove system call emulation

2022-03-30 Thread Naveen N. Rao
Since v1, the main change is to use helpers to decode primary/extended opcode and the addition of macros for some of the used opcodes. - Naveen Naveen N. Rao (2): powerpc: Sort and de-dup primary opcodes in ppc-opcode.h powerpc: Reject probes on instructions that can't be single st

[PATCH v2 1/3] powerpc: Sort and de-dup primary opcodes in ppc-opcode.h

2022-03-30 Thread Naveen N. Rao
Some of the primary opcodes are duplicated. Remove those, and sort the rest of the primary opcodes to make it easy to read. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/ppc-opcode.h | 69 --- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a

[PATCH v2 2/3] powerpc: Reject probes on instructions that can't be single stepped

2022-03-30 Thread Naveen N. Rao
t allow probing interrupt vectors. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/ppc-opcode.h | 18 ++ arch/powerpc/include/asm/probes.h | 36 +++ arch/powerpc/kernel/kprobes.c | 4 +-- arch/powerpc/kernel/uprobes.c | 5 ar

[PATCH v2 3/3] powerpc/64: remove system call instruction emulation

2022-03-30 Thread Naveen N. Rao
calls. Signed-off-by: Nicholas Piggin [minor commit log edit, and also get rid of '#ifdef CONFIG_PPC64'] Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/interrupt_64.S | 10 --- arch/powerpc/lib/sstep.c | 46 +++--- 2 files changed, 10 insertions(+

Re: [RFC PATCH 3/3] objtool/mcount: Add powerpc specific functions

2022-03-30 Thread Naveen N. Rao
Christophe Leroy wrote: Le 29/03/2022 à 14:01, Michael Ellerman a écrit : Josh Poimboeuf writes: On Sun, Mar 27, 2022 at 09:09:20AM +, Christophe Leroy wrote: What are current works in progress on objtool ? Should I wait Josh's changes before starting looking at all this ? Should I wait

Re: [PATCH v1 06/22] powerpc/ftrace: Inline ftrace_modify_code()

2022-04-17 Thread Naveen N. Rao
Christophe Leroy wrote: Inlining ftrace_modify_code(), it increases a bit the size of ftrace code but brings 5% improvment on ftrace activation. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/power

Re: [PATCH v1 07/22] powerpc/ftrace: Use patch_instruction() return directly

2022-04-17 Thread Naveen N. Rao
Christophe Leroy wrote: Instead of returning -EPERM when patch_instruction() fails, just return what patch_instruction returns. That simplifies ftrace_modify_code(): 0: 94 21 ff c0 stwur1,-64(r1) 4: 93 e1 00 3c stw r31,60(r1) 8: 7c 7f 1b 79

Re: [PATCH v1 08/22] powerpc/ftrace: Make __ftrace_make_{nop/call}() common to PPC32 and PPC64

2022-04-17 Thread Naveen N. Rao
Christophe Leroy wrote: Since c93d4f6ecf4b ("powerpc/ftrace: Add module_trampoline_target() for PPC32"), __ftrace_make_nop() for PPC32 is very similar to the one for PPC64. Same for __ftrace_make_call(). Make them common. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/ftrace.c

Re: [PATCH v1 10/22] powerpc/ftrace: Use CONFIG_FUNCTION_TRACER instead of CONFIG_DYNAMIC_FTRACE

2022-04-18 Thread Naveen N. Rao
Christophe Leroy wrote: Since commit 0c0c52306f47 ("powerpc: Only support DYNAMIC_FTRACE not static"), CONFIG_DYNAMIC_FTRACE is always selected when CONFIG_FUNCTION_TRACER is selected. To avoid confusion and have the reader wonder what's happen when CONFIG_FUNCTION_TRACER is selected and CONFIG_

Re: [PATCH v1 13/22] powerpc/ftrace: Use PPC_RAW_xxx() macros instead of opencoding.

2022-04-18 Thread Naveen N. Rao
Christophe Leroy wrote: PPC_RAW_xxx() macros are self explanatory and less error prone than open coding. Use them in ftrace.c Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc-opcode.h | 3 +++ arch/powerpc/kernel/trace/ftrace.c| 32 +-- 2 files cha

Re: [PATCH v1 16/22] powerpc/ftrace: Minimise number of #ifdefs

2022-04-18 Thread Naveen N. Rao
Christophe Leroy wrote: A lot of #ifdefs can be replaced by IS_ENABLED() Do so. This requires to have kernel_toc_addr() defined at all time and PPC_INST_LD_TOC as well. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/code-patching.h | 2 - arch/powerpc/include/asm/module.h

[PATCH] kexec_file: Drop pr_err in weak implementations of arch_kexec_apply_relocations[_add]

2022-04-25 Thread Naveen N. Rao
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Naveen N. Rao --- kernel/kexec_file.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 8347fc158d2b96..55d144c58b5278 100644 --- a/kernel/kexec_fi

[PATCH 2/2] recordmcount: Handle sections with no non-weak symbols

2022-04-27 Thread Naveen N. Rao
entries due to a previous commit. [1] https://github.com/linuxppc/issues/issues/388 [2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Naveen N. Rao --- scripts/recordmcount.h | 86 +++--- 1 file changed, 73 inserti

[PATCH 0/2] ftrace/recordmcount: Handle object files without section symbols

2022-04-27 Thread Naveen N. Rao
eware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 [3] https://github.com/ClangBuiltLinux/linux/issues/981 Naveen N. Rao (2): ftrace: Drop duplicate mcount locations recordmcount: Handle sections with no non-weak symbols kernel/trace/ftrace.c | 13 +

[PATCH 1/2] ftrace: Drop duplicate mcount locations

2022-04-27 Thread Naveen N. Rao
final vmlinux mcount location table. This will cause ftrace to fail when trying to patch the same location twice. Fix this by dropping duplicate locations during ftrace init. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Naveen N. Rao --- kernel

Re: [PATCH 2/2] recordmcount: Handle sections with no non-weak symbols

2022-04-28 Thread Naveen N. Rao
Steven Rostedt wrote: On Wed, 27 Apr 2022 15:01:22 +0530 "Naveen N. Rao" wrote: If one or both of these weak functions are overridden in future, in the final vmlinux mcount table, references to these will change over to the non-weak variant which has its own mcount location entr

[PATCH v2 0/2] ftrace/recordmcount: Handle object files without section symbols

2022-04-28 Thread Naveen N. Rao
architectures so that they can validate the read mcount locations. - Naveen Naveen N. Rao (2): ftrace: Drop duplicate mcount locations ftrace: recordmcount: Handle sections with no non-weak symbols Makefile | 4 ++ arch/powerpc/Kconfig | 1 + arch/powerpc

[PATCH v2 2/2] ftrace: recordmcount: Handle sections with no non-weak symbols

2022-04-28 Thread Naveen N. Rao
ues/388 [2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Naveen N. Rao --- Makefile | 4 ++ arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/ftrace.h | 8 +-- arch/powerpc/kernel/trace/ftrace.c | 11 k

[PATCH v2 1/2] ftrace: Drop duplicate mcount locations

2022-04-28 Thread Naveen N. Rao
final vmlinux mcount location table. This will cause ftrace to fail when trying to patch the same location twice. Fix this by dropping duplicate locations during ftrace init. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Naveen N. Rao --- kernel

Re: [PATCH 2/2] recordmcount: Handle sections with no non-weak symbols

2022-04-28 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 28 Apr 2022 13:15:22 +0530 "Naveen N. Rao" wrote: Indeed, plain old -pg will be a problem. I'm not sure there is a generic way to address this. I suppose architectures will have to validate the mcount locations, something like this? Perhaps anot

Re: [PATCH 2/2] recordmcount: Handle sections with no non-weak symbols

2022-04-28 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 28 Apr 2022 13:15:22 +0530 "Naveen N. Rao" wrote: Indeed, plain old -pg will be a problem. I'm not sure there is a generic way to address this. I suppose architectures will have to validate the mcount locations, something like this? Perhaps anot

Re: [PATCH v2 2/2] ftrace: recordmcount: Handle sections with no non-weak symbols

2022-04-29 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 28 Apr 2022 22:49:52 +0530 "Naveen N. Rao" wrote: But, with ppc64 elf abi v1 which only supports the old -pg flag, mcount location can differ between the weak and non-weak variants of a function. In such scenarios, one of the two mcount entries will

Re: [PATCH v2 2/2] ftrace: recordmcount: Handle sections with no non-weak symbols

2022-04-29 Thread Naveen N. Rao
Steven Rostedt wrote: On Fri, 29 Apr 2022 23:09:19 +0530 "Naveen N. Rao" wrote: If I'm understanding your suggestion right: - we now create a new section in each object file: __mcount_loc_weak, and capture such relocations using weak symbols there. Yes, but it would be p

[PATCH v2] powerpc/ftrace: Remove ftrace init tramp once kernel init is complete

2022-05-16 Thread Naveen N. Rao
Stop using the ftrace trampoline for init section once kernel init is complete. Fixes: 67361cf8071286 ("powerpc/ftrace: Handle large kernel configs") Cc: sta...@vger.kernel.org # v4.20+ Signed-off-by: Naveen N. Rao --- v2: Update #ifdef to also check for CONFIG_FUNCTION_TRACER to addre

Re: [PATCH] kexec_file: Drop pr_err in weak implementations of arch_kexec_apply_relocations[_add]

2022-05-17 Thread Naveen N. Rao
Naveen N. Rao wrote: kexec_load_purgatory() can fail for many reasons - there is no need to print an error when encountering unsupported relocations. This solves a build issue on powerpc with binutils v2.36 and newer [1]. Since commit d1bcae833b32f1 ("ELF: Don't generate unused secti

Re: [PATCH] powerpc/vdso: Fix incorrect CFI in gettimeofday.S

2022-05-17 Thread Naveen N. Rao
Michael Ellerman wrote: diff --git a/arch/powerpc/kernel/vdso/gettimeofday.S b/arch/powerpc/kernel/vdso/gettimeofday.S index eb9c81e1c218..0aee255e9cbb 100644 --- a/arch/powerpc/kernel/vdso/gettimeofday.S +++ b/arch/powerpc/kernel/vdso/gettimeofday.S @@ -22,12 +22,15 @@ .macro cvdso_call funct

Re: [PATCH] kexec_file: Drop pr_err in weak implementations of arch_kexec_apply_relocations[_add]

2022-05-17 Thread Naveen N. Rao
Baoquan He wrote: On 04/25/22 at 11:11pm, Naveen N. Rao wrote: kexec_load_purgatory() can fail for many reasons - there is no need to print an error when encountering unsupported relocations. This solves a build issue on powerpc with binutils v2.36 and newer [1]. Since commit d1bcae833b32f1

Re: [PATCH] kexec_file: Drop pr_err in weak implementations of arch_kexec_apply_relocations[_add]

2022-05-18 Thread Naveen N. Rao
Baoquan He wrote: On 05/18/22 at 12:26pm, Michael Ellerman wrote: It seems that recordmcount is not really maintained anymore now that x86 uses objtool? There've been several threads about fixing recordmcount, but none of them seem to have lead to a solution. These weak symbol vs recordmcount

Re: [PATCH v3 19/25] powerpc/ftrace: Minimise number of #ifdefs

2022-05-18 Thread Naveen N. Rao
Christophe Leroy wrote: A lot of #ifdefs can be replaced by IS_ENABLED() Do so. This requires to have kernel_toc_addr() defined at all time as well as PPC_INST_LD_TOC and PPC_INST_STD_LR. Signed-off-by: Christophe Leroy --- v2: Moved the setup of pop outside of the big if()/else() in __ftrace

Re: [PATCH] powerpc/vdso: Fix incorrect CFI in gettimeofday.S

2022-05-18 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Michael Ellerman wrote: diff --git a/arch/powerpc/kernel/vdso/gettimeofday.S b/arch/powerpc/kernel/vdso/gettimeofday.S index eb9c81e1c218..0aee255e9cbb 100644 --- a/arch/powerpc/kernel/vdso/gettimeofday.S +++ b/arch/powerpc/k

Re: [PATCH] kexec_file: Drop pr_err in weak implementations of arch_kexec_apply_relocations[_add]

2022-05-18 Thread Naveen N. Rao
purgatory code, so a user really has no way to do anything about the error even if it is printed. Good point. I really hadn't noticed the error code in there when I looked. I still don't think changing the functionality of the code because of a tool issue is the right solution. Ok.

Re: [PATCH v3 19/25] powerpc/ftrace: Minimise number of #ifdefs

2022-05-18 Thread Naveen N. Rao
Christophe Leroy wrote: Le 18/05/2022 à 14:03, Michael Ellerman a écrit : Michael Ellerman writes: "Naveen N. Rao" writes: Christophe Leroy wrote: A lot of #ifdefs can be replaced by IS_ENABLED() Do so. This requires to have kernel_toc_addr() defined at all time

[PATCH] kexec_file: Drop weak attribute from arch_kexec_apply_relocations[_add]

2022-05-18 Thread Naveen N. Rao
er architectures. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Naveen N. Rao --- include/linux/kexec.h | 28 kernel/kexec_file.c | 19 +-- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/include

[PATCH v2] kexec_file: Drop weak attribute from arch_kexec_apply_relocations[_add]

2022-05-19 Thread Naveen N. Rao
the existing pattern of having architectures #define the name of the function they want to override in their headers. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 Signed-off-by: Michael Ellerman Signed-off-by: Naveen N. Rao --- arch/s390/include/asm/kexec.h |

Re: [PATCH] kexec_file: Drop weak attribute from arch_kexec_apply_relocations[_add]

2022-05-19 Thread Naveen N. Rao
Andrew Morton wrote: On Wed, 18 May 2022 23:48:28 +0530 "Naveen N. Rao" wrote: Since commit d1bcae833b32f1 ("ELF: Don't generate unused section symbols") [1], binutils (v2.36+) started dropping section symbols that it thought were unused. This isn't

Re: [PATCH] kexec_file: Drop weak attribute from arch_kexec_apply_relocations[_add]

2022-05-19 Thread Naveen N. Rao
Baoquan He wrote: Hi Eric, On 05/18/22 at 04:59pm, Eric W. Biederman wrote: "Naveen N. Rao" writes: > Since commit d1bcae833b32f1 ("ELF: Don't generate unused section > symbols") [1], binutils (v2.36+) started dropping section symbols that > it thought we

Re: [PATCH] powerpc/vdso: Fix incorrect CFI in gettimeofday.S

2022-05-20 Thread Naveen N. Rao
Alan Modra wrote: On Tue, May 17, 2022 at 10:32:09PM +1000, Michael Ellerman wrote: "Naveen N. Rao" writes: > Michael Ellerman wrote: >> >> diff --git a/arch/powerpc/kernel/vdso/gettimeofday.S b/arch/powerpc/kernel/vdso/gettimeofday.S >> index eb9c81e1c218..0a

Re: linux-next: changed messages in qemu boot

2022-05-20 Thread Naveen N. Rao
Stephen Rothwell wrote: Hi all, Today's linux-next bboot of the powerpc pseries_le_defconfig build produced these different kernel messages (diff from yesterday's tree): - ftrace: allocating 33658 entries in 13 pages - ftrace: allocated 13 pages with 3 groups + ftrace-powerpc: Address of ftrace

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-19 Thread Naveen N. Rao
Daniel Axtens wrote: Sathvika Vasireddy writes: This adds emulation support for the following instruction: * Set Boolean (setb) Signed-off-by: Sathvika Vasireddy --- arch/powerpc/lib/sstep.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch

Re: [PATCH v1 2/2] powerpc: Enable OPTPROBES on PPC32

2021-04-19 Thread Naveen N. Rao
Christophe Leroy wrote: For that, create a 32 bits version of patch_imm64_load_insns() and create a patch_imm_load_insns() which calls patch_imm32_load_insns() on PPC32 and patch_imm64_load_insns() on PPC64. Adapt optprobes_head.S for PPC32. Use PPC_LL/PPC_STL macros instead of raw ld/std, opt o

Re: [PATCH 2/2] powerpc/sstep: Add tests for setb instruction

2021-04-20 Thread Naveen N. Rao
Sathvika Vasireddy wrote: This adds selftests for setb instruction. Signed-off-by: Sathvika Vasireddy --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/lib/test_emulate_step.c | 28 +++ 2 files changed, 29 insertions(+) diff --git a/arch/powerpc/i

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-22 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Daniel Axtens wrote: Sathvika Vasireddy writes: This adds emulation support for the following instruction: * Set Boolean (setb) Signed-off-by: Sathvika Vasireddy ... If you do end up respinning the patch, I think it would

Re: [PATCH 1/4] powerpc/pseries: Fix hcall tracing recursion in pv queued spinlocks

2021-04-27 Thread Naveen N. Rao
| 4 ++-- 4 files changed, 34 insertions(+), 5 deletions(-) Thanks for the fix! Some very minor nits below, but none the less: Reviewed-by: Naveen N. Rao diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index ed6086d57b22..0c92b01a3c3c 100644 --- a/arch/

Re: [PATCH 2/4] powerpc/pseries: Don't trace hcall tracing wrapper

2021-04-27 Thread Naveen N. Rao
esn't make sense to "trace the tracer". Users wanting to know about hcalls are better off enabling the tracepoint here instead. Reported-by: Naveen N. Rao Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lpar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 d

Re: [PATCH 3/4] powerpc/pseries: use notrace hcall variant for H_CEDE idle

2021-04-27 Thread Naveen N. Rao
-- 2 files changed, 5 insertions(+), 11 deletions(-) Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH 4/4] powerpc/pseries: warn if recursing into the hcall tracing code

2021-04-27 Thread Naveen N. Rao
Nicholas Piggin wrote: --- arch/powerpc/platforms/pseries/lpar.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 835e7f661a05..a961a7ebeab3 100644 --- a/arch/powerpc/platforms/pse

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-27 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Michael Ellerman wrote: "Naveen N. Rao" writes: Daniel Axtens wrote: Sathvika Vasireddy writes: This adds emulation support for the following instruction: * Set Boolean (setb) Signed-off-by: Sathvika Vasireddy ..

Re: [PATCH 4/4] powerpc/pseries: warn if recursing into the hcall tracing code

2021-05-04 Thread Naveen N. Rao
Nicholas Piggin wrote: Excerpts from Naveen N. Rao's message of April 27, 2021 11:59 pm: Nicholas Piggin wrote: + * + * H_CONFER from spin locks must be treated separately though and use _notrace + * plpar_hcall variants, see yield_to_preempted(). */ static DEFINE_PER_CPU(unsigned int, hcall

Re: [PATCH 4/4] powerpc/pseries: warn if recursing into the hcall tracing code

2021-05-04 Thread Naveen N. Rao
Nicholas Piggin wrote: Excerpts from Naveen N. Rao's message of May 4, 2021 8:25 pm: Nicholas Piggin wrote: Excerpts from Naveen N. Rao's message of April 27, 2021 11:59 pm: Nicholas Piggin wrote: + * + * H_CONFER from spin locks must be treated separately though and use _notrace + * plpar_hc

Re: [PATCH v2] powerpc/64: BE option to use ELFv2 ABI for big endian kernels

2021-05-04 Thread Naveen N. Rao
Nicholas Piggin wrote: Excerpts from Michal Suchánek's message of May 4, 2021 6:17 am: On Mon, May 03, 2021 at 11:34:25AM +0200, Michal Suchánek wrote: On Mon, May 03, 2021 at 09:11:16AM +0200, Michal Suchánek wrote: > On Mon, May 03, 2021 at 10:58:33AM +1000, Nicholas Piggin wrote: > > Excerpt

Re: [PATCH v2 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-05-17 Thread Naveen N. Rao
Sathvika Vasireddy wrote: This adds emulation support for the following instruction: * Set Boolean (setb) Signed-off-by: Sathvika Vasireddy --- arch/powerpc/lib/sstep.c | 22 ++ 1 file changed, 22 insertions(+) Tested-by: Naveen N. Rao diff --git a/arch/powerpc

Re: [PATCH v2 2/2] powerpc/sstep: Add tests for setb instruction

2021-05-17 Thread Naveen N. Rao
Sathvika Vasireddy wrote: This adds selftests for setb instruction. Signed-off-by: Sathvika Vasireddy --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/lib/test_emulate_step.c | 29 + 2 files changed, 30 insertions(+) Tested-by: Naveen N. Rao

Re: [PATCH v8 27/30] powerpc/kprobes: Don't allow breakpoints on suffixes

2021-05-19 Thread Naveen N. Rao
Christophe Leroy wrote: Le 06/05/2020 à 05:40, Jordan Niethe a écrit : Do not allow inserting breakpoints on the suffix of a prefix instruction in kprobes. Signed-off-by: Jordan Niethe --- v8: Add this back from v3 --- arch/powerpc/kernel/kprobes.c | 13 + 1 file changed, 13 i

[PATCH 0/5] powerpc/kprobes: fixes and cleanups

2021-05-19 Thread Naveen N. Rao
Various fixes and some code refactoring for kprobes on powerpc. The first patch fixes an invalid access if probing the first instruction in a kernel module. The rest are small cleanups. More details in the individual patches. - Naveen Naveen N. Rao (5): powerpc/kprobes: Fix validation of

[PATCH 1/5] powerpc/kprobes: Fix validation of prefixed instructions across page boundary

2021-05-19 Thread Naveen N. Rao
e Leroy Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 01ab2163659e4b..f611d9eb3562d7 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch

[PATCH 2/5] powerpc/kprobes: Roll IS_RFI() macro into IS_RFID()

2021-05-19 Thread Naveen N. Rao
In kprobes and xmon, we should exclude both 32-bit and 64-bit variants of mtmsr and rfi instructions from being stepped. Have IS_RFID() also detect a rfi instruction similar to IS_MTMSRD(). Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/sstep.h | 7 +++ arch/powerpc/kernel

[PATCH 3/5] powerpc/kprobes: Check instruction validity during kprobe registration

2021-05-19 Thread Naveen N. Rao
e can then directly single-step while for other instructions, we can attempt to emulate and fall back to single stepping if that fails. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 62 +-- 1 file changed, 16 insertions(+), 46 deletions(-) diff --

[PATCH 4/5] powerpc/kprobes: Refactor arch_prepare_kprobe()

2021-05-19 Thread Naveen N. Rao
Clean up the function to look sane: - return immediately on error, rather than pointlessly setting the return value - pr_info() instead of printk() - check return value of patch_instruction() - and to top it all of: a reverse christmas tree! Signed-off-by: Naveen N. Rao --- arch/powerpc

[PATCH 5/5] powerpc/kprobes: Warn if instruction patching failed

2021-05-19 Thread Naveen N. Rao
When arming and disarming probes, we currently assume that instruction patching can never fail, and don't have a mechanism to surface errors. Add a warning in case instruction patching ever fails. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 4 ++-- 1 file chang

[PATCH] powerpc/kprobes: Pass ppc_inst as a pointer to emulate_step() on ppc32

2021-05-20 Thread Naveen N. Rao
_step() in the optprobe trampoline. Fix the same. Fixes: eacf4c0202654a ("powerpc: Enable OPTPROBES on PPC32") Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/optprobes.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/optprobes.c b/arch

Re: [PATCH v2 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-20 Thread Naveen N. Rao
| 14 -- 2 files changed, 15 insertions(+), 2 deletions(-) LGTM. For the series: Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH] powerpc/kprobes: Pass ppc_inst as a pointer to emulate_step() on ppc32

2021-05-20 Thread Naveen N. Rao
Christophe Leroy wrote: Le 20/05/2021 à 09:29, Naveen N. Rao a écrit : Trying to use a kprobe on ppc32 results in the below splat: BUG: Unable to handle kernel data access on read at 0x7c0802a6 Faulting instruction address: 0xc002e9f0 Oops: Kernel access of bad area, sig: 11

[RFC PATCH 0/6] powerpc: Stack tracer fixes

2021-05-20 Thread Naveen N. Rao
Naveen N. Rao (6): trace/stack: Move code to save the stack trace into a separate function powerpc/trace: Add support for stack tracer powerpc: Indicate traced function name in show_stack() powerpc/perf: Include traced function in the callchain powerpc/stacktrace: Include ftraced function

[RFC PATCH 1/6] trace/stack: Move code to save the stack trace into a separate function

2021-05-20 Thread Naveen N. Rao
In preparation to add support for stack tracer to powerpc, move code to save stack trace and to calculate the frame sizes into a separate weak function. Also provide access to some of the data structures used by the stack trace code so that architectures can update those. Signed-off-by: Naveen N

[RFC PATCH 2/6] powerpc/trace: Add support for stack tracer

2021-05-20 Thread Naveen N. Rao
virtqueue_notify+0x40/0x80 17) 4880 240 virtio_queue_rq+0x568/0x610 18) 4640 256 blk_mq_dispatch_rq_list+0x190/0xbc0 19) 4384 160 __blk_mq_do_dispatch_sched+0x1f0/0x3d0 20) 4224 96 __blk_mq_sched_dispatch_requests+0x238/0x2c0 ... Signed-off-by: Naveen N

[RFC PATCH 3/6] powerpc: Indicate traced function name in show_stack()

2021-05-20 Thread Naveen N. Rao
[c0001ed7fdb0] [c002b6c4] system_call_exception+0xf4/0x200 [c0001ed7fe10] [c000ca5c] system_call_common+0xec/0x278 Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kernel/process.c b

[RFC PATCH 4/6] powerpc/perf: Include traced function in the callchain

2021-05-20 Thread Naveen N. Rao
With -mprofile-kernel and ppc32, the function tracer is invoked before a function sets up its own stackframe. This results in the traced function not appearing in stack traces. Fix this by checking for ftrace entry and including the traced function in the perf callchain. Signed-off-by: Naveen N

[RFC PATCH 5/6] powerpc/stacktrace: Include ftraced function in arch_stack_walk_reliable()

2021-05-20 Thread Naveen N. Rao
With -mprofile-kernel and ppc32, the function tracer is invoked before a function sets up its own stackframe. This results in the traced function not appearing in stack traces. Fix this by checking for ftrace entry and including the traced function in the stack trace. Signed-off-by: Naveen N. Rao

[RFC PATCH 6/6] powerpc/stacktrace: Include ftraced function in arch_stack_walk()

2021-05-20 Thread Naveen N. Rao
With -mprofile-kernel and ppc32, the function tracer is invoked before a function sets up its own stackframe. This results in the traced function not appearing in stack traces. Fix this by checking for ftrace entry and including the traced function in the stack trace. Signed-off-by: Naveen N. Rao

Re: [PATCH] powerpc/kprobes: Pass ppc_inst as a pointer to emulate_step() on ppc32

2021-05-21 Thread Naveen N. Rao
Christophe Leroy wrote: Le 20/05/2021 à 12:54, Naveen N. Rao a écrit : Christophe Leroy wrote: Le 20/05/2021 à 09:29, Naveen N. Rao a écrit : diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c index cdf87086fa33a0..2bc53fa48a1b33 100644 --- a/arch/powerpc

[PATCH] powerpc/configs: Enable STACK_TRACER and FTRACE_SYSCALLS in some of the configs

2021-05-24 Thread Naveen N. Rao
Both these config options are generally enabled in distro kernels. Enable the same in a few powerpc64 configs to get better coverage and testing. Signed-off-by: Naveen N. Rao --- arch/powerpc/configs/powernv_defconfig | 1 + arch/powerpc/configs/ppc64_defconfig | 2 ++ arch/powerpc/configs

[PATCH] powerpc/xmon: Add support for running a command on all cpus in xmon

2021-06-01 Thread Naveen N. Rao
#t' will run 't' command and produce a backtrace on all cpus in xmon. Since many xmon commands are not sensible for running in this manner, we only allow a predefined list of commands -- 'r', 'S' and 't' for now. Signe

Re: [PATCH] powerpc: make show_stack's stack walking KASAN-safe

2021-06-01 Thread Naveen N. Rao
Daniel Axtens wrote: Make our stack-walking code KASAN-safe by using READ_ONCE_NOCHECK - generic code, arm64, s390 and x86 all do this for similar sorts of reasons: when unwinding a stack, we might touch memory that KASAN has marked as being out-of-bounds. In ppc64 KASAN development, I hit this s

Re: [RFC PATCH 2/6] powerpc/trace: Add support for stack tracer

2021-06-01 Thread Naveen N. Rao
Naveen N. Rao wrote: + +unsigned long ftrace_get_traced_func_if_no_stackframe(unsigned long ip, unsigned long *stack) +{ + if (!is_ftrace_entry(ip)) + return 0; + + if (IS_ENABLED(CONFIG_PPC32)) + return stack[11]; /* see MCOUNT_SAVE_FRAME */ + + if

Re: [RFC PATCH 1/6] trace/stack: Move code to save the stack trace into a separate function

2021-06-02 Thread Naveen N. Rao
Steven Rostedt wrote: On Fri, 21 May 2021 12:18:36 +0530 "Naveen N. Rao" wrote: In preparation to add support for stack tracer to powerpc, move code to save stack trace and to calculate the frame sizes into a separate weak function. Also provide access to some of the data structur

Re: [PATCH] powerpc/kprobes: Pass ppc_inst as a pointer to emulate_step() on ppc32

2021-06-07 Thread Naveen N. Rao
Naveen N. Rao wrote: Trying to use a kprobe on ppc32 results in the below splat: BUG: Unable to handle kernel data access on read at 0x7c0802a6 Faulting instruction address: 0xc002e9f0 Oops: Kernel access of bad area, sig: 11 [#1] BE PAGE_SIZE=4K PowerPC 44x Platform Modules

Re: [PATCH] powerpc/kprobes: Pass ppc_inst as a pointer to emulate_step() on ppc32

2021-06-08 Thread Naveen N. Rao
Christophe Leroy wrote: Le 07/06/2021 à 19:36, Christophe Leroy a écrit : Le 07/06/2021 à 16:31, Christophe Leroy a écrit : Le 07/06/2021 à 13:34, Naveen N. Rao a écrit : Naveen N. Rao wrote: Trying to use a kprobe on ppc32 results in the below splat:     BUG: Unable to handle kernel

[PATCH] powerpc/bpf: Use bctrl for making function calls

2021-06-09 Thread Naveen N. Rao
blrl corrupts the link stack. Instead use bctrl when making function calls from BPF programs. Reported-by: Anton Blanchard Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/net/bpf_jit_comp32.c | 4 ++-- arch/powerpc/net/bpf_jit_comp64.c | 12

Re: [PATCH] powerpc/bpf: Use bctrl for making function calls

2021-06-09 Thread Naveen N. Rao
Christophe Leroy wrote: Le 09/06/2021 à 11:00, Naveen N. Rao a écrit : blrl corrupts the link stack. Instead use bctrl when making function calls from BPF programs. What's the link stack ? Is it the PPC64 branch predictor stack ? c974809a26a13e ("powerpc/vdso: Avoid link stack

Re: [PATCH v3 2/4] powerpc/sstep: support emulation for vsx vector paired storage access instructions

2020-08-05 Thread Naveen N. Rao
Balamuruhan S wrote: add emulate_step() changes to support vsx vector paired storage access instructions that provides octword operands loads/stores between storage and set of 64 Vector Scalar Registers (VSRs). This should be squashed in with the previous patch. Otherwise, emulation of these i

Re: [PATCH v1] powerpc/process: Remove unnecessary #ifdef CONFIG_FUNCTION_GRAPH_TRACER

2020-08-17 Thread Naveen N. Rao
. Acked-by: Naveen N. Rao - Naveen

Re: [PATCH] powerpc/code-patching: Return error on patch_branch() out-of-range failure

2021-09-22 Thread Naveen N. Rao
Christophe Leroy wrote: Do not silentely ignore a failure of create_branch() in patch_branch(). Return -ERANGE. Signed-off-by: Christophe Leroy --- arch/powerpc/lib/code-patching.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Naveen N. Rao diff --git a/arch

Re: coherency issue observed after hotplug on POWER8

2021-09-24 Thread Naveen N. Rao
Hi Cascardo, Thanks for reporting this. Thadeu Lima de Souza Cascardo wrote: Hi, there. We have been investigating an issue we have observed on POWER8 POWERNV systems. When running the kernel selftests reuseport_bpf_cpu after a CPU hotplug, we see crashes, in different forms. [1] Just to re-

[PATCH 0/9] powerpc/bpf: Various fixes

2021-10-01 Thread Naveen N. Rao
Various fixes to the eBPF JIT for powerpc, thanks to some new tests added by Johan. This series fixes all failures in test_bpf on powerpc64. There are still some failures on powerpc32 to be looked into. - Naveen Naveen N. Rao (8): powerpc/lib: Add helper to check if offset is within

[PATCH 1/9] powerpc/lib: Add helper to check if offset is within conditional branch range

2021-10-01 Thread Naveen N. Rao
Add a helper to check if a given offset is within the branch range for a powerpc conditional branch instruction, and update some sites to use the new helper. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/code-patching.h | 1 + arch/powerpc/lib/code-patching.c | 7

[PATCH 2/9] powerpc/bpf: Validate branch ranges

2021-10-01 Thread Naveen N. Rao
Add checks to ensure that we never emit branch instructions with truncated branch offsets. Suggested-by: Michael Ellerman Signed-off-by: Naveen N. Rao --- arch/powerpc/net/bpf_jit.h| 26 -- arch/powerpc/net/bpf_jit_comp.c | 6 +- arch/powerpc/net

[PATCH 3/9] powerpc/bpf: Remove unused SEEN_STACK

2021-10-01 Thread Naveen N. Rao
From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria Reviewed-by: Christophe Leroy --- arch/powerpc/net/bpf_jit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/net/bpf_jit.h b

[PATCH 4/9] powerpc/bpf: Handle large branch ranges with BPF_EXIT

2021-10-01 Thread Naveen N. Rao
emitting different number of instructions depending on the program size. Suggested-by: Jordan Niethe Signed-off-by: Naveen N. Rao --- arch/powerpc/net/bpf_jit.h| 3 +++ arch/powerpc/net/bpf_jit_comp.c | 22 +- arch/powerpc/net/bpf_jit_comp32.c | 2 +- arch/powerpc/net

[PATCH 5/9] powerpc/bpf: Fix BPF_MOD when imm == 1

2021-10-01 Thread Naveen N. Rao
Only ignore the operation if dividing by 1. Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF") Signed-off-by: Naveen N. Rao --- arch/powerpc/net/bpf_jit_comp64.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/p

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