Re: [RFC 00/20] TLB batching consolidation and enhancements

2021-01-30 Thread Nadav Amit
> On Jan 30, 2021, at 7:30 PM, Nicholas Piggin wrote: > > Excerpts from Nadav Amit's message of January 31, 2021 10:11 am: >> From: Nadav Amit >> >> There are currently (at least?) 5 different TLB batching schemes in the >> kernel: >> >> 1. Using mmu_gather (e.g., zap_page_range()). >> >> 2.

Re: [RFC 00/20] TLB batching consolidation and enhancements

2021-01-30 Thread Nicholas Piggin
Excerpts from Nadav Amit's message of January 31, 2021 10:11 am: > From: Nadav Amit > > There are currently (at least?) 5 different TLB batching schemes in the > kernel: > > 1. Using mmu_gather (e.g., zap_page_range()). > > 2. Using {inc|dec}_tlb_flush_pending() to inform other threads on the

Re: [RFC 00/20] TLB batching consolidation and enhancements

2021-01-30 Thread Nadav Amit
> On Jan 30, 2021, at 4:39 PM, Andy Lutomirski wrote: > > On Sat, Jan 30, 2021 at 4:16 PM Nadav Amit wrote: >> From: Nadav Amit >> >> There are currently (at least?) 5 different TLB batching schemes in the >> kernel: >> >> 1. Using mmu_gather (e.g., zap_page_range()). >> >> 2. Using

Re: [RFC 00/20] TLB batching consolidation and enhancements

2021-01-30 Thread Andy Lutomirski
On Sat, Jan 30, 2021 at 4:16 PM Nadav Amit wrote: > > From: Nadav Amit > > There are currently (at least?) 5 different TLB batching schemes in the > kernel: > > 1. Using mmu_gather (e.g., zap_page_range()). > > 2. Using {inc|dec}_tlb_flush_pending() to inform other threads on the >ongoing

[RFC 11/20] mm/tlb: remove arch-specific tlb_start/end_vma()

2021-01-30 Thread Nadav Amit
From: Nadav Amit Architecture-specific tlb_start_vma() and tlb_end_vma() seem unnecessary. They are currently used for: 1. Avoid per-VMA TLB flushes. This can be determined by introducing a new config option. 2. Avoid saving information on the vma that is being flushed. Saving this

[RFC 00/20] TLB batching consolidation and enhancements

