Re: [PATCH 03/17] powerpc/qspinlock: use a half-word store to unlock to avoid larx/stcx.

2022-11-10 Thread Nicholas Piggin
On Thu Nov 10, 2022 at 10:39 AM AEST, Jordan Niethe wrote: > On Thu, 2022-07-28 at 16:31 +1000, Nicholas Piggin wrote: > [resend as utf-8, not utf-7] > > The first 16 bits of the lock are only modified by the owner, and other > > modifications always use atomic operations on the

Re: [PATCH 02/17] powerpc/qspinlock: add mcs queueing for contended waiters

2022-11-10 Thread Nicholas Piggin
On Thu Nov 10, 2022 at 10:36 AM AEST, Jordan Niethe wrote: > On Thu, 2022-07-28 at 16:31 +1000, Nicholas Piggin wrote: > > [resend as utf-8, not utf-7] > > > > +/* > > + * Bitfields in the atomic value: > > + * > > + * 0: locked bit > > +

Re: [PATCH 01/17] powerpc/qspinlock: powerpc qspinlock implementation

2022-11-10 Thread Nicholas Piggin
On Thu Nov 10, 2022 at 10:35 AM AEST, Jordan Niethe wrote: > On Thu, 2022-07-28 at 16:31 +1000, Nicholas Piggin wrote: > > > -#define queued_spin_lock queued_spin_lock > > > > -static inline void queued_spin_unlock(struct qspinlock *lock) > > +static __always_

Re: [PATCH v2 1/4] powerpc/64: Add INTERRUPT_SANITIZE_REGISTERS Kconfig

2022-11-08 Thread Nicholas Piggin
On Tue Nov 8, 2022 at 2:39 AM AEST, Segher Boessenkool wrote: > Hi! > > On Mon, Nov 07, 2022 at 02:31:59PM +1100, Rohan McLure wrote: > > Add Kconfig option for enabling clearing of registers on arrival in an > > interrupt handler. This reduces the speculation influence of registers > > on kernel

Re: [RFC PATCH 05/19] powerpc/32: Use load and store multiple in GPR save/restore macros

2022-11-07 Thread Nicholas Piggin
on't mind either way. Thanks, Nick > > Le 31/10/2022 à 06:54, Nicholas Piggin a écrit : > > --- > > arch/powerpc/include/asm/ppc_asm.h | 18 -- > > 1 file changed, 16 insertions(+), 2 deletions(-) > > > > diff --git a/arch/powerpc/include/asm

Re: [RFC PATCH 2/6] powerpc/64s: Helpers to switch between linear and vmapped stack pointers

2022-11-07 Thread Nicholas Piggin
On Sat Nov 5, 2022 at 6:00 PM AEST, Christophe Leroy wrote: > > > Le 04/11/2022 à 18:27, Andrew Donnellan a écrit : > > powerpc unfortunately has too many places where we run stuff in real mode. > > > > With CONFIG_VMAP_STACK enabled, this means we need to be able to swap the > > stack pointer to

Re: [RFC PATCH 14/19] powerpc: split validate_sp into two functions

2022-11-07 Thread Nicholas Piggin
On Mon Nov 7, 2022 at 10:58 AM AEST, Russell Currey wrote: > On Mon, 2022-10-31 at 15:54 +1000, Nicholas Piggin wrote: > > Most callers just want to validate an arbitrary kernel stack pointer, > > some need a particular size. Make the size case the exceptional one > > w

Re: [PATCH v9 5/7] powerpc/tlb: Add local flush for page given mm_struct and psize

2022-11-07 Thread Nicholas Piggin
On Mon Nov 7, 2022 at 4:58 PM AEST, Benjamin Gray wrote: > On Thu, 2022-11-03 at 11:39 +1100, Benjamin Gray wrote: > > On Wed, 2022-11-02 at 09:56 +, Christophe Leroy wrote: > > > By the way, 'extern' keyword is pointless and deprecated for > > > functions > > > prototypes, please don't add

Re: [PATCH v5 2/2] powerpc/64: Add module check for ELF ABI version

2022-11-07 Thread Nicholas Piggin
On Thu Nov 3, 2022 at 6:35 PM AEST, Christophe Leroy wrote: > > > Le 31/10/2022 à 13:07, Nicholas Piggin a écrit : > > Override the generic module ELF check to provide a check for the ELF ABI > > version. This becomes important if we allow big-endian ELF ABI V2 builds &g

Re: [PATCH 1/2] powerpc: export the CPU node count

2022-11-07 Thread Nicholas Piggin
On Sat Oct 29, 2022 at 2:00 AM AEST, Laurent Dufour wrote: > At boot time, the FDT is parsed to compute the number of CPUs. > In addition count the number of CPU nodes and export it. > > This is useful when building the FDT for a kexeced kernel since we need to > take in account the CPU node added

Re: [PATCH] powerpc: Interrupt handler stack randomisation

2022-11-07 Thread Nicholas Piggin
On Tue Oct 25, 2022 at 1:38 PM AEST, Rohan McLure wrote: > Stack frames used by syscall handlers support random offsets as of > commit f4a0318f278d (powerpc: add support for syscall stack randomization). > Implement the same for general interrupt handlers, by applying the > random stack offset and

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

2022-11-07 Thread Nicholas Piggin
+linux-arch FYI most preempt_enable_no_resched() calls outside of core scheduler code come from kprobes copy-and-paste, and can possibly be fixed in similar ways as this series. It's a bit of a footgun API that should be banished from outside kernel/sched/, at least without an explicit comment

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

2022-11-07 Thread Nicholas Piggin
ult to zero in optprobes. These are not > relevant under kprobes and should not be used by the handlers. This is for CFAR, which we can't get anyway because we just branched here. I would rather zero it explicitly though. Otherwise, Reviewed-by: Nicholas Piggin > > Signed-off-by: Naveen N.

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

2022-11-07 Thread Nicholas Piggin
gt; just use preempt_enable(). Reviewed-by: Nicholas Piggin > > Reported-by: Nicholas Piggin > Signed-off-by: Naveen N. Rao > --- > arch/powerpc/kernel/kprobes.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/kernel/kprobes.c b/a

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

2022-11-07 Thread Nicholas Piggin
removed irq disabling for optprobes in commit f72180cc93a2c6 > ("powerpc/kprobes: Do not disable interrupts for optprobes and > kprobes_on_ftrace"). Looks okay. Even if we did have irqs disabled here, we should just use preempt_enable(), which nests properly inside or outside loc

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

2022-11-07 Thread Nicholas Piggin
isable preemption around the call to > get_kprobe(). Drop the same. And prepare_kprobe() and register_aggr_kprobe() are both called with kprobe_mutex held so you rely on the same protection. This seems to fix a lost-resched bug with preempt kernels too. Reviewed-by: Nicholas Piggin > >

[PATCH v5 2/2] powerpc/64: Add module check for ELF ABI version

2022-10-31 Thread Nicholas Piggin
] Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/module.c | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c index f6d6ae0a1692..d46bf9bfda26 100644 --- a/arch/powerpc/kernel/module.c +++ b/arch/powerpc/kernel

[PATCH v5 1/2] module: add module_elf_check_arch for module-specific checks

2022-10-31 Thread Nicholas Piggin
elf_validity_check(). Cc: Michael Ellerman Signed-off-by: Jessica Yu [np: added changelog, adjust name, rebase] Signed-off-by: Nicholas Piggin --- include/linux/moduleloader.h | 3 +++ kernel/module/main.c | 10 ++ 2 files changed, 13 insertions(+) diff --git a/include/linux/moduleloader.h

[PATCH v5 0/2] powerpc module arch checks

2022-10-31 Thread Nicholas Piggin
object to the code in the first place). Thanks, Nick Nicholas Piggin (2): module: add module_elf_check_arch for module-specific checks powerpc/64: Add module check for ELF ABI version arch/powerpc/kernel/module.c | 17 + include/linux/moduleloader.h | 3 +++ kernel/module/main.c

[RFC PATCH 19/19] powerpc/64: ELFv2 use reserved word in the stack frame for the regs marker

2022-10-31 Thread Nicholas Piggin
There are 4 unused bytes in the minimum frame in the ELFv2 ABI. At the risk of causing a future ABI incompatibility, use this and save 16 bytes from interrupt and switch frames. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 15 ++- 1 file changed, 10

[RFC PATCH 18/19] powerpc: change stack marker memory operations to 32-bit

2022-10-31 Thread Nicholas Piggin
The marker is a 32-bit constant across all platforms now, so use 32-bit memory accesses. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h| 1 - arch/powerpc/kernel/exceptions-64e.S | 2 +- arch/powerpc/kernel/exceptions-64s.S | 2 +- arch/powerpc/kernel/interrupt_64.S

[RFC PATCH 17/19] powerpc: remove STACK_FRAME_OVERHEAD

2022-10-31 Thread Nicholas Piggin
This is equal to STACK_FRAME_MIN_SIZE on 32-bit and 64-bit ELFv1, and no longer used in 64-bit ELFv2, so replace it with that constant. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff

[RFC PATCH 16/19] powerpc/64: ELFv2 use minimal stack frames in int and switch frame sizes

2022-10-31 Thread Nicholas Piggin
This requires an extra 16 bytes beyond the minimum frame size for the aligned regs marker for the int frame. The switch frame needs to match that because they share some offset definitions. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 21 +++-- 1 file

[RFC PATCH 15/19] powerpc: allow minimum sized kernel stack frames

2022-10-31 Thread Nicholas Piggin
This affects only 64-bit ELFv2 kernels, and reduces the minimum asm-created stack frame size from 112 to 32 byte on those kernels. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/head_40x.S | 2 +- arch/powerpc/kernel/head_44x.S | 6 +++--- arch/powerpc/kernel/head_64.S

[RFC PATCH 14/19] powerpc: split validate_sp into two functions

2022-10-31 Thread Nicholas Piggin
Most callers just want to validate an arbitrary kernel stack pointer, some need a particular size. Make the size case the exceptional one with an extra function. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/processor.h | 15 --- arch/powerpc/kernel/process.c

[RFC PATCH 13/19] powerpc: copy_thread add a back chain to the switch stack frame

2022-10-31 Thread Nicholas Piggin
egs ... ] NIP [7fffa72f56d8] 0x7fffa72f56d8 LR [] 0x0 --- interrupt: 3000 Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/process.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 27956831f

[RFC PATCH 12/19] powerpc: copy_thread fill in interrupt frame marker and back chain

2022-10-31 Thread Nicholas Piggin
-by: Nicholas Piggin --- arch/powerpc/kernel/process.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index a097879b0474..27956831fa5d 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c

[RFC PATCH 11/19] powerpc: add a define for the switch frame size and regs offset

2022-10-31 Thread Nicholas Piggin
This is open-coded in process.c, ppc32 uses a different define with the same value, and the C definition is name differently which makes it an extra indirection to grep for. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 6 -- arch/powerpc/kernel/asm-offsets.c | 2

[RFC PATCH 10/19] powerpc: add a define for the user interrupt frame size

2022-10-31 Thread Nicholas Piggin
The user interrupt frame is a different size from the kernel frame, so give it its own name. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 6 +++--- arch/powerpc/kernel/process.c | 6 +++--- arch/powerpc/kernel/stacktrace.c | 4 ++-- 3 files changed, 8 insertions

[RFC PATCH 09/19] powerpc: Rename STACK_FRAME_MARKER and derive it from frame offset

2022-10-31 Thread Nicholas Piggin
This is a count of longs from the stack pointer to the regs marker. Rename it to make it more distinct from the other byte offsets. It can be derived from the byte offset definitions just added. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 4 ++-- arch/powerpc/kernel

[RFC PATCH 08/19] powerpc: add a definition for the marker offset within the interrupt frame

2022-10-31 Thread Nicholas Piggin
Define a constant rather than open-code the offset for the "regs" marker. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 2 ++ arch/powerpc/kernel/entry_32.S | 2 +- arch/powerpc/kernel/exceptions-64e.S| 2 +- arch/powerpc/kernel/except

[RFC PATCH 07/19] powerpc: add definition for pt_regs offset within an interrupt frame

2022-10-31 Thread Nicholas Piggin
This is a common offset that currently uses the overloaded STACK_FRAME_OVERHEAD constant. It's easier to read and more flexible to use a specific regs offset for this. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h | 2 + arch/powerpc/kernel/asm-offsets.c

[RFC PATCH 06/19] powerpc: simplify ppc_save_regs

2022-10-31 Thread Nicholas Piggin
Adjust the pt_regs pointer so the interrupt frame offsets can be used directly to save registers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/ppc_save_regs.S | 58 +++-- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/arch/powerpc/kernel

[RFC PATCH 05/19] powerpc/32: Use load and store multiple in GPR save/restore macros

2022-10-30 Thread Nicholas Piggin
--- arch/powerpc/include/asm/ppc_asm.h | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 753a2757bcd4..ac44383d350a 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++

[RFC PATCH 04/19] powerpc/pseries: hvcall stack frame overhead

2022-10-30 Thread Nicholas Piggin
This call may use the min size stack frame. The scratch space used is in the caller's parameter area frame, not this function's frame. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/hvCall.S | 38 + 1 file changed, 20 insertions(+), 18 deletions

[RFC PATCH 03/19] powerpc/64: Remove asm interrupt tracing call helpers

2022-10-30 Thread Nicholas Piggin
These are unused. Remove. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/irqflags.h | 29 - 1 file changed, 29 deletions(-) diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h index 1a6c1ce17735..81e0a5025be8 100644

[RFC PATCH 02/19] powerpc: Rearrange copy_thread child stack creation

2022-10-30 Thread Nicholas Piggin
This makes it a bit clearer where the stack frame is created, and will allow easier use of some of the stack offset constants in a later change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/process.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch

[RFC PATCH 00/19] Remove STACK_FRAME_OVERHEAD

2022-10-30 Thread Nicholas Piggin
as a fix. Thanks, Nick Nicholas Piggin (19): powerpc/perf: callchain validate kernel stack pointer bounds powerpc: Rearrange copy_thread child stack creation powerpc/64: Remove asm interrupt tracing call helpers powerpc/pseries: hvcall stack frame overhead powerpc/32: Use load and store

[RFC PATCH 01/19] powerpc/perf: callchain validate kernel stack pointer bounds

2022-10-30 Thread Nicholas Piggin
The interrupt frame detection and loads from the hypothetical pt_regs are not bounds-checked. The next-frame validation only bounds-checks STACK_FRAME_OVERHEAD, which does not include the pt_regs. Add another test for this. Signed-off-by: Nicholas Piggin --- Could the user set r1 to be equal

[PATCH] powerpc/books: Never call nmi_enter for real-mode NMIs

2022-10-27 Thread Nicholas Piggin
the features that might be enabled by nmi_enter(), like RCU or printk are unlikely to be usable in real mode anyway. Reported-by: Michael Ellerman Cc: Mahesh Salgaonkar Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 49 +--- 1 file changed, 16 insertions

[PATCH] powerpc/64s/hash: add stress_hpt kernel boot option to increase hash faults

2022-10-23 Thread Nicholas Piggin
the TLB (in the case of bare metal) to increase and slightly randomise kernel fault activity. Signed-off-by: Nicholas Piggin --- I tried this a while ago and it had some lockup issues, I think I fixed them. Deadlock if the same hpte group is used as the one to be cleared, solved by deferring

[PATCH] powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to soft-masked context

2022-10-21 Thread Nicholas Piggin
when returning to soft-masked context") Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/interrupt_64.S | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index 978a173eb339..a019ed6fc8

Re: [6.1-rc1] Warning arch/powerpc/kernel/irq_64.c:285

2022-10-20 Thread Nicholas Piggin
On Thu Oct 20, 2022 at 2:55 PM AEST, Sachin Sant wrote: > While running powerpc kselftests (mm/stress_code_patching.sh) > on a PowerVM LPAR following warning is seen. The test passes. > I can reliably recreate it on a Power9 server, not so easily on > Power10. > > # ./stress_code_patching.sh >

Re: warning from change_protection in 6.1 rc1

2022-10-20 Thread Nicholas Piggin
On Wed Oct 19, 2022 at 8:21 PM AEST, Dan Horák wrote: > Hi, > > in my first boot with the 6.1 rc1 kernel I have received a couple of > warnings from change_protection on Talos II P9 system, see the details > below. Nothing like that was noticed in 6.0 or earlier. Thanks for the report. This is a

[PATCH v2 1/2] KVM: PPC: BookS PR-KVM and BookE do not support context tracking

2022-10-13 Thread Nicholas Piggin
The context tracking code in PR-KVM and BookE implementations is not complete, and can cause host crashes if context tracking is enabled. Make these implementations depend on !CONTEXT_TRACKING_USER. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/Kconfig | 4 1 file changed, 4

[PATCH v2 0/2] powerpc: misc interrupt and context tracking

2022-10-13 Thread Nicholas Piggin
These are several fixes for regressions and crash bugs. Since v1 I cut down the fixes to a minimum. Thanks, Nick Nicholas Piggin (2): KVM: PPC: BookS PR-KVM and BookE do not support context tracking powerpc/64/interrupt: Prevent NMI PMI causing a dangerous warning arch/powerpc/kernel

[PATCH v2 2/2] powerpc/64/interrupt: Prevent NMI PMI causing a dangerous warning

2022-10-13 Thread Nicholas Piggin
. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64e.S | 7 +++ arch/powerpc/kernel/exceptions-64s.S | 7 +++ arch/powerpc/kernel/interrupt.c | 12 +--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64e.S b

[PATCH 3/3] powerpc/64s: make linear_map_hash_lock a raw spinlock

2022-10-13 Thread Nicholas Piggin
This lock is taken while the raw kfence_freelist_lock is held, so it must also be a raw spinlock, as reported by lockdep when raw lock nesting checking is enabled. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_utils.c | 12 ++-- 1 file changed, 6 insertions(+), 6

[PATCH 2/3] powerpc/64s: make HPTE lock and native_tlbie_lock irq-safe

2022-10-13 Thread Nicholas Piggin
ile taking either of these locks. Don't just disable bh because several of the more common cases already disable irqs, so this just makes the locks always irq-safe. Reported-by: Guenter Roeck Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_native.c | 27 -- 1 f

[PATCH 1/3] powerpc/64s: Add lockdep for HPTE lock

2022-10-13 Thread Nicholas Piggin
Add lockdep annotation for the HPTE bit-spinlock. Modern systems don't take the tlbie lock, so this shows up some of the same lockdep warnings that were being reported by the ppc970. And they're not taken in exactly the same places so this is nice to have in its own right. Signed-off-by: Nicholas

[PATCH 3/3] powerpc: fix reschedule bug in KUAP-unlocked user copy

2022-10-13 Thread Nicholas Piggin
by generating an interrupt to reschedule the context if need_resched() got set. Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/vmx-helper.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c index

[PATCH 1/3] powerpc/64s: Disable preemption in hash lazy mmu mode

2022-10-13 Thread Nicholas Piggin
apply_to_page_range on kernel pages does not disable preemption, which is a requirement for hash's lazy mmu mode, which keeps track of the TLBs to flush with a per-cpu array. Reported-by: Guenter Roeck Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/tlbflush-hash.h | 6

[PATCH 2/3] powerpc/64s: Fix hash__change_memory_range preemption warning

2022-10-13 Thread Nicholas Piggin
. This leaves a small chance that this thread will be migrated to another CPU, so the master work would be done by a CPU from a different context. Better for test coverage to make that a common case by just having the first CPU to call in become the master. Signed-off-by: Nicholas Piggin --- arch/powerpc

[PATCH] powerpc/pseries: Fix CONFIG_DTL=n build

2022-10-13 Thread Nicholas Piggin
The recently moved dtl code must be compiled-in if CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y even if CONFIG_DTL=n. Reported-by: Guenter Roeck Fixes: 6ba5aa541aaa0 ("powerpc/pseries: Move dtl scanning and steal time accounting to pseries platform") Signed-off-by: Nicholas Piggin --- ar

[PATCH] powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context

2022-10-13 Thread Nicholas Piggin
("powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending") Signed-off-by: Nicholas Piggin --- I credit Sachin as well because he likely ran into it here, https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-March/240971.html It was much more difficult to

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-6.1-1 tag

2022-10-12 Thread Nicholas Piggin
On Thu Oct 13, 2022 at 10:21 AM AEST, Guenter Roeck wrote: > On Thu, Oct 13, 2022 at 11:03:34AM +1100, Michael Ellerman wrote: > > Guenter Roeck writes: > > > On Wed, Oct 12, 2022 at 11:20:38AM -0600, Jason A. Donenfeld wrote: > > >> > > >> I've also managed to not hit this bug a few times. When

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-6.1-1 tag

2022-10-12 Thread Nicholas Piggin
On Thu Oct 13, 2022 at 4:37 AM AEST, Jason A. Donenfeld wrote: > On Wed, Oct 12, 2022 at 10:48:26AM -0700, Guenter Roeck wrote: > > > I've also managed to not hit this bug a few times. When it triggers, > > > after "kprobes: kprobe jump-optimization is enabled. All kprobes are > > > optimized if

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-6.1-1 tag

2022-10-12 Thread Nicholas Piggin
On Thu Oct 13, 2022 at 2:43 PM AEST, Guenter Roeck wrote: > On 10/12/22 10:20, Jason A. Donenfeld wrote: > > On Wed, Oct 12, 2022 at 09:44:52AM -0700, Guenter Roeck wrote: > >> On Wed, Oct 12, 2022 at 09:49:26AM -0600, Jason A. Donenfeld wrote: > >>> On Wed, Oct 12, 2022 at 07:18:27AM -0700,

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-6.1-1 tag

2022-10-12 Thread Nicholas Piggin
On Thu Oct 13, 2022 at 10:21 AM AEST, Guenter Roeck wrote: > On Thu, Oct 13, 2022 at 11:03:34AM +1100, Michael Ellerman wrote: > > Guenter Roeck writes: > > > On Wed, Oct 12, 2022 at 11:20:38AM -0600, Jason A. Donenfeld wrote: > > >> > > >> I've also managed to not hit this bug a few times. When

[PATCH 1/2] powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs

2022-10-11 Thread Nicholas Piggin
and bisecting this and developing a trivial reproducer. The perfect bug report. Reported-by: Jason A. Donenfeld Signed-off-by: Nicholas Piggin --- Since posting the patch in the bug thread: - dropped sync_file_range2 from the ppc32 syscalls. - updated some comments on sys_ppc32.c, which now has

[PATCH 2/2] powerpc: move sync_file_range2 compat definition

2022-10-11 Thread Nicholas Piggin
sync_file_range2 is not a special unaligned-odd-pair calling convention syscall, it's just a regular one that does not have a generic compat definition. Move it out of sys_ppc32.c and into syscalls.c. Signed-off-by: Nicholas Piggin --- This one doesn't fix anything and is not required

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-6.1-1 tag

2022-10-11 Thread Nicholas Piggin
On Tue Oct 11, 2022 at 7:35 PM AEST, Michael Ellerman wrote: > "Jason A. Donenfeld" writes: > > On Tue, Oct 11, 2022 at 12:53:17PM +1100, Michael Ellerman wrote: > >> "Jason A. Donenfeld" writes: > >> > On Mon, Oct 10, 2022 at 01:25:25PM -0600, Jason A. Donenfeld wrote: > >> >> Hi Michael, > >>

Re: [PATCH linux-next][RFC] powerpc: avoid lockdep when we are offline

2022-10-09 Thread Nicholas Piggin
On Thu Sep 29, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > On Wed, Sep 28, 2022 at 10:51 AM Nicholas Piggin wrote: > > > > On Wed Sep 28, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > > > Thank Nick for reviewing my patch > > > > > > On Tue, Sep 27, 2022

Re: [PATCH] powerpc/64s: POWER10 CPU Kconfig build option

2022-10-09 Thread Nicholas Piggin
On Fri Oct 7, 2022 at 4:07 AM AEST, Christophe Leroy wrote: > > > Le 23/09/2022 à 08:23, Nicholas Piggin a écrit : > > On Fri Sep 23, 2022 at 3:46 PM AEST, Christophe Leroy wrote: > >> > >> > >> Le 23/09/2022 à 05:30, Nicholas Piggin a écrit : > >>

Re: [PATCH] powerpc/64s: POWER10 CPU Kconfig build option

2022-10-06 Thread Nicholas Piggin
On Fri Oct 7, 2022 at 9:23 AM AEST, Segher Boessenkool wrote: > On Fri, Oct 07, 2022 at 07:56:09AM +1000, Nicholas Piggin wrote: > > On Fri Oct 7, 2022 at 5:54 AM AEST, Segher Boessenkool wrote: > > > On Fri, Sep 23, 2022 at 01:30:04PM +1000, Nicholas Piggin wrote: >

Re: [PATCH] powerpc/64s: POWER10 CPU Kconfig build option

2022-10-06 Thread Nicholas Piggin
On Fri Oct 7, 2022 at 4:07 AM AEST, Christophe Leroy wrote: > > > Le 23/09/2022 à 08:23, Nicholas Piggin a écrit : > > On Fri Sep 23, 2022 at 3:46 PM AEST, Christophe Leroy wrote: > >> > >> > >> Le 23/09/2022 à 05:30, Nicholas Piggin a écrit : > >>

Re: [PATCH] powerpc/64s: POWER10 CPU Kconfig build option

2022-10-06 Thread Nicholas Piggin
On Fri Oct 7, 2022 at 5:54 AM AEST, Segher Boessenkool wrote: > Hi! > > On Fri, Sep 23, 2022 at 01:30:04PM +1000, Nicholas Piggin wrote: > > This adds basic POWER10_CPU option, which builds with -mcpu=power10. > > > +# No prefix or pcrel > > +KBUILD_CFLAGS +=

[PATCH] powerpc/64: poison __per_cpu_offset to catch use-before-init

2022-10-06 Thread Nicholas Piggin
If the boot CPU tries to access per-cpu data of other CPUs before per cpu areas are set up, it will unexpectedly use offset 0. Try to catch such accesses by poisoning the __per_cpu_offset array. Signed-off-by: Nicholas Piggin --- With the early boot machine check handler added to 64s

[PATCH] KVM: PPC: Book3S HV: Fix stack frame regs marker

2022-10-06 Thread Nicholas Piggin
The hard-coded marker is out of date now, fix it using the nice define. Fixes: 17773afdcd15 ("powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER") Reported-by: Joel Stanley Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- 1 file changed, 1

[RFC PATCH] powerpc/64: Don't recurse irq replay

2022-10-06 Thread Nicholas Piggin
Use irq_enter/irq_exit around irq replay to prevent softirqs running while interrupts are being replayed. Instead they run at the irq_exit() call where reentrancy is less problematic. A new PACA_IRQ_REPLAYING is added to prevent interrupt handlers hard-enabling EE while being replayed. --- I

[RFC PATCH] KVM: PPC: Book3S PR: Fix context tracking

2022-10-06 Thread Nicholas Piggin
that isn't tested, but it should work, modulo possible incorrect instruction relocation address when enabling IR. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/Kconfig | 2 -- arch/powerpc/kvm/book3s_exports.c| 7 +++ arch/powerpc/kvm/book3s_pr.c | 10 +- arch

[PATCH 2/2] powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN

2022-10-06 Thread Nicholas Piggin
cputime_t is no longer a type, so VIRT_CPU_ACCOUNTING_GEN does not have any affect on the type for 32-bit architectures, so there is no reason it can't be supported. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/Kconfig

[PATCH 1/2] powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support

2022-10-06 Thread Nicholas Piggin
Context tracking involves tracking user, kernel, guest switches. This enables existing context tracking code for interrupt entry on 32-bit. interrupt exit already has context tracking calls, and KVM can not be selected if CONTEXT_TRACKING_USER=y. Signed-off-by: Nicholas Piggin --- arch/powerpc

[PATCH 0/2] powerpc/32: nohz full support

2022-10-06 Thread Nicholas Piggin
On top of the previous fix to prevent KVM being selected with context tracking on 32-bit, this should be good to go. Since RFC: - Improved code sharing in interrupt.h - Minimal patch for VIRT_CPU_ACCOUNTING_GEN support Thanks, Nick Nicholas Piggin (2): powerpc/32: implement

[PATCH 4/4] powerpc/64: Fix perf profiling asynchronous interrupt handlers

2022-10-06 Thread Nicholas Piggin
]. This also tidies some of the warnings, no need to duplicate them in both should_hard_irq_enable() and do_hard_irq_enable(). Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/hw_irq.h | 41 ++- arch/powerpc/kernel/dbell.c | 2 +- arch/powerpc/kernel

[PATCH 3/4] powerpc/64e/interrupt: Prevent NMI PMI causing a dangerous warning

2022-10-06 Thread Nicholas Piggin
interrupt would hit while reporting bug, and that would cause another bug, and so on. Work around this for now just by disabling that warning on 64e, which improves stability. Make a note of what the cleaner fix would be. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64e.S | 7

[PATCH 2/4] powerpc/64s/interrupt: Perf NMI should not take normal exit path

2022-10-06 Thread Nicholas Piggin
EXCEPTION_RESTORE_REGS, so this makes perf interrupts consistent with that and seems like the best fix. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 14 +- arch/powerpc/kernel/traps.c | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff

[PATCH 1/4] KVM: PPC: BookS PR-KVM and BookE do not support context tracking

2022-10-06 Thread Nicholas Piggin
The context tracking code in PR-KVM and BookE implementations is not complete, and can cause host crashes if context tracking is enabled. Make these implementations depend on !CONTEXT_TRACKING_USER. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/Kconfig | 4 1 file changed, 4

[PATCH 0/4] powerpc: misc interrupt and context tracking fixes

2022-10-06 Thread Nicholas Piggin
These are several fixes for regressions and bugs that can crash the host. Thanks, Nick Nicholas Piggin (4): KVM: PPC: BookS PR-KVM and BookE do not support context tracking powerpc/64s/interrupt: Perf NMI should not take normal exit path powerpc/64e/interrupt: Prevent NMI PMI causing

[PATCH] powerpc: remove the last remnants of cputime_t

2022-10-06 Thread Nicholas Piggin
o_nsecs()") did that, but justdidn't remove the then-unused cputime_to_usecs(), cputime_t type, and associated remnants. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/cputime.h | 17 + arch/powerpc/kernel/time.c | 23 ++- 2 files changed,

Re: [RFC PATCH 1/3] powerpc/32: Implement HAVE_CONTEXT_TRACKING_USER support

2022-10-06 Thread Nicholas Piggin
On Tue Oct 4, 2022 at 9:32 PM AEST, Christophe Leroy wrote: > > > Le 04/10/2022 à 08:33, Nicholas Piggin a écrit : > > Context tracking involves tracking user, kernel, guest switches. This > > enables existing context tracking code for interrupt entry on 32-bit. > > KVM

Re: [RFC PATCH 0/3] powerpc/32: nohz full support

2022-10-06 Thread Nicholas Piggin
On Tue Oct 4, 2022 at 9:58 PM AEST, Christophe Leroy wrote: > > > Le 04/10/2022 à 08:33, Nicholas Piggin a écrit : > > Doesn't seem to be much more involved in adding context tracking and > > generic virt cpu accounting support for 32-bit, which is all that's > >

[PATCH] powerpc/64s/interrupt: stack backtrace fix

2022-10-04 Thread Nicholas Piggin
move early boot ILE fixup into a macro") Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index fed983cc7ee0..ec5dfc7b5517 100644 --- a/ar

[RFC PATCH 3/3] Remove HAVE_VIRT_CPU_ACCOUNTING_GEN option

2022-10-04 Thread Nicholas Piggin
ve it. Cc: linux-a...@vger.kernel.org Cc: Kevin Hilman Cc: Frederic Weisbecker Signed-off-by: Nicholas Piggin --- arch/Kconfig | 11 --- arch/arm/Kconfig | 1 - arch/csky/Kconfig | 1 - arch/loongarch/Kconfig | 1 - arch/mips/Kconfig | 1 - arch/xtensa/Kconf

[RFC PATCH 2/3] powerpc: remove the last remnants of cputime_t

2022-10-04 Thread Nicholas Piggin
cputime_t is no longer, converted to u64. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/cputime.h | 17 + arch/powerpc/kernel/time.c | 23 ++- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/arch/powerpc/include/asm

[RFC PATCH 1/3] powerpc/32: Implement HAVE_CONTEXT_TRACKING_USER support

2022-10-04 Thread Nicholas Piggin
Context tracking involves tracking user, kernel, guest switches. This enables existing context tracking code for interrupt entry on 32-bit. KVM and interrupt exit already has context tracking calls. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch/powerpc

[RFC PATCH 0/3] powerpc/32: nohz full support

2022-10-04 Thread Nicholas Piggin
if it can be tested. I assume the virt cpu accounting gen option removal is okay, but not exactly sure what to look for in terms of possible problems, so we'll see what comments that gets back. Thanks, Nick Nicholas Piggin (3): powerpc/32: Implement HAVE_CONTEXT_TRACKING_USER support powerpc

[PATCH 2/2] powerpc/64: Fix msr_check_and_set/clear MSR[EE] race

2022-10-03 Thread Nicholas Piggin
() | MSR_FP) is racy if it can be called with local irqs disabled, unless a hard_irq_disable has been done. Reported-by: Sachin Sant Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/hw_irq.h | 24 arch/powerpc/kernel/process.c | 4 ++-- 2 files changed, 26

[PATCH 1/2] powerpc/64s/interrupt: Change must-hard-mask interrupt check from BUG to WARN

2022-10-03 Thread Nicholas Piggin
This new assertion added is generally harmless and gets fixed up naturally, but it does indicate a problem with MSR manipulation somewhere. Fixes: c39fb71a54f0 ("powerpc/64s/interrupt: masked handler debug check for previous hard disable") Reported-by: Sachin Sant Signed-off-by: Nicho

Re: [RFC PATCH 2/2] powerpc: nop trap instruction after WARN_ONCE fires

2022-10-03 Thread Nicholas Piggin
On Sat Sep 24, 2022 at 2:47 AM AEST, Christophe Leroy wrote: > > > Le 23/09/2022 à 17:41, Nicholas Piggin a écrit : > > WARN_ONCE and similar are often used in frequently executed code, and > > should not crash the system. The program check interrupt caused by > > WARN_O

[PATCH] powerpc: remove orphan systbl_chk.sh

2022-09-28 Thread Nicholas Piggin
arch/powerpc/kernel/systbl_chk.sh has not been referenced since commit ab66dcc76d6a ("powerpc: generate uapi header and system call table files"). Remove it. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/systbl_chk.sh | 30 -- 1 file changed, 30

Re: [PATCH 2/2] powerpc: Reverse stack frame marker on little endian

2022-09-27 Thread Nicholas Piggin
endian, so > it always appears as "REGS", eg: > > c4733e70 52454753 |REGS| > > Signed-off-by: Michael Ellerman Both look fine to me. Acked-by: Nicholas Piggin > --- > arch/powerpc/include/asm/ptrace.h | 5 + >

Re: [PATCH linux-next][RFC] powerpc: avoid lockdep when we are offline

2022-09-27 Thread Nicholas Piggin
On Wed Sep 28, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > Thank Nick for reviewing my patch > > On Tue, Sep 27, 2022 at 12:25 PM Nicholas Piggin wrote: > > > > On Tue Sep 27, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > > > This is second version of my fix to P

Re: [PATCH linux-next][RFC] powerpc: avoid lockdep when we are offline

2022-09-26 Thread Nicholas Piggin
On Tue Sep 27, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > This is second version of my fix to PPC's "WARNING: suspicious RCU usage", > I improved my fix under Paul E. McKenney's guidance: > Link: > https://lore.kernel.org/lkml/20220914021528.15946-1-zhouzho...@gmail.com/T/ > > During the cpu

Re: [PATCH v3] powerpc/pseries/mce: Avoid instrumentation in realmode

2022-09-26 Thread Nicholas Piggin
On Mon Sep 26, 2022 at 4:18 PM AEST, Ganesh Goudar wrote: > Part of machine check error handling is done in realmode, > As of now instrumentation is not possible for any code that > runs in realmode. > When MCE is injected on KASAN enabled kernel, crash is > observed, Hence force inline or mark no

[PATCH v2 5/5] powerpc/64s/interrupt: halt early boot interrupts if paca is not set up

2022-09-26 Thread Nicholas Piggin
could be printed to console at this point in any case because even udbg is only set up after the boot paca is set, so this shouldn't be missed. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 15 +-- arch/powerpc/kernel/head_64.S| 3 +++ arch/powerpc

[PATCH v2 4/5] powerpc/64: don't set boot CPU's r13 to paca until the structure is set up

2022-09-25 Thread Nicholas Piggin
The idea is to get to the point where if r13 is non-zero, then it should contain a reasonable paca. This can be used in early boot program check and machine check handlers to avoid running off into the weeds if they hit before r13 has a paca. Signed-off-by: Nicholas Piggin --- arch/powerpc

[PATCH v2 3/5] powerpc/64: avoid using r13 in relocate

2022-09-25 Thread Nicholas Piggin
be used as another fixed reg one day. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/reloc_64.S | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S index 232e4549defe..efd52f2e7033 100644

[PATCH v2 2/5] powerpc/64s: early boot machine check handler

2022-09-25 Thread Nicholas Piggin
, and the machine check stack is temporarily set to the middle of the init task stack. This allows machine checks (e.g., due to invalid data access in real mode) to print something useful earlier in boot (as soon as udbg is set up, if CONFIG_PPC_EARLY_DEBUG=y). Signed-off-by: Nicholas Piggin --- arch

[PATCH v2 1/5] powerpc/64s/interrupt: move early boot ILE fixup into a macro

2022-09-25 Thread Nicholas Piggin
In preparation for using this sequence in machine check interrupt, move it into a macro, with a small change to make it position independent. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 100 +++ 1 file changed, 55 insertions(+), 45 deletions

<    3   4   5   6   7   8   9   10   11   12   >