Re: [PATCH] compiler-gcc.h: Remove ancient workaround for gcc PR 58670

2022-08-25 Thread Naveen N. Rao
Uros Bizjak wrote: The workaround for 'asm goto' miscompilation introduces a compiler barrier quirk that inhibits many useful compiler optimizations. For example, __try_cmpxchg_user compiles to: 11375: 41 8b 4d 00 mov0x0(%r13),%ecx 11379: 41 8b 02

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

2022-09-05 Thread Naveen N. Rao
Christophe Leroy wrote: Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit : objtool is throwing *unannotated intra-function call* warnings in .c files with a few instructions that are marked unreachable. The problem comes from the annotate_unreachable() macro that is called by unreachable(). T

Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

2022-09-05 Thread Naveen N. Rao
Christophe Leroy wrote: Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit : diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4c466acdc70d..dc05cd23c233 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -237,6 +237,7 @@ config PPC select HAVE_MOD_ARCH_SPECIF

Re: [PATCH v2 16/16] objtool/powerpc: Add --mcount specific implementation

2022-09-05 Thread Naveen N. Rao
Segher Boessenkool wrote: On Wed, Aug 31, 2022 at 12:50:07PM +, Christophe Leroy wrote: Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit : > + opcode = insn >> 26; > + > + switch (opcode) { > + case 18: /* bl */ case 18 is more than 'bl', it includes also 'b'. In both cases, the calcula

Re: [PATCH v2 05/16] powerpc: Skip objtool from running on drivers/crypto/vmx/aesp8-ppc.o

2022-09-05 Thread Naveen N. Rao
Peter Zijlstra wrote: On Mon, Aug 29, 2022 at 11:22:12AM +0530, Sathvika Vasireddy wrote: With objtool enabled, below warnings are seen when trying to build: drivers/crypto/vmx/aesp8-ppc.o: warning: objtool: aes_p8_set_encrypt_key+0x44: unannotated intra-function call drivers/crypto/vmx/aesp8

Re: [PATCH v2 11/16] objtool: Add --mnop as an option to --mcount

2022-09-05 Thread Naveen N. Rao
Peter Zijlstra wrote: On Mon, Aug 29, 2022 at 11:22:18AM +0530, Sathvika Vasireddy wrote: Architectures can select HAVE_NOP_MCOUNT if they choose to nop out mcount call sites. If that config option is selected, then --mnop is passed as an option to objtool, along with --mcount. Also, make sure

Re: [PATCH v3 11/16] objtool: Add --mnop as an option to --mcount

2022-09-14 Thread Naveen N. Rao
kernel test robot wrote: Hi Sathvika, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/topic/ppc-kvm] [also build test ERROR on linus/master v6.0-rc5] [cannot apply to powerpc/next masahiroy-kbuild/for-next next-20220912] [If your patch is applied to the wron

Re: [PATCH] scripts/faddr2line: Fix regression in name resolution on ppc64le

2022-09-30 Thread Naveen N. Rao
5100 ("scripts/faddr2line: Fix overlapping text section failures") Reference: https://lore.kernel.org/bpf/20191211160133.GB4580@calabresa/ Cc: "Naveen N. Rao" Cc: Jiri Olsa Cc: Thadeu Lima de Souza Cascardo Reviewed-by: Thadeu Lima de Souza Cascardo The other instances of read

Re: [PATCH] powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe()

2022-09-30 Thread Naveen N. Rao
amp; + ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { printk("Cannot register a kprobe on the second word of prefixed instruction\n"); ret = -EINVAL; } It's fine to keep the if condition on a single line. Other than that, thanks for the fix! Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH v4 03/16] powerpc: Fix objtool unannotated intra-function call warnings

2022-10-10 Thread Naveen N. Rao
Sathvika Vasireddy wrote: Objtool throws unannotated intra-function call warnings in the following assembly files: arch/powerpc/kernel/vector.o: warning: objtool: .text+0x53c: unannotated intra-function call arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x60: unannotated in

Re: [PATCH v4 11/16] objtool: Add --mnop as an option to --mcount

2022-10-10 Thread Naveen N. Rao
Sathvika Vasireddy wrote: Some architectures (powerpc) may not support ftrace locations being nop'ed out at build time. Introduce CONFIG_HAVE_OBJTOOL_NOP_MCOUNT for objtool, as a means for architectures to enable nop'ing of ftrace locations. Add --mnop as an option to objtool --mcount, to indicat

Re: [PATCH v4 00/16] objtool: Enable and implement --mcount option on powerpc

2022-10-10 Thread Naveen N. Rao
_OBJTOOL being enabled and changing annotate_unreachable(). As such, for this series: Reviewed-by: Naveen N. Rao Tested-by: Naveen N. Rao Josh, Are you ok if this series is taken in through the powerpc tree? - Naveen

Re: [PATCH] powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe()

2022-10-12 Thread Naveen N. Rao
Li Huafei wrote:   # echo 'p cmdline_proc_show' > kprobe_events   # echo 'p cmdline_proc_show+16' >> kprobe_events I think we should extend multiple_kprobes selftest to also place contiguous probes to catch such errors. Yes. But each architecture implementation is different and it looks a li

Re: [PATCH v4 11/16] objtool: Add --mnop as an option to --mcount

2022-10-12 Thread Naveen N. Rao
Josh Poimboeuf wrote: On Mon, Oct 10, 2022 at 05:07:46PM +0530, Naveen N. Rao wrote: > +++ b/scripts/Makefile.lib > @@ -234,6 +234,7 @@ objtool_args = \ >$(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr) \

Re: [PATCH v4 00/16] objtool: Enable and implement --mcount option on powerpc

2022-10-12 Thread Naveen N. Rao
Josh Poimboeuf wrote: On Tue, Oct 11, 2022 at 01:20:02PM -0700, Josh Poimboeuf wrote: On Mon, Oct 10, 2022 at 05:19:02PM +0530, Naveen N. Rao wrote: > All the above changes are down to compiler optimizations and shuffling due > to CONFIG_OBJTOOL being enabled and changing annotate_unrea

[PATCH 0/5] powerpc/kprobes: preempt related changes and cleanups

2022-10-20 Thread Naveen N. Rao
This series attempts to address some of the concerns raised in https://github.com/linuxppc/issues/issues/440 The last two patches are minor cleanups in related kprobes code. - Naveen Naveen N. Rao (5): powerpc/kprobes: Remove preempt disable around call to get_kprobe() in

[PATCH 1/5] powerpc/kprobes: Remove preempt disable around call to get_kprobe() in arch_prepare_kprobe()

2022-10-20 Thread Naveen N. Rao
n]register(). *OR *- with preemption disabled - from architecture specific code. */ As such, there is no need to disable preemption around the call to get_kprobe(). Drop the same. Reported-by: Nicholas Piggin Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kpr