2021-01-30 Thread Nadav Amit
From: Nadav Amit There are currently (at least?) 5 different TLB batching schemes in the kernel: 1. Using mmu_gather (e.g., zap_page_range()). 2. Using {inc|dec}_tlb_flush_pending() to inform other threads on the ongoing deferred TLB flush and flushing the entire range eventually (e.g.,

[PATCH] cxl: Simplify bool conversion

2021-01-30 Thread Yang Li
Fix the following coccicheck warning: ./drivers/misc/cxl/sysfs.c:181:48-53: WARNING: conversion to bool not needed here Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/misc/cxl/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/cxl/sysfs.c

Re: [PATCH] powerpc: fix AKEBONO build failures

2021-01-30 Thread Randy Dunlap
On 1/21/21 5:14 PM, Michael Ellerman wrote: Randy Dunlap writes: On 1/20/21 1:29 PM, Yury Norov wrote: Hi all, I found the power pc build broken on today's linux-next (647060f3b592). Darn, I was building linux-5.11-rc4. I'll try linux-next after I send this. --- From: Randy Dunlap

[PATCH 1/2] powerpc/Kconfig: Fix unmet direct dependency on NET

2021-01-30 Thread Florian Fainelli
The kbuild test robot was able to generate a configuration where ETHERNET and NETDEVICES was selected by the Akenobo platform but not NET, which resulted in various build failures and these Kconfig warnings: WARNING: unmet direct dependencies detected for NETDEVICES Depends on [n]: NET [=n]

Re: [PATCH v2] tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()

2021-01-30 Thread Jarkko Sakkinen
On Fri, 2021-01-29 at 13:57 -0500, Stefan Berger wrote: > On 1/29/21 12:35 PM, Jarkko Sakkinen wrote: > > On Mon, Jan 25, 2021 at 08:47:53PM -0500, Stefan Berger wrote: > > > From: Stefan Berger > > > > > > Return error code -ETIMEDOUT rather than '0' when waiting for the > > > rtce_buf to be

Re: [PATCH] powerpc/fault: fix wrong KUAP fault for IO_URING

2021-01-30 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of January 30, 2021 9:22 pm: > Christophe Leroy writes: >> +Aneesh >> >> Le 29/01/2021 à 07:52, Zorro Lang a écrit : > .. >>> [ 96.200296] [ cut here ] >>> [ 96.200304] Bug: Read fault blocked by KUAP! >>> [ 96.200309]

Re: [PATCH] powerpc64/idle: Fix SP offsets when saving GPRs

2021-01-30 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of January 30, 2021 9:32 pm: > "Christopher M. Riedl" writes: >> The idle entry/exit code saves/restores GPRs in the stack "red zone" >> (Protected Zone according to PowerPC64 ELF ABI v2). However, the offset >> used for the first GPR is incorrect and

[PATCH v7 42/42] powerpc/64s: power4 nap fixup in C

2021-01-30 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 15 + arch/powerpc/include/asm/processor.h | 1 + arch/powerpc/include/asm/thread_info.h | 6

[PATCH v7 41/42] powerpc/64s: runlatch interrupt handling in C

2021-01-30 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 7 +++ arch/powerpc/kernel/exceptions-64s.S | 18 -- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git

[PATCH v7 40/42] powerpc/64s: move NMI soft-mask handling to C

2021-01-30 Thread Nicholas Piggin
Saving and restoring soft-mask state can now be done in C using the interrupt handler wrapper functions. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 25 arch/powerpc/kernel/exceptions-64s.S | 60 2 files changed, 25

[PATCH v7 39/42] powerpc: move NMI entry/exit code into wrapper

2021-01-30 Thread Nicholas Piggin
This moves the common NMI entry and exit code into the interrupt handler wrappers. This changes the behaviour of soft-NMI (watchdog) and HMI interrupts, and also MCE interrupts on 64e, by adding missing parts of the NMI entry to them. Signed-off-by: Nicholas Piggin ---

[PATCH v7 38/42] powerpc/64: entry cpu time accounting in C

2021-01-30 Thread Nicholas Piggin
There is no need for this to be in asm, use the new interrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 6 ++ arch/powerpc/include/asm/ppc_asm.h | 24 arch/powerpc/kernel/exceptions-64e.S | 1 -

[PATCH v7 37/42] powerpc/64: move account_stolen_time into its own function

2021-01-30 Thread Nicholas Piggin
This will be used by interrupt entry as well. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/cputime.h | 14 ++ arch/powerpc/kernel/syscall_64.c | 10 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/cputime.h

[PATCH v7 35/42] powerpc/64s: move context tracking exit to interrupt exit path

2021-01-30 Thread Nicholas Piggin
The interrupt handler wrapper functions are not the ideal place to maintain context tracking because after they return, the low level exit code must then determine if there are interrupts to replay, or if the task should be preempted, etc. Those paths (e.g., schedule_user) include their own

[PATCH v7 36/42] powerpc/64s: reconcile interrupts in C

2021-01-30 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 15 +++ arch/powerpc/kernel/exceptions-64s.S | 26 -- 2 files changed, 11 insertions(+), 30 deletions(-)

[PATCH v7 34/42] powerpc: handle irq_enter/irq_exit in interrupt handler wrappers

2021-01-30 Thread Nicholas Piggin
Move irq_enter/irq_exit into asynchronous interrupt handler wrappers. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 2 ++ arch/powerpc/kernel/dbell.c | 3 +-- arch/powerpc/kernel/irq.c| 4 arch/powerpc/kernel/tau_6xx.c| 3 ---

[PATCH v7 33/42] powerpc/64: add context tracking to asynchronous interrupts

2021-01-30 Thread Nicholas Piggin
Previously context tracking was not done for asynchronous interrupts, (those that run in interrupt context), and if those would cause a reschedule when they exit, then scheduling functions (schedule_user, preempt_schedule_irq) call exception_enter/exit to fix this up and exit user context. This

[PATCH v7 32/42] powerpc/64: context tracking move to interrupt wrappers

2021-01-30 Thread Nicholas Piggin
This moves exception_enter/exit calls to wrapper functions for synchronous interrupts. More interrupt handlers are covered by this than previously. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 9 arch/powerpc/kernel/traps.c | 74

[PATCH v7 31/42] powerpc/64s/hash: improve context tracking of hash faults

2021-01-30 Thread Nicholas Piggin
This moves the 64s/hash context tracking from hash_page_mm() to __do_hash_fault(), so it's no longer called by OCXL / SPU accelerators, which was certainly the wrong thing to be doing, because those callers are not low level interrupt handlers, so should have entered a kernel context tracking

[PATCH v7 30/42] powerpc/64: context tracking remove _TIF_NOHZ

2021-01-30 Thread Nicholas Piggin
Add context tracking to the system call handler explicitly, and remove _TIF_NOHZ. This improves system call performance when nohz_full is enabled. On a POWER9, gettid scv system call cost on a nohz_full CPU improves from 1129 cycles to 1004 cycles and on a housekeeping CPU from 550 cycles to 430

[PATCH v7 29/42] powerpc: add interrupt_cond_local_irq_enable helper

2021-01-30 Thread Nicholas Piggin
Simple helper for synchronous interrupt handlers (i.e., process-context) to enable interrupts if it was taken in an interrupts-enabled context. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 7 +++ arch/powerpc/kernel/traps.c | 24

[PATCH v7 28/42] powerpc: convert interrupt handlers to use wrappers

2021-01-30 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/asm-prototypes.h | 29 --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 - arch/powerpc/include/asm/debug.h | 3 - arch/powerpc/include/asm/hw_irq.h | 9 -- arch/powerpc/include/asm/interrupt.h

[PATCH v7 27/42] powerpc: add interrupt wrapper entry / exit stub functions

2021-01-30 Thread Nicholas Piggin
These will be used by subsequent patches. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 66 1 file changed, 66 insertions(+) diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index

[PATCH v7 26/42] powerpc: interrupt handler wrapper functions

2021-01-30 Thread Nicholas Piggin
Add wrapper functions (derived from x86 macros) for interrupt handler functions. This allows interrupt entry code to be written in C. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 169 +++ 1 file changed, 169 insertions(+) create mode 100644

[PATCH v7 25/42] powerpc: improve handling of unrecoverable system reset

2021-01-30 Thread Nicholas Piggin
If an unrecoverable system reset hits in process context, the system does not have to panic. Similar to machine check, call nmi_exit() before die(). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/traps.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[PATCH v7 24/42] powerpc/mce: ensure machine check handler always tests RI

2021-01-30 Thread Nicholas Piggin
A machine check that is handled must still check MSR[RI] for recoverability of the interrupted context. Without this patch it's possible for a handled machine check to return to a context where it has clobbered live registers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/traps.c | 2

[PATCH v7 23/42] powerpc: introduce die_mce

2021-01-30 Thread Nicholas Piggin
As explained by commit daf00ae71dad ("powerpc/traps: restore recoverability of machine_check interrupts"), die() can't be called from within nmi_enter to nicely kill a process context that was interrupted. nmi_exit must be called first. This adds a function die_mce which takes care of this for

[PATCH v7 22/42] powerpc/cell: tidy up pervasive declarations

2021-01-30 Thread Nicholas Piggin
These are declared in ras.h and defined in ras.c so remove them from pervasive.h Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/cell/pervasive.c | 1 + arch/powerpc/platforms/cell/pervasive.h | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git

[PATCH v7 21/42] powerpc: add and use unknown_async_exception

2021-01-30 Thread Nicholas Piggin
This is currently the same as unknown_exception, but it will diverge after interrupt wrappers are added and code moved out of asm into the wrappers (e.g., async handlers will check FINISH_NAP). Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/hw_irq.h| 1 +

[PATCH v7 20/42] powerpc/time: move timer_broadcast_interrupt prototype to asm/time.h

2021-01-30 Thread Nicholas Piggin
Interrupt handler prototypes are going to be rearranged in a future patch, so tidy this out of the way first. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/hw_irq.h | 1 - arch/powerpc/include/asm/time.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v7 19/42] powerpc/perf: move perf irq/nmi handling details into traps.c

