[PATCH v2 2/2] powerpc/64s: Add cp_abort after tlbiel to invalidate copy-buffer address

2020-09-15 Thread Nicholas Piggin
-off-by: Nicholas Piggin --- v2: - Untangle headers that were causing build failures. - Improve the comment a bit. - Exempt POWER9 from the workaround, as described by the comment (we worked this out already but I forgot about it when doing v1!) arch/powerpc/include/asm/synch.h | 19

[PATCH v2 1/2] powerpc: untangle cputable mce include

2020-09-15 Thread Nicholas Piggin
Having cputable.h include mce.h means it pulls in a bunch of low level headers (e.g., synch.h) which then can't use CPU_FTR_ definitions. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/cputable.h | 5 - arch/powerpc/kernel/cputable.c | 1 + arch/powerpc/kernel

Re: Injecting SLB miltihit crashes kernel 5.9.0-rc5

2020-09-15 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of September 15, 2020 10:54 pm: > Michal Suchánek writes: >> Hello, >> >> Using the SLB mutihit injection test module (which I did not write so I >> do not want to post it here) to verify updates on my 5.3 frankernekernel >> I found that the kernel crashes

[PATCH] powerpc/64s: move the last of the page fault handling logic to C

2020-09-15 Thread Nicholas Piggin
The page fault handling still has some complex logic particularly around hash table handling, in asm. Implement this in C instead. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h| 1 + arch/powerpc/kernel/exceptions-64s.S | 131 +- arch

[PATCH 6/6] powerpc/64: irq replay remove decrementer overflow check

2020-09-15 Thread Nicholas Piggin
overhead. Perhaps more importantly it allows the clunky MSR[EE] vs PACA_IRQ_HARD_DIS incoherency to be removed. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/irq.c | 50 +-- 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/arch/powerpc

[PATCH 5/6] powerpc/64: make restore_interrupts 64e only

2020-09-15 Thread Nicholas Piggin
This is not used by 64s. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/irq.c | 37 +++-- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index b725509f9073..631e6d236c97 100644

[PATCH 4/6] powerpc/64e: remove 64s specific interrupt soft-mask code

2020-09-15 Thread Nicholas Piggin
Since the assembly soft-masking code was moved to 64e specific, there are some 64s specific interrupt types still there. Remove them. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64e.S | 10 -- arch/powerpc/kernel/irq.c| 2 +- 2 files changed, 1

[PATCH 3/6] powerpc/64e: remove PACA_IRQ_EE_EDGE

2020-09-15 Thread Nicholas Piggin
This is not used anywhere. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/hw_irq.h| 5 ++--- arch/powerpc/kernel/exceptions-64e.S | 1 - arch/powerpc/kernel/irq.c| 23 --- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/arch

[PATCH 1/6] powerpc/64: fix irq replay missing preempt

2020-09-15 Thread Nicholas Piggin
ble around the interrupt replay and final irq enable will reschedule if needed. Fixes: 3282a3da25bd ("powerpc/64: Implement soft interrupt replay in C") Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/irq.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc

[PATCH 2/6] powerpc/64: fix irq replay pt_regs->softe value

2020-09-15 Thread Nicholas Piggin
s handlers should not be testing if irqs were disabled, but it might be possible for example some code is shared with synchronous or NMI handlers, and it makes more sense if debug output looks at this. Fixes: 3282a3da25bd ("powerpc/64: Implement soft interrupt replay in C") Signed-off

Re: [PATCH v2 3/4] sparc64: remove mm_cpumask clearing to fix kthread_use_mm race

2020-09-14 Thread Nicholas Piggin
Excerpts from David Miller's message of September 15, 2020 5:59 am: > From: Nicholas Piggin > Date: Mon, 14 Sep 2020 14:52:18 +1000 > > ... >> The basic fix for sparc64 is to remove its mm_cpumask clearing code. The >> optimisation could be effectively restored by se

Re: [PATCH v2 3/4] sparc64: remove mm_cpumask clearing to fix kthread_use_mm race

2020-09-14 Thread Nicholas Piggin
Excerpts from Anatoly Pugachev's message of September 14, 2020 8:23 pm: > On Mon, Sep 14, 2020 at 10:00 AM Nicholas Piggin wrote: >> >> Excerpts from Nicholas Piggin's message of September 14, 2020 2:52 pm: >> >> [...] >> >> > The basic fix for sparc64