[PATCH 2/5] powerpc/kprobes: Have optimized_callback() use preempt_enable()

2022-10-20 Thread Naveen N. Rao
kprobes: Do not disable interrupts for optprobes and kprobes_on_ftrace"). Reported-by: Nicholas Piggin Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/optprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kern

[PATCH 4/5] powerpc/kprobes: Setup consistent pt_regs across kprobes, optprobes and KPROBES_ON_FTRACE

2022-10-20 Thread Naveen N. Rao
do in optprobes and trap-based kprobes. - Drop setting orig_gpr3 and result to zero in optprobes. These are not relevant under kprobes and should not be used by the handlers. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/optprobes_head.S| 5 + arch/powerpc/kernel/trace

[PATCH 5/5] powerpc/kprobes: Remove unnecessary headers from kprobes

2022-10-20 Thread Naveen N. Rao
Many of these headers are not necessary since those are included indirectly, or the code using those headers has been removed. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes-ftrace.c | 4 arch/powerpc/kernel/kprobes.c| 2 -- 2 files changed, 6 deletions(-) diff --git

[PATCH 3/5] powerpc/kprobes: Use preempt_enable() rather than the no_resched variant

2022-10-20 Thread Naveen N. Rao
preempt_enable_no_resched() is just the same as preempt_enable() when we are in a irqs disabled context. kprobe_handler() and the post/fault handlers are all called with irqs disabled. As such, convert those to just use preempt_enable(). Reported-by: Nicholas Piggin Signed-off-by: Naveen N. Rao

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