2021-01-30 Thread Nicholas Piggin
This is required in order to allow more significant differences between NMI type interrupt handlers and regular asynchronous handlers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/traps.c | 31 +++- arch/powerpc/perf/core-book3s.c | 35

[PATCH v7 18/42] powerpc/traps: add NOKPROBE_SYMBOL for sreset and mce

2021-01-30 Thread Nicholas Piggin
These NMIs could fire any time including inside kprobe code, so exclude them from kprobes. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/traps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index

[PATCH v7 17/42] powerpc/64s: slb comment update

2021-01-30 Thread Nicholas Piggin
This makes a small improvement to the description of the SLB interrupt environment. Move the memory access restrictions into one paragraph, and the interrupt restrictions into the next rather than mix them. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/slb.c | 28

[PATCH v7 16/42] powerpc/mm: Remove stale do_page_fault comment referring to SLB faults

2021-01-30 Thread Nicholas Piggin
SLB faults no longer call do_page_fault, this was removed somewhere between 2.6.0 and 2.6.12. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/fault.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index

[PATCH v7 15/42] powerpc/64s: split do_hash_fault

2021-01-30 Thread Nicholas Piggin
This is required for subsequent interrupt wrapper implementation. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_utils.c | 56 --- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/mm/book3s64/hash_utils.c

[PATCH v7 14/42] powerpc/64s: move bad_page_fault handling to C

2021-01-30 Thread Nicholas Piggin
This simplifies code, and it is also useful when introducing interrupt handler wrappers when introducing wrapper functionality that doesn't cope with asm entry code calling into more than one handler function. 32-bit and 64e still have some such cases, which limits some ways they can use

[PATCH v7 13/42] powerpc: rearrange do_page_fault error case to be inside exception_enter

2021-01-30 Thread Nicholas Piggin
This keeps the context tracking over the entire interrupt handler which helps later with moving context tracking into interrupt wrappers. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/fault.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git

[PATCH v7 12/42] powerpc/64s: add do_bad_page_fault_segv handler

2021-01-30 Thread Nicholas Piggin
This function acts like an interrupt handler so it needs to follow the standard interrupt handler function signature which will be introduced in a future change. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h | 1 + arch/powerpc/kernel/exceptions-64s.S | 4 +---

[PATCH v7 11/42] powerpc: bad_page_fault get registers from regs

2021-01-30 Thread Nicholas Piggin
Similar to the previous patch this makes interrupt handler function types more regular so they can be wrapped with the next patch. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h | 4 ++-- arch/powerpc/kernel/entry_32.S | 3 +--

[PATCH v7 10/42] powerpc/32: transfer can avoid saving r4/r5 over trace call

2021-01-30 Thread Nicholas Piggin
Now that handlers get all registers from pt_regs, r4 and r5 are no longer live here and may be clobbered. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_32.S | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/entry_32.S

[PATCH v7 09/42] powerpc: DebugException remove args

2021-01-30 Thread Nicholas Piggin
Like other interrupt handler conversions, switch to getting registers from the pt_regs argument. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64e.S | 2 -- arch/powerpc/kernel/head_40x.S | 1 + arch/powerpc/kernel/head_booke.h | 2 ++ arch/powerpc/kernel/traps.c

[PATCH v7 08/42] powerpc: do_break get registers from regs

2021-01-30 Thread Nicholas Piggin
Similar to the previous patch this makes interrupt handler function types more regular so they can be wrapped with the next patch. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/debug.h | 3 +-- arch/powerpc/kernel/head_8xx.S | 5 ++--- arch/powerpc/kernel/process.c| 7

[PATCH v7 07/42] powerpc/fsl_booke/32: CacheLockingException remove args

2021-01-30 Thread Nicholas Piggin
Like other interrupt handler conversions, switch to getting registers from the pt_regs argument. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/head_fsl_booke.S | 6 +++--- arch/powerpc/kernel/traps.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git

[PATCH v7 06/42] powerpc: remove arguments from fault handler functions

2021-01-30 Thread Nicholas Piggin
Make mm fault handlers all just take the pt_regs * argument and load DAR/DSISR from that. Make those that return a value return long. This is done to make the function signatures match other handlers, which will help with a future patch to add wrappers. Explicit arguments could be added for

[PATCH v7 05/42] powerpc/64s: move the hash fault handling logic to C

2021-01-30 Thread Nicholas Piggin
The fault handling still has some complex logic particularly around hash table handling, in asm. Implement most of this in C. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 + arch/powerpc/kernel/exceptions-64s.S | 127 --

[PATCH v7 04/42] powerpc/64s: move DABR match out of handle_page_fault

2021-01-30 Thread Nicholas Piggin
Similar to the 32/s change, move the test and call to the do_break handler to the DSI. Suggested-by: Christophe Leroy Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 34 +--- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git

[PATCH v7 03/42] powerpc/32s: move DABR match out of handle_page_fault

2021-01-30 Thread Nicholas Piggin
From: Christophe Leroy handle_page_fault() has some code dedicated to book3s/32 to call do_break() when the DSI is a DABR match. On other platforms, do_break() is handled separately. Do the same for book3s/32, do it earlier in the process of DSI. This change also avoid doing the test on ISI.

[PATCH v7 02/42] KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs

2021-01-30 Thread Nicholas Piggin
Interrupts that occur in kernel mode expect that context tracking is set to kernel. Enabling local irqs before context tracking switches from guest to host means interrupts can come in and trigger warnings about wrong context, and possibly worse. Signed-off-by: Nicholas Piggin ---

[PATCH v7 01/42] powerpc/64s: interrupt exit improve bounding of interrupt recursion

2021-01-30 Thread Nicholas Piggin
When replaying pending soft-masked interrupts when an interrupt returns to an irqs-enabled context, there is a special case required if this was an asynchronous interrupt to avoid unbounded interrupt recursion. This case was not tested for in the case the asynchronous interrupt hit in user

[PATCH v7 00/42] powerpc: interrupt wrappers

2021-01-30 Thread Nicholas Piggin
This adds interrupt handler wrapper functions, similar to the generic / x86 code, and moves several common operations into them from either asm or open coded in the individual handlers. This series is based on powerpc fixes-test tree, there's another unrelated pending fix in patch 1 of the series

Re: [PATCH] powerpc64/idle: Fix SP offsets when saving GPRs

2021-01-30 Thread Michael Ellerman
"Christopher M. Riedl" writes: > The idle entry/exit code saves/restores GPRs in the stack "red zone" > (Protected Zone according to PowerPC64 ELF ABI v2). However, the offset > used for the first GPR is incorrect and overwrites the back chain - the > Protected Zone actually starts below the

Re: [PATCH] powerpc/fault: fix wrong KUAP fault for IO_URING

2021-01-30 Thread Michael Ellerman
Christophe Leroy writes: > +Aneesh > > Le 29/01/2021 à 07:52, Zorro Lang a écrit : .. >> [ 96.200296] [ cut here ] >> [ 96.200304] Bug: Read fault blocked by KUAP! >> [ 96.200309] WARNING: CPU: 3 PID: 1876 at arch/powerpc/mm/fault.c:229 >>