Re: [PATCH v2 1/4] mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race

2020-09-14 Thread Nicholas Piggin
Excerpts from pet...@infradead.org's message of September 14, 2020 8:56 pm: > On Mon, Sep 14, 2020 at 02:52:16PM +1000, Nicholas Piggin wrote: >> Reading and modifying current->mm and current->active_mm and switching >> mm should be done with irqs off, to prevent races s

Re: [PATCH v2 3/4] sparc64: remove mm_cpumask clearing to fix kthread_use_mm race

2020-09-14 Thread Nicholas Piggin
openbios isn't populating an SMP device tree, which blows up everywhere. The patch is _relatively_ simple, hopefully it shouldn't explode, so it's probably ready for testing on real SMP hardware, if someone has a few cycles. Thanks, Nick > > Signed-off-by: Nicholas Piggin > --- > arch

[PATCH v2 4/4] powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm

2020-09-13 Thread Nicholas Piggin
TLB invalidate") and ARCH_WANT_IRQS_OFF_ACTIVATE_MM to disable irqs over mm switch sequences. Reviewed-by: Michael Ellerman Depends-on: 38cf307c1f20 ("mm: fix kthread_use_mm() vs TLB invalidate") Fixes: 0cef77c7798a7 ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask") S

[PATCH v2 3/4] sparc64: remove mm_cpumask clearing to fix kthread_use_mm race

2020-09-13 Thread Nicholas Piggin
mask clearing code. The optimisation could be effectively restored by sending IPIs to mm_cpumask members and having them remove themselves from mm_cpumask. This is more tricky so I leave it as an exercise for someone with a sparc64 SMP. powerpc has a (currently similarly broken) example. Signed-off-by: Nichol

[PATCH v2 2/4] powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM

2020-09-13 Thread Nicholas Piggin
powerpc uses IPIs in some situations to switch a kernel thread away from a lazy tlb mm, which is subject to the TLB flushing race described in the changelog introducing ARCH_WANT_IRQS_OFF_ACTIVATE_MM. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 1 + arch/powerpc

[PATCH v2 1/4] mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race

2020-09-13 Thread Nicholas Piggin
lb preempt race, and provide an arch option to extend that to activate_mm which allows architectures doing IPI based TLB shootdowns to close the second race. This is a bit ugly, but in the interest of fixing the bug and backporting before all architectures are converted this is a compromise. Signed-off-

[PATCH v2 0/4] more mm switching vs TLB shootdown and lazy tlb fixes

2020-09-13 Thread Nicholas Piggin
. Thanks, Nick Since v1: - Updates from Michael Ellerman's review comments. Nicholas Piggin (4): mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM sparc64: remove mm_cpumask clearing to fix kthread_use_mm race powerpc/64s

Re: [PATCH] spi: fsl-espi: Only process interrupts for expected events

2020-09-13 Thread Nicholas Piggin
Excerpts from Chris Packham's message of September 14, 2020 8:03 am: > Hi All, > > On 4/09/20 12:28 pm, Chris Packham wrote: >> The SPIE register contains counts for the TX FIFO so any time the irq >> handler was invoked we would attempt to process the RX/TX fifos. Use the >> SPIM value to mask

Re: [PATCH v1 4/5] powerpc/fault: Avoid heavy search_exception_tables() verification

2020-09-13 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 9, 2020 4:20 pm: > > > Le 09/09/2020 à 08:04, Aneesh Kumar K.V a écrit : >> Christophe Leroy writes: >> >>> search_exception_tables() is an heavy operation, we have to avoid it. >>> When KUAP is selected, we'll know the fault has been

Re: [PATCH v1 5/5] powerpc/fault: Perform exception fixup in do_page_fault()

2020-09-08 Thread Nicholas Piggin
re with comments. The first call in do_hash_fault is not required (copy user will never be in nmi context). The second one and the one in slb_fault could be made explicit too. Anyway for now this is fine. Thanks, Nick Reviewed-by: Nicholas Piggin > > Signed-off-by: Christophe Leroy > --- &g

Re: [PATCH v1 4/5] powerpc/fault: Avoid heavy search_exception_tables() verification