2023-11-22 Thread Naveen N Rao
On Wed, Nov 22, 2023 at 03:44:07PM +1100, Michael Ellerman wrote: > Naveen N Rao writes: > > 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 indee

[PATCH] powerpc/lib: Validate size for vector operations

2023-11-22 Thread Naveen N Rao
kernel stack corruption. Signed-off-by: Naveen N Rao --- arch/powerpc/lib/sstep.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index a13f05cfc7db..5766180f5380 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c

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

2023-11-24 Thread Naveen N Rao
On Thu, Nov 23, 2023 at 09:17:54AM -0600, Gustavo A. R. Silva wrote: > > > > To be honest I don't know how paranoid we want to get, we could end up > > > putting WARN's all over the kernel :) > > > > > > In this case I guess if the size is too large we overflow the buffer on > > > the kernel stac

[PATCH] powerpc/ftrace: Fix stack teardown in ftrace_no_trace

2023-11-29 Thread Naveen N Rao
ition, the commit missed saving the correct stack pointer in pt_regs. Update the same. Fixes: 41a506ef71eb ("powerpc/ftrace: Create a dummy stackframe to fix stack unwind") Cc: sta...@vger.kernel.org Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace_entry.S | 4 ++-

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

2023-11-30 Thread Naveen N Rao
On Mon, Oct 16, 2023 at 04:01:45PM +1100, Benjamin Gray wrote: > patch_instruction() is designed for patching instructions in otherwise > readonly memory. Other consumers also sometimes need to patch readonly > memory, so have abused patch_instruction() for arbitrary data patches. > > This is a pr

Re: [PATCH v2 2/3] powerpc/64: Convert patch_instruction() to patch_u32()

2023-11-30 Thread Naveen N Rao
On Mon, Oct 16, 2023 at 04:01:46PM +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

[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

[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 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 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 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 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 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 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 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 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

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

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 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: [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 > >

[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: [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 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

[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

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 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 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] 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: [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 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 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

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: arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c: unannotated intra-function call

2023-01-24 Thread Naveen N. Rao
Sathvika Vasireddy wrote: arch/powerpc/kvm/booke.o: warning: objtool: kvmppc_fill_pt_regs+0x30: unannotated intra-function call As an attempt to fix it, I tried expanding ANNOTATE_INTRA_FUNCTION_CALL macro to indicate that the branch target is valid. It then threw another warning (arch/pow

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 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 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 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 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 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 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 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 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 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 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 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] 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 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 5/5] powerpc/kprobes: Remove unnecessary headers from kprobes

2022-11-08 Thread Naveen N. Rao
Christophe Leroy wrote: Le 20/10/2022 à 19:29, Naveen N. Rao a écrit : Many of these headers are not necessary since those are included indirectly, or the code using those headers has been removed. It is usually not a good idea to not include headers because they are already included

Re: [PATCH 1/5] powerpc/kprobes: Remove preempt disable around call to get_kprobe() in arch_prepare_kprobe()

2022-11-08 Thread Naveen N. Rao
Nicholas Piggin wrote: On Fri Oct 21, 2022 at 3:28 AM AEST, Naveen N. Rao wrote: arch_prepare_kprobe() is called from register_kprobe() via prepare_kprobe(), or through register_aggr_kprobe(), both with the kprobe_mutex held. Per the comment for get_kprobe(): /* * This routine is called

Re: [PATCH 4/5] powerpc/kprobes: Setup consistent pt_regs across kprobes, optprobes and KPROBES_ON_FTRACE

2022-11-08 Thread Naveen N. Rao
Nicholas Piggin wrote: On Fri Oct 21, 2022 at 3:29 AM AEST, Naveen N. Rao wrote: Ensure a more consistent pt_regs across kprobes, optprobes and KPROBES_ON_FTRACE: - Drop setting trap to 0x700 under optprobes. This is not accurate and is unnecessary. Instead, zero it out for both optprobes and

[PATCH] perf test: Skip watchpoint tests if no watchpoints available

2022-11-21 Thread Naveen N. Rao
On IBM Power9, perf watchpoint tests fail since no hardware breakpoints are available. Detect this by checking the error returned by perf_event_open() and skip the tests in that case. Reported-by: Disha Goel Signed-off-by: Naveen N. Rao --- tools/perf/tests/wp.c | 12 +++- 1 file

[PATCH 0/3] selftests/powerpc: ptrace/perf_hwbreak test fixes

2022-11-21 Thread Naveen N. Rao
issues. The first patch is a small cleanup to aid subsequent fixes. - Naveen Naveen N. Rao (3): selftests/powerpc: Move perror closer to its use selftests/powerpc: Bump up rlimit for perf-hwbreak test selftests/powerpc: Account for offline cpus in perf-hwbreak test .../selftests/powerpc

[PATCH 1/3] selftests/powerpc: Move perror closer to its use

2022-11-21 Thread Naveen N. Rao
Right now, if perf_event_open() fails for the systemwide tests, error report is printed too late, sometimes after subsequent system calls. Move use of perror() to the main function, just after the syscall. Signed-off-by: Naveen N. Rao --- .../selftests/powerpc/ptrace/perf-hwbreak.c | 21

[PATCH 3/3] selftests/powerpc: Account for offline cpus in perf-hwbreak test

2022-11-21 Thread Naveen N. Rao
For systemwide tests, use online cpu mask to only open events on online cpus. This enables this test to work on systems in lower SMT modes. Signed-off-by: Naveen N. Rao --- .../selftests/powerpc/ptrace/perf-hwbreak.c | 45 --- 1 file changed, 39 insertions(+), 6 deletions

[PATCH 2/3] selftests/powerpc: Bump up rlimit for perf-hwbreak test

2022-11-21 Thread Naveen N. Rao
The systemwide perf hardware breakpoint test tries to open a perf event on each cpu. On large systems, we run out of file descriptors and fail the test. Instead, have the test set the file descriptor limit to an arbitraty high value. Reported-by: Rohan Deshpande Signed-off-by: Naveen N. Rao

Re: [PATCH] powerpc/bpf/32: Fix Oops on tail call tests

2022-11-21 Thread Naveen N. Rao
Christophe Leroy wrote: test_bpf tail call tests end up as: test_bpf: #0 Tail call leaf jited:1 85 PASS test_bpf: #1 Tail call 2 jited:1 111 PASS test_bpf: #2 Tail call 3 jited:1 145 PASS test_bpf: #3 Tail call 4 jited:1 170 PASS test_bpf: #4 Tail call load/store leaf jited:1 190 PASS

Re: [PATCH] powerpc/bpf/32: Fix Oops on tail call tests

2022-11-22 Thread Naveen N. Rao
Christophe Leroy wrote: Le 22/11/2022 à 08:33, Naveen N. Rao a écrit : Christophe Leroy wrote: This is a tentative to write above the stack. The problem is encoutered with tests added by commit 38608ee7b690 ("bpf, tests: Add load store test case for tail call") This happens be

Re: [PATCH] powerpc/bpf: Only update ldimm64 during extra pass when it is an address

2022-11-24 Thread Naveen N. Rao
Christophe Leroy wrote: ldimm64 is not only used for loading function addresses, and That's probably true today, but I worry that that can change upstream and we may not notice at all. the NOPs added for padding are impacting performance, so avoid them when not necessary. On QEMU mac99, wi

Re: [PATCH v2] powerpc/bpf/32: Fix Oops on tail call tests

2022-11-24 Thread Naveen N. Rao
unt preserved across function calls jited:1 140975 PASS test_bpf: #8 Tail call error path, NULL target jited:1 110 PASS test_bpf: #9 Tail call error path, index out of range jited:1 69 PASS test_bpf: test_tail_calls: Summary: 10 PASSED, 0 FAILED, [10/10 JIT'ed] Suggested-by: Naveen N.

Re: Questions about kprobe handler

2022-11-24 Thread Naveen N. Rao
Jinyang He wrote: 在 2022/11/17 21:09, Masami Hiramatsu (Google) 写道: On Thu, 17 Nov 2022 09:07:37 +0800 Tiezhu Yang wrote: Hi KPROBES maintainers, There are some differences of kprobe handler implementations on various archs, the implementations are almost same on arm64, riscv, csky, the cod

Re: [PATCH] powerpc/bpf: Only update ldimm64 during extra pass when it is an address

2022-11-24 Thread Naveen N. Rao
Christophe Leroy wrote: Le 24/11/2022 à 11:13, Naveen N. Rao a écrit : Christophe Leroy wrote: ldimm64 is not only used for loading function addresses, and That's probably true today, but I worry that that can change upstream and we may not notice at all. Not sure what you mean.

Re: [PATCH] powerpc/bpf: Only update ldimm64 during extra pass when it is an address

2022-11-24 Thread Naveen N. Rao
Christophe Leroy wrote: Le 24/11/2022 à 14:49, Naveen N. Rao a écrit : Christophe Leroy wrote: Le 24/11/2022 à 11:13, Naveen N. Rao a écrit : Christophe Leroy wrote: In what direction could that change in the future ? For me if they change that it becomes an API change. More of an

Re: linux-next: build warnings after merge of the powerpc-objtool tree

2022-12-06 Thread Naveen N. Rao
Sathvika Vasireddy wrote: On 29/11/22 20:58, Christophe Leroy wrote: Le 29/11/2022 à 16:13, Sathvika Vasireddy a écrit : Hi all, On 25/11/22 09:00, Stephen Rothwell wrote: Hi all, After merging the powerpc-objtool tree, today's linux-next build (powerpc pseries_le_defconfig) produced these

Re: [PATCH] powerpc/pseries: fix potential memory leak in init_cpu_associativity()

2022-12-12 Thread Naveen N. Rao
Wang Yufen wrote: If the vcpu_associativity alloc memory successfully but the pcpu_associativity fails to alloc memory, the vcpu_associativity memory leaks. Fixes: d62c8deeb6e6 ("powerpc/pseries: Provide vcpu dispatch statistics") Signed-off-by: Wang Yufen --- arch/powerpc/platforms/pseries/lp

Re: [PATCH v1 06/10] powerpc/bpf: Perform complete extra passes to update addresses

2022-12-13 Thread Naveen N. Rao
Christophe Leroy wrote: BPF core calls the jit compiler again for an extra pass in order to properly set subprog addresses. Unlike other architectures, powerpc only updates the addresses during that extra pass. It means that holes must have been left in the code in order to enable the maximum po

Re: [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity()

2023-01-10 Thread Naveen N. Rao
ms/pseries/lpar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH v1 06/10] powerpc/bpf: Perform complete extra passes to update addresses

2023-01-10 Thread Naveen N. Rao
Christophe Leroy wrote: Le 13/12/2022 à 11:23, Naveen N. Rao a écrit : Christophe Leroy wrote: BPF core calls the jit compiler again for an extra pass in order to properly set subprog addresses. Unlike other architectures, powerpc only updates the addresses during that extra pass. It means

Re: [PATCH v2] powerpc/uprobes: Validation for prefixed instruction

2021-02-04 Thread Naveen N. Rao
On 2021/02/04 04:17PM, Ravi Bangoria wrote: > Don't allow Uprobe on 2nd word of a prefixed instruction. As per > ISA 3.1, prefixed instruction should not cross 64-byte boundary. > So don't allow Uprobe on such prefixed instruction as well. > > There are two ways probed instruction is changed in ma

Re: [PATCH v2] powerpc/uprobes: Validation for prefixed instruction

2021-02-04 Thread Naveen N. Rao
On 2021/02/04 04:19PM, Ravi Bangoria wrote: > > > On 2/4/21 4:17 PM, Ravi Bangoria wrote: > > Don't allow Uprobe on 2nd word of a prefixed instruction. As per > > ISA 3.1, prefixed instruction should not cross 64-byte boundary. > > So don't allow Uprobe on such prefixed instruction as well. > >

Re: [PATCH v2] powerpc/uprobes: Validation for prefixed instruction

2021-02-04 Thread Naveen N. Rao
On 2021/02/04 06:38PM, Naveen N. Rao wrote: > On 2021/02/04 04:17PM, Ravi Bangoria wrote: > > Don't allow Uprobe on 2nd word of a prefixed instruction. As per > > ISA 3.1, prefixed instruction should not cross 64-byte boundary. > > So don't allow Uprobe on su

Re: [PATCH v3] powerpc/uprobes: Validation for prefixed instruction

2021-03-03 Thread Naveen N. Rao
CONFIG_PPC64, and I don't think we need to confirm if we're running on a ISA V3.1 for the below check. With that: Acked-by: Naveen N. Rao > + > + if (ppc_inst_prefixed(auprobe->insn) && (addr & 0x3F) == 0x3C) { > + pr_info_ratelimited("Cannot register a uprobe on 64 byte > unaligned prefixed instruction\n"); > + return -EINVAL; > + } > + - Naveen

Re: [PATCH v2 1/3] powerpc: sstep: Fix load and update emulation

2021-03-04 Thread Naveen N. Rao
On 2021/03/01 08:37PM, Segher Boessenkool wrote: > Hi! > > I didn't see this until now, almost a month later, sorry about that :-) No problem. > > On Thu, Feb 04, 2021 at 01:57:53PM +0530, Naveen N. Rao wrote: > > On 2021/02/03 03:17PM, Segher Boessenkoo

Re: [PATCH v2 1/3] powerpc: sstep: Fix load and update emulation

2021-03-05 Thread Naveen N. Rao
On 2021/03/04 09:45AM, Segher Boessenkool wrote: > On Wed, Mar 03, 2021 at 10:01:27PM +0530, Naveen N. Rao wrote: > > On 2021/03/01 08:37PM, Segher Boessenkool wrote: > > > > And, r6 always ends up with 0xaea. It changes with the value I put into > > > > r6 tho

Re: [PATCH] powerpc: Fix instruction encoding for lis in ppc_function_entry()

2021-03-08 Thread Naveen N. Rao
On 2021/03/05 12:37PM, Christophe Leroy wrote: > > > Le 04/03/2021 à 03:04, Naveen N. Rao a écrit : > > 'lis r2,N' is 'addis r2,0,N' and the instruction encoding in the macro > > LIS_R2 is incorrect (it currently maps to 'addis 0,r2,N'). Fix

Re: [PATCH] powerpc/64s: Use symbolic macros for function entry encoding

2021-03-09 Thread Naveen N. Rao
e changed, 4 insertions(+), 3 deletions(-) Thanks, Acked-by: Naveen N. Rao - Naveen

Re: [PATCH v4] powerpc/uprobes: Validation for prefixed instruction

2021-03-09 Thread Naveen N. Rao
user maps a > > relevant page via mmap(), instruction is replaced via mmap() code > > path. But because Uprobe is invalid, entire mmap() operation can > > not be stopped. In this case just print an error and continue. > > > > Signed-off-by: Ravi Bangoria > > Acked-

Re: [PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC64

2022-03-02 Thread Naveen N. Rao
Christophe Leroy wrote: Le 27/07/2021 à 08:55, Jordan Niethe a écrit : Implement commit 40272035e1d0 ("powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC32") for PPC64. When the BPF routine doesn't call any function, the non volatile registers can be reallocated

Re: [PATCH v2 1/7] ftrace: Expose flags used for ftrace_replace_code()

2022-03-02 Thread Naveen N. Rao
Christophe Leroy wrote: Le 27/06/2019 à 13:23, Naveen N. Rao a écrit : Since ftrace_replace_code() is a __weak function and can be overridden, we need to expose the flags that can be set. So, move the flags enum to the header file. Reviewed-by: Steven Rostedt (VMware) Signed-off-by: Naveen

Re: [PATCH] powerpc/security: Provide stubs for when PPC_BARRIER_NOSPEC isn't enabled

2022-03-02 Thread Naveen N. Rao
Christophe Leroy wrote: Le 10/01/2022 à 11:07, Naveen N. Rao a écrit : kernel test robot reported the below build error with a randconfig: powerpc64-linux-ld: arch/powerpc/net/bpf_jit_comp64.o:(.toc+0x0): undefined reference to `powerpc_security_features' This can happ

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