2020-09-08 Thread Nicholas Piggin
and no fault was generated. > > Signed-off-by: Christophe Leroy Sorry I missed reviewing this. Yes, we discussed this and decided that it's not effective I think (and KUAP solves it properly). Reviewed-by: Nicholas Piggin > --- > arch/powerpc/mm/fault.c | 20 +

Re: [PATCH v1 3/5] powerpc/fault: Reorder tests in bad_kernel_fault()

2020-09-08 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of August 7, 2020 3:15 am: > Check address earlier to simplify the following test. Good logic reduction. Reviewed-by: Nicholas Piggin > Signed-off-by: Christophe Leroy > --- > arch/powerpc/mm/fault.c | 10 +- > 1 file change

Re: [PATCH v1 2/5] powerpc/fault: Unnest definition of page_fault_is_write() and page_fault_is_bad()

2020-09-08 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of August 7, 2020 3:15 am: > To make it more readable, separate page_fault_is_write() and > page_fault_is_bad() > to avoir several levels of #ifdefs Reviewed-by: Nicholas Piggin > Signed-off-by: Christophe Leroy > --- > arch/powe

Re: [PATCH v1 1/5] powerpc/mm: sanity_check_fault() should work for all, not only BOOK3S

2020-09-08 Thread Nicholas Piggin
e it may not be an exploit kernel reference but a buggy pointer underflow? In that case -1 doesn't seem like it would catch very much. Would it be better to test for high bit set for example ((long)address < 0) ? Anyway for your patch Reviewed-by: Nicholas Piggin > + > /* >

Re: [RFC PATCH 02/12] powerpc: remove arguments from interrupt handler functions

2020-09-08 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 7, 2020 9:34 pm: > On Mon, 2020-09-07 at 11:20 +0200, Christophe Leroy wrote: >> >> Le 05/09/2020 à 19:43, Nicholas Piggin a écrit : >> > Make interrupt handlers all just take the pt_regs * argument and load >> &

Re: [RFC PATCH 02/12] powerpc: remove arguments from interrupt handler functions

2020-09-08 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 7, 2020 7:20 pm: > > > Le 05/09/2020 à 19:43, Nicholas Piggin a écrit : >> Make interrupt handlers all just take the pt_regs * argument and load >> DAR/DSISR etc from that. Make those that return a value ret

Re: KVM on POWER8 host lock up since 10d91611f426 ("powerpc/64s: Reimplement book3s idle code in C")

2020-09-07 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of August 31, 2020 8:50 pm: > Michal Suchánek writes: >> On Mon, Aug 31, 2020 at 11:14:18AM +1000, Nicholas Piggin wrote: >>> Excerpts from Michal Suchánek's message of August 31, 2020 6:11 am: >>> > Hello, >>> >

Re: [RFC PATCH 12/12] powerpc/64s: power4 nap fixup in C

2020-09-07 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 7, 2020 2:48 pm: > > > Le 07/09/2020 à 06:02, Nicholas Piggin a écrit : >> Excerpts from Christophe Leroy's message of September 6, 2020 5:32 pm: >>> >>> >>> Le 05/09/2020 à 19:43, Nicho

Re: [RFC PATCH 12/12] powerpc/64s: power4 nap fixup in C

2020-09-06 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 6, 2020 5:32 pm: > > > Le 05/09/2020 à 19:43, Nicholas Piggin a écrit : >> There is no need for this to be in asm, use the new intrrupt entry wrapper. >> >> Signed-off-by: Nicholas Piggin >> --- >>

[RFC PATCH 12/12] powerpc/64s: power4 nap fixup in C

2020-09-05 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 | 14 arch/powerpc/include/asm/processor.h | 1 + arch/powerpc/include/asm/thread_info.h | 6 arch/powerpc/kernel/exceptions

[RFC PATCH 11/12] powerpc/64s: runlatch interrupt handling in C

2020-09-05 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 | 16 ++-- arch/powerpc/kernel/exceptions-64s.S | 18 -- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git

[RFC PATCH 10/12] powerpc/64s: move NMI soft-mask handling to C

2020-09-05 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

[RFC PATCH 09/12] powerpc: move NMI entry/exit code into wrapper

2020-09-05 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 --- arch/powerpc/include/asm

[RFC PATCH 08/12] powerpc/64: entry cpu time accounting in C

2020-09-05 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 | 4 arch/powerpc/include/asm/ppc_asm.h | 24 arch/powerpc/kernel/exceptions-64e.S | 1 - arch/powerpc/kernel

[RFC PATCH 07/12] powerpc/64: move account_stolen_time into its own function

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

[RFC PATCH 06/12] powerpc/64s: reconcile interrupts in C

2020-09-05 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 | 4 arch/powerpc/kernel/exceptions-64s.S | 26 -- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git

[RFC PATCH 05/12] powerpc/64s: Do context tracking in interrupt entry wrapper

2020-09-05 Thread Nicholas Piggin
exit in C before enabling it. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/interrupt.h | 23 + arch/powerpc/kernel/ptrace/ptrace.c | 4 -- arch/powerpc/kernel/signal.c | 4 -- arch/powerpc/kernel/syscall_64.c

[RFC PATCH 04/12] powerpc: add interrupt_cond_local_irq_enable helper

2020-09-05 Thread Nicholas Piggin
Simple helper for synchronous interrupt handlers to use to enable interrupts if they were taken in interrupt-enabled context. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 7 +++ arch/powerpc/kernel/traps.c | 24 +++- arch/powerpc/mm

[RFC PATCH 03/12] powerpc: interrupt handler wrapper functions

2020-09-05 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/asm-prototypes.h | 28 --- arch/powerpc/include/asm/bug.h| 1 - arch/powerpc/include

[RFC PATCH 02/12] powerpc: remove arguments from interrupt handler functions

2020-09-05 Thread Nicholas Piggin
for performance in future but that would require more complex wrapper macros. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/asm-prototypes.h | 4 ++-- arch/powerpc/include/asm/bug.h| 4 ++-- arch/powerpc/kernel/exceptions-64e.S | 2 -- arch/powerpc/kernel/exceptions

[RFC PATCH 01/12] powerpc/64s: move the last of the page fault handling logic to C

2020-09-05 Thread Nicholas Piggin
The page fault handling still has some complex logic particularly around hash table handling, in asm. Implement this in C instead. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h| 1 + arch/powerpc/kernel/exceptions-64s.S | 131 +- arch

[RFC PATCH 00/12] interrupt entry wrappers

2020-09-05 Thread Nicholas Piggin
This series moves more stuff to C, and fixes context tracking on 64s. Nicholas Piggin (12): powerpc/64s: move the last of the page fault handling logic to C powerpc: remove arguments from interrupt handler functions powerpc: interrupt handler wrapper functions powerpc: add

Re: [PATCH 4/4] powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm

2020-09-02 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of September 1, 2020 10:00 pm: > Nicholas Piggin writes: >> Commit 0cef77c7798a7 ("powerpc/64s/radix: flush remote CPUs out of >> single-threaded mm_cpumask") added a mechanism to trim the mm_cpumask of >> a proces

[PATCH v3 16/23] powerpc: use asm-generic/mmu_context.h for no-op implementations

2020-09-01 Thread Nicholas Piggin
Cc: linuxppc-dev@lists.ozlabs.org Acked-by: Michael Ellerman (powerpc) Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/mmu_context.h | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm

Re: fsl_espi errors on v5.7.15

2020-09-01 Thread Nicholas Piggin
Excerpts from Chris Packham's message of September 1, 2020 11:25 am: > > On 1/09/20 12:33 am, Heiner Kallweit wrote: >> On 30.08.2020 23:59, Chris Packham wrote: >>> On 31/08/20 9:41 am, Heiner Kallweit wrote: >>>> On 30.08.2020 23:00, Chris Packham wrote: >

Re: [PATCH 1/4] mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race

2020-08-30 Thread Nicholas Piggin
Excerpts from pet...@infradead.org's message of August 28, 2020 9:15 pm: > On Fri, Aug 28, 2020 at 08:00:19PM +1000, Nicholas Piggin wrote: > >> Closing this race only requires interrupts to be disabled while ->mm >> and ->active_mm are being switched, but the TLB problem

Re: KVM on POWER8 host lock up since 10d91611f426 ("powerpc/64s: Reimplement book3s idle code in C")

2020-08-30 Thread Nicholas Piggin
Excerpts from Michal Suchánek's message of August 31, 2020 6:11 am: > Hello, > > on POWER8 KVM hosts lock up since commit 10d91611f426 ("powerpc/64s: > Reimplement book3s idle code in C"). > > The symptom is host locking up completely after some hours of KVM > workload with messages like > >

Re: fsl_espi errors on v5.7.15

2020-08-30 Thread Nicholas Piggin
Excerpts from Chris Packham's message of August 28, 2020 8:07 am: > On 27/08/20 7:12 pm, Nicholas Piggin wrote: >> Excerpts from Heiner Kallweit's message of August 26, 2020 4:38 pm: >>> On 26.08.2020 08:07, Chris Packham wrote: >>>> On 26/08/20 1:48 pm, Chris Packh

[PATCH 4/4] powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm

2020-08-28 Thread Nicholas Piggin
IRQS_OFF_ACTIVATE_MM to be enabled. Fixes: 0cef77c7798a7 ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask") Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/tlb.h | 13 - arch/powerpc/mm/book3s64/radix_tlb.c | 23 ---

[PATCH 3/4] sparc64: remove mm_cpumask clearing to fix kthread_use_mm race

2020-08-28 Thread Nicholas Piggin
mask clearing code. The optimisation could be effectively restored by sending IPIs to mm_cpumask members and having them remove themselves from mm_cpumask. This is more tricky so I leave it as an exercise for someone with a sparc64 SMP. powerpc has a (currently similarly broken) example. Cc: sparcli...@vger

[PATCH 2/4] powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM

2020-08-28 Thread Nicholas Piggin
powerpc uses IPIs in some situations to switch a kernel thread away from a lazy tlb mm, which is subject to the TLB flushing race described in the changelog introducing ARCH_WANT_IRQS_OFF_ACTIVATE_MM. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 1 + arch/powerpc

[PATCH 1/4] mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race

2020-08-28 Thread Nicholas Piggin
lb preempt race, and provide an arch option to extend that to activate_mm which allows architectures doing IPI based TLB shootdowns to close the second race. This is a bit ugly, but in the interest of fixing the bug and backporting before all architectures are converted this is a compromise. Signed-off-

[PATCH 0/4] more mm switching vs TLB shootdown and lazy tlb

2020-08-28 Thread Nicholas Piggin
which can't do their entire activation with irqs disabled. I'd like some feedback on the sparc/powerpc vs kthread_use_mm problem too. Thanks, Nick Nicholas Piggin (4): mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM

Re: fsl_espi errors on v5.7.15

2020-08-27 Thread Nicholas Piggin
Excerpts from Heiner Kallweit's message of August 26, 2020 4:38 pm: > On 26.08.2020 08:07, Chris Packham wrote: >> >> On 26/08/20 1:48 pm, Chris Packham wrote: >>> >>> On 26/08/20 10:22 am, Chris Packham wrote: On 25/08/20 7:22 pm, Heiner Kallweit wrote: > I've been staring at

[PATCH v2 16/23] powerpc: use asm-generic/mmu_context.h for no-op implementations

2020-08-26 Thread Nicholas Piggin
Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/mmu_context.h | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm

[PATCH v7 12/12] powerpc/64s/radix: Enable huge vmalloc mappings

2020-08-25 Thread Nicholas Piggin
Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ arch/powerpc/Kconfig| 1 + 2 files changed, 3 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation

[PATCH v7 11/12] mm/vmalloc: Hugepage vmalloc mappings

2020-08-25 Thread Nicholas Piggin
ces CPU cycles by 0.54%. This can result in more internal fragmentation and memory overhead for a given allocation, an option nohugevmalloc is added to disable at boot. Signed-off-by: Nicholas Piggin --- arch/Kconfig| 4 + include/linux/vmalloc.h | 1 + mm/page_alloc.c |

[PATCH v7 10/12] mm/vmalloc: add vmap_range_noflush variant

2020-08-25 Thread Nicholas Piggin
As a side-effect, the order of flush_cache_vmap() and arch_sync_kernel_mappings() calls are switched, but that now matches the other callers in this file. Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mm

[PATCH v7 09/12] mm: Move vmap_range from mm/ioremap.c to mm/vmalloc.c

2020-08-25 Thread Nicholas Piggin
This is a generic kernel virtual memory mapper, not specific to ioremap. Signed-off-by: Nicholas Piggin --- include/linux/vmalloc.h | 3 + mm/ioremap.c| 197 mm/vmalloc.c| 196 +++ 3 files

[PATCH v7 08/12] x86: inline huge vmap supported functions

2020-08-25 Thread Nicholas Piggin
This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x...@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Nicholas Piggin --- Ack or

[PATCH v7 07/12] arm64: inline huge vmap supported functions

2020-08-25 Thread Nicholas Piggin
This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Nicholas Piggin --- Ack or objection if this goes via the -mm tree

[PATCH v7 06/12] powerpc: inline huge vmap supported functions

2020-08-25 Thread Nicholas Piggin
This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- Ack or objection if this goes via the -mm tree? arch/powerpc/include/asm/vmalloc.h

[PATCH v7 05/12] mm: HUGE_VMAP arch support cleanup

2020-08-25 Thread Nicholas Piggin
Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x...@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Nicholas Piggin --- Ack or objection from arch maintainers if this goes via the -mm tree? arch/arm64/include/asm/vmalloc.h | 8 +++ arch/arm6

[PATCH v7 04/12] mm/ioremap: rename ioremap_*_range to vmap_*_range

2020-08-25 Thread Nicholas Piggin
This will be used as a generic kernel virtual mapping function, so re-name it in preparation. Signed-off-by: Nicholas Piggin --- mm/ioremap.c | 64 +++- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/mm/ioremap.c b/mm/ioremap.c

[PATCH v7 03/12] mm/vmalloc: rename vmap_*_range vmap_pages_*_range

2020-08-25 Thread Nicholas Piggin
The vmalloc mapper operates on a struct page * array rather than a linear physical address, re-name it to make this distinction clear. Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c

[PATCH v7 02/12] mm: apply_to_pte_range warn and fail if a large pte is encountered

2020-08-25 Thread Nicholas Piggin
apply_to_pte_range might mistake a large pte for bad, or treat it as a page table, resulting in a crash or corruption. Add a test to warn and return error if large entries are found. Signed-off-by: Nicholas Piggin --- mm/memory.c | 60 +++-- 1

[PATCH v7 01/12] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings

2020-08-25 Thread Nicholas Piggin
pings") Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index b482d240f9a2..4e9b21adc73d 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -36,7 +36,7 @@

[PATCH v7 00/12] huge vmalloc mappings

2020-08-25 Thread Nicholas Piggin
compile errors and warnings - Keep the page array and accounting in small page units because struct vm_struct is an interface (this should fix x86 vmap stack debug assert). [Thanks Zefan] Nicholas Piggin (12): mm/vmalloc: fix vmalloc_to_page for huge vmap mappings mm: apply_to_pte_range

[PATCH] powerpc/pseries: add new branch prediction security bits for link stack

2020-08-25 Thread Nicholas Piggin
The hypervisor interface has defined branch prediction security bits for handling the link stack. Wire them up. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/hvcall.h | 2 ++ arch/powerpc/platforms/pseries/setup.c | 6 ++ 2 files changed, 8 insertions(+) diff --git

[PATCH] powerpc/64s: handle ISA v3.1 local copy-paste context switches

2020-08-25 Thread Nicholas Piggin
memory does not work on POWER10. Do the cp_abort unconditionally there. KVM must also cp_abort on guest exit to prevent copy buffer state leaking between contexts. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/process.c | 16 +--- arch/powerpc/kvm/book3s_hv.c

[PATCH] powerpc/64s: Add cp_abort after tlbiel to invalidate copy-buffer address

2020-08-25 Thread Nicholas Piggin
-off-by: Nicholas Piggin --- arch/powerpc/include/asm/synch.h | 13 + arch/powerpc/mm/book3s64/hash_native.c | 8 arch/powerpc/mm/book3s64/radix_tlb.c | 12 ++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/synch.h

[PATCH] powerpc/64s: scv entry should set PPR

2020-08-25 Thread Nicholas Piggin
Kernel entry sets PPR to HMT_MEDIUM by convention. The scv entry path missed this. Fixes: 7fa95f9adaee ("powerpc/64s: system call support for scv/rfscv instructions") Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_64.S | 4 1 file changed, 4 insertions(+) diff --

Re: [mm] 8e63b8bbd7: WARNING:at_mm/memory.c:#__apply_to_page_range

2020-08-22 Thread Nicholas Piggin
is encountered") > url: > https://github.com/0day-ci/linux/commits/Nicholas-Piggin/huge-vmalloc-mappings/20200821-124543 > base: https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git next > > in testcase: boot > > on test machine: qemu-system-x86_64 -enable-kv

Re: [PATCH v6 05/12] mm: HUGE_VMAP arch support cleanup

2020-08-21 Thread Nicholas Piggin
Excerpts from Andrew Morton's message of August 22, 2020 6:14 am: > On Sat, 22 Aug 2020 01:12:09 +1000 Nicholas Piggin wrote: > >> This changes the awkward approach where architectures provide init >> functions to determine which levels they can provide large mappings fo

Re: [PATCH v6 01/12] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings

2020-08-21 Thread Nicholas Piggin
Excerpts from Andrew Morton's message of August 22, 2020 6:07 am: > On Sat, 22 Aug 2020 01:12:05 +1000 Nicholas Piggin wrote: > >> vmalloc_to_page returns NULL for addresses mapped by larger pages[*]. >> Whether or not a vmap is huge depends on the architecture details, &

Re: [PATCH v6 11/12] mm/vmalloc: Hugepage vmalloc mappings

2020-08-21 Thread Nicholas Piggin
Excerpts from Eric Dumazet's message of August 22, 2020 1:38 am: > > On 8/21/20 8:12 AM, Nicholas Piggin wrote: >> Support huge page vmalloc mappings. Config option HAVE_ARCH_HUGE_VMALLOC >> enables support on architectures that define HAVE_ARCH_HUGE_VMAP and >> supports

[PATCH v6 12/12] powerpc/64s/radix: Enable huge vmalloc mappings

2020-08-21 Thread Nicholas Piggin
Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ arch/powerpc/Kconfig| 1 + 2 files changed, 3 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation

[PATCH v6 11/12] mm/vmalloc: Hugepage vmalloc mappings

2020-08-21 Thread Nicholas Piggin
ces CPU cycles by 0.54%. This can result in more internal fragmentation and memory overhead for a given allocation, an option nohugevmalloc is added to disable at boot. Signed-off-by: Nicholas Piggin --- arch/Kconfig| 4 + include/linux/vmalloc.h | 1 + mm/page_alloc.c |

[PATCH v6 10/12] mm/vmalloc: add vmap_range_noflush variant

2020-08-21 Thread Nicholas Piggin
As a side-effect, the order of flush_cache_vmap() and arch_sync_kernel_mappings() calls are switched, but that now matches the other callers in this file. Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mm

[PATCH v6 09/12] mm: Move vmap_range from mm/ioremap.c to mm/vmalloc.c

2020-08-21 Thread Nicholas Piggin
This is a generic kernel virtual memory mapper, not specific to ioremap. Signed-off-by: Nicholas Piggin --- include/linux/vmalloc.h | 3 + mm/ioremap.c| 197 mm/vmalloc.c| 196 +++ 3 files

[PATCH v6 08/12] x86: inline huge vmap supported functions

2020-08-21 Thread Nicholas Piggin
This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x...@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Nicholas Piggin --- arch/x86/i

[PATCH v6 07/12] arm64: inline huge vmap supported functions

2020-08-21 Thread Nicholas Piggin
This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Nicholas Piggin --- arch/arm64/include/asm/vmalloc.h | 23

[PATCH v6 06/12] powerpc: inline huge vmap supported functions

2020-08-21 Thread Nicholas Piggin
This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/vmalloc.h | 19 --- arch/powerpc/mm/book3s64

[PATCH v6 05/12] mm: HUGE_VMAP arch support cleanup

2020-08-21 Thread Nicholas Piggin
Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x...@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Nicholas Piggin --- arch/arm64/include/asm/vmalloc.h | 8 +++ arch/arm64/mm/mmu.c | 10 +-- arch/powerpc/include/asm/vmalloc.h | 8

[PATCH v6 04/12] mm/ioremap: rename ioremap_*_range to vmap_*_range

2020-08-21 Thread Nicholas Piggin
This will be used as a generic kernel virtual mapping function, so re-name it in preparation. Signed-off-by: Nicholas Piggin --- mm/ioremap.c | 64 +++- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/mm/ioremap.c b/mm/ioremap.c

[PATCH v6 03/12] mm/vmalloc: rename vmap_*_range vmap_pages_*_range

2020-08-21 Thread Nicholas Piggin
The vmalloc mapper operates on a struct page * array rather than a linear physical address, re-name it to make this distinction clear. Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c

[PATCH v6 02/12] mm: apply_to_pte_range warn and fail if a large pte is encountered

2020-08-21 Thread Nicholas Piggin
Currently this might mistake a large pte for bad, or treat it as a page table, resulting in a crash or corruption. Signed-off-by: Nicholas Piggin --- mm/memory.c | 60 +++-- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/mm

[PATCH v6 01/12] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings

2020-08-21 Thread Nicholas Piggin
pings") Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index b482d240f9a2..4e9b21adc73d 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -36,7 +36,7 @@

[PATCH v6 00/12] huge vmalloc mappings

2020-08-21 Thread Nicholas Piggin
is an interface (this should fix x86 vmap stack debug assert). [Thanks Zefan] Nicholas Piggin (12): mm/vmalloc: fix vmalloc_to_page for huge vmap mappings mm: apply_to_pte_range warn and fail if a large pte is encountered mm/vmalloc: rename vmap_*_range vmap_pages_*_range lib/ioremap: rename

Re: [PATCH v5 0/8] huge vmalloc mappings

2020-08-21 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of August 21, 2020 3:47 pm: > > > Le 21/08/2020 à 06:44, Nicholas Piggin a écrit : >> I made this powerpc-only for the time being. It shouldn't be too hard to >> add support for other archs that define HUGE_VMAP. I have booted x86 >

Re: [PATCH v5 5/8] mm: HUGE_VMAP arch support cleanup

2020-08-21 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of August 21, 2020 3:40 pm: > > > Le 21/08/2020 à 06:44, Nicholas Piggin a écrit : >> This changes the awkward approach where architectures provide init >> functions to determine which levels they can provide large mappings for, >

Re: [PATCH 2/2] powerpc/64s: Disallow PROT_SAO in LPARs by default

2020-08-21 Thread Nicholas Piggin
is should be okay. Could you also update the selftest to skip if we have PPC_FEATURE2_ARCH_3_1 set? Thanks, Nick Acked-by: Nicholas Piggin > > Signed-off-by: Shawn Anastasio > --- > arch/powerpc/Kconfig| 12 > arch/powerpc/include/asm/mman.h | 9 +++-

[PATCH v5 8/8] mm/vmalloc: Hugepage vmalloc mappings

2020-08-20 Thread Nicholas Piggin
loc is added to disable at boot. Signed-off-by: Nicholas Piggin --- .../admin-guide/kernel-parameters.txt | 2 + arch/Kconfig | 4 + arch/powerpc/Kconfig | 1 + include/linux/vmalloc.h | 1 + mm/page_allo

[PATCH v5 7/8] mm/vmalloc: add vmap_range_noflush variant

2020-08-20 Thread Nicholas Piggin
As a side-effect, the order of flush_cache_vmap() and arch_sync_kernel_mappings() calls are switched, but that now matches the other callers in this file. Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mm

[PATCH v5 6/8] mm: Move vmap_range from lib/ioremap.c to mm/vmalloc.c

2020-08-20 Thread Nicholas Piggin
This is a generic kernel virtual memory mapper, not specific to ioremap. Signed-off-by: Nicholas Piggin --- include/linux/vmalloc.h | 2 + mm/ioremap.c| 192 mm/vmalloc.c| 191 +++ 3 files

[PATCH v5 5/8] mm: HUGE_VMAP arch support cleanup

2020-08-20 Thread Nicholas Piggin
. This also adds a prot argument to the arch query. This is unused currently but could help with some architectures (e.g., some powerpc processors can't map uncacheable memory with large pages). Signed-off-by: Nicholas Piggin --- arch/arm64/mm/mmu.c | 12 +-- arch/powerpc/mm/book3s64

[PATCH v5 4/8] lib/ioremap: rename ioremap_*_range to vmap_*_range

2020-08-20 Thread Nicholas Piggin
This will be moved to mm/ and used as a generic kernel virtual mapping function, so re-name it in preparation. Signed-off-by: Nicholas Piggin --- mm/ioremap.c | 55 ++-- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/mm/ioremap.c

[PATCH v5 3/8] mm/vmalloc: rename vmap_*_range vmap_pages_*_range

2020-08-20 Thread Nicholas Piggin
The vmalloc mapper operates on a struct page * array rather than a linear physical address, re-name it to make this distinction clear. Signed-off-by: Nicholas Piggin --- mm/vmalloc.c | 28 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/mm/vmalloc.c

  1   2   3   4   5   6   7   8   9   10   >