[PATCH v5 04/17] powerpc/32: move MSR_PR test into EXCEPTION_PROLOG_0

2019-12-21 Thread Christophe Leroy
In order to simplify VMAP stack implementation, move MSR_PR test into EXCEPTION_PROLOG_0. This requires to not modify cr0 between EXCEPTION_PROLOG_0 and EXCEPTION_PROLOG_1. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_32.h | 4 ++-- arch/powerpc/kernel/head_8xx.S | 39 +++

[PATCH v5 03/17] powerpc/32: save DEAR/DAR before calling handle_page_fault

2019-12-21 Thread Christophe Leroy
handle_page_fault() is the only function that save DAR/DEAR itself. Save DAR/DEAR before calling handle_page_fault() to prepare for VMAP stack which will require to save even before. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/entry_32.S | 1 - arch/powerpc/kernel/head_32.S

[PATCH v5 00/17] Enable CONFIG_VMAP_STACK on PPC32

2019-12-21 Thread Christophe Leroy
The purpose of this serie is to enable CONFIG_VMAP_STACK on PPC32. rfc v1: initial support on 8xx rfc v2: added stack overflow detection. v3: - Stack overflow detection works, tested with LKDTM STACK_EXHAUST test - Support for book3s32 added v4: - Fixed build failure with CONFIG_KVM (patch 14)

[PATCH v5 02/17] powerpc/32: Add EXCEPTION_PROLOG_0 in head_32.h

2019-12-21 Thread Christophe Leroy
This patch creates a macro for the very first part of exception prolog, this will help when implementing CONFIG_VMAP_STACK Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_32.S | 4 +--- arch/powerpc/kernel/head_32.h | 9 ++--- arch/powerpc/kernel/head_8xx.S | 9 ++--- 3 fi

[PATCH v5 01/17] powerpc/32: replace MTMSRD() by mtmsr

2019-12-21 Thread Christophe Leroy
On PPC32, MTMSRD() is simply defined as mtmsr. Replace MTMSRD(reg) by mtmsr reg in files dedicated to PPC32, this makes the code less obscure. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/entry_32.S | 18 +- arch/powerpc/kernel/head_32.h | 4 ++-- 2 files changed, 1

[PATCH v5 07/17] powerpc: align stack to 2 * THREAD_SIZE with VMAP_STACK

2019-12-21 Thread Christophe Leroy
In order to ease stack overflow detection, align stack to 2 * THREAD_SIZE when using VMAP_STACK. This allows overflow detection using a single bit check. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/thread_info.h | 13 + arch/powerpc/kernel/setup_32.c | 2 +-

[PATCH v5 10/17] powerpc/8xx: Use alternative scratch registers in DTLB miss handler

2019-12-21 Thread Christophe Leroy
In preparation of handling CONFIG_VMAP_STACK, DTLB miss handler need to use different scratch registers than other exception handlers in order to not jeopardise exception entry on stack DTLB misses. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 27 ++---

[PATCH v5 08/17] powerpc/32: Add early stack overflow detection with VMAP stack.

2019-12-21 Thread Christophe Leroy
To avoid recursive faults, stack overflow detection has to be performed before writing in the stack in exception prologs. Do it by checking the alignment. If the stack pointer alignment is wrong, it means it is pointing to the following or preceding page. Without VMAP stack, a stack overflow is c

[PATCH v5 05/17] powerpc/32: add a macro to get and/or save DAR and DSISR on stack.

2019-12-21 Thread Christophe Leroy
Refactor reading and saving of DAR and DSISR in exception vectors. This will ease the implementation of VMAP stack. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_32.S | 5 + arch/powerpc/kernel/head_32.h | 11 +++ arch/powerpc/kernel/head_8xx.S | 23 +++

[PATCH v5 09/17] powerpc/32: Use vmapped stacks for interrupts

2019-12-21 Thread Christophe Leroy
In order to also catch overflows on IRQ stacks, use vmapped stacks. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 22 ++ arch/powerpc/kernel/setup_32.c | 3 +++ 2 files changed, 25 insertions(+) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/ke

[PATCH v5 06/17] powerpc/32: prepare for CONFIG_VMAP_STACK

2019-12-21 Thread Christophe Leroy
To support CONFIG_VMAP_STACK, the kernel has to activate Data MMU Translation for accessing the stack. Before doing that it must save SRR0, SRR1 and also DAR and DSISR when relevant, in order to not loose them in case there is a Data TLB Miss once the translation is reactivated. This patch adds fi

[PATCH v5 11/17] powerpc/8xx: drop exception entries for non-existing exceptions

2019-12-21 Thread Christophe Leroy
head_8xx.S has entries for all exceptions from 0x100 to 0x1f00. Several of them do not exist and are never generated by the 8xx in accordance with the documentation. Remove those entry points to make some room for future growing exception code. Signed-off-by: Christophe Leroy --- arch/powerpc/k

[PATCH v5 12/17] powerpc/8xx: move DataStoreTLBMiss perf handler

2019-12-21 Thread Christophe Leroy
Move DataStoreTLBMiss perf handler in order to cope with future growing exception prolog. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerp

[PATCH v5 13/17] powerpc/8xx: split breakpoint exception

2019-12-21 Thread Christophe Leroy
Breakpoint exception is big. Split it to support future growth on exception prolog. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/he

[PATCH v5 14/17] powerpc/8xx: Enable CONFIG_VMAP_STACK

2019-12-21 Thread Christophe Leroy
This patch enables CONFIG_VMAP_STACK. For that, a few changes are done in head_8xx.S. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 32 ++-- arch/powerpc/platforms/Kconfig.cputype | 1 + 2 files changed, 27 insertions(+), 6 deletions(-)

[PATCH v5 15/17] powerpc/32s: reorganise DSI handler.

2019-12-21 Thread Christophe Leroy
The part decidated to handling hash_page() is fully unneeded for processors not having real hash pages like the 603. Lets enlarge the content of the feature fixup, and provide an alternative which jumps directly instead of getting NIPs. Also, in preparation of VMAP stacks, the end of DSI handler

[PATCH v5 16/17] powerpc/32s: avoid crossing page boundary while changing SRR0/1.

2019-12-21 Thread Christophe Leroy
Trying VMAP_STACK with KVM, vmlinux was not starting. This was due to SRR0 and SRR1 clobbered by an ISI due to the rfi being in a different page than the mtsrr0/1: c0003fe0 : c0003fe0: 38 83 00 54 addir4,r3,84 c0003fe4: 7c 60 00 a6 mfmsr r3 c0003fe8: 70 60 00 30

[PATCH v5 17/17] powerpc/32s: Enable CONFIG_VMAP_STACK

2019-12-21 Thread Christophe Leroy
A few changes to retrieve DAR and DSISR from struct regs instead of retrieving them directly, as they may have changed due to a TLB miss. Also modifies hash_page() and friends to work with virtual data addresses instead of physical ones. Same on load_up_fpu() and load_up_altivec(). Signed-off-by:

[Bug 205283] BUG: KASAN: global-out-of-bounds in _copy_to_iter+0x3d4/0x5a8

2019-12-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205283 --- Comment #8 from Christophe Leroy (christophe.le...@c-s.fr) --- Thanks for the test. Looking once more at module_alloc() in arch/powerpc/mm/kasan/kasan_init_32.c, I think we are missing an initialisation. In module_alloc(), in the call to __

Re: [PATCH v11 00/25] mm/gup: track dma-pinned pages: FOLL_PIN

2019-12-21 Thread Leon Romanovsky
On Fri, Dec 20, 2019 at 03:54:55PM -0800, John Hubbard wrote: > On 12/20/19 10:29 AM, Leon Romanovsky wrote: > ... > >> $ ./build.sh > >> $ build/bin/run_tests.py > >> > >> If you get things that far I think Leon can get a reproduction for you > > > > I'm not so optimistic about that. > > > > OK, I

[GIT PULL] Please pull powerpc/linux.git powerpc-5.5-4 tag

2019-12-21 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull some more powerpc fixes for 5.5: The following changes since commit e42617b825f8073569da76dc4510bfa019b1c35a: Linux 5.5-rc1 (2019-12-08 14:57:55 -0800) are available in the git repository at: https://git.kernel.org/pub/

[PATCH] powerpc/mm: Mark get_slice_psize() & slice_addr_is_low() as notrace

2019-12-21 Thread Michael Ellerman
These slice routines are called from the SLB miss handler, which can lead to warnings from the IRQ code, because we have not reconciled the IRQ state properly: WARNING: CPU: 72 PID: 30150 at arch/powerpc/kernel/irq.c:258 arch_local_irq_restore.part.0+0xcc/0x100 Modules linked in: CPU: 72 PI

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.5-4 tag

2019-12-21 Thread pr-tracker-bot
The pull request you sent on Sat, 21 Dec 2019 23:04:03 +1100: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.5-4 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/6d04182dd36dc5a4dd2e352c1d0f0241e83bd2a0 Thank you! -- Deet-doot-do

[Bug 205283] BUG: KASAN: global-out-of-bounds in _copy_to_iter+0x3d4/0x5a8

2019-12-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205283 --- Comment #9 from Erhard F. (erhar...@mailbox.org) --- module_alloc() in arch/powerpc/mm/kasan/kasan_init_32.c now is: #if defined(CONFIG_MODULES) && !defined(CONFIG_KASAN_VMALLOC) void *module_alloc(unsigned long size) { void *base;

[Bug 205283] BUG: KASAN: global-out-of-bounds in _copy_to_iter+0x3d4/0x5a8

2019-12-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205283 --- Comment #10 from Christophe Leroy (christophe.le...@c-s.fr) --- So it must be something more. By the way, now that KASAN_VMALLOC exists and handle module loading better, I think we should analyse the impact of activating KASAN_VMALLOC at all t

[Bug 205099] KASAN hit at raid6_pq: BUG: Unable to handle kernel data access at 0x00f0fd0d

2019-12-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205099 --- Comment #9 from Erhard F. (erhar...@mailbox.org) --- Created attachment 286395 --> https://bugzilla.kernel.org/attachment.cgi?id=286395&action=edit dmesg (kernel 5.5-rc2+, KASAN_VMALLOC + INLINE KASAN, PowerMac G4 DP) (In reply to Christoph

[Bug 205099] KASAN hit at raid6_pq: BUG: Unable to handle kernel data access at 0x00f0fd0d

2019-12-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205099 --- Comment #10 from Erhard F. (erhar...@mailbox.org) --- Created attachment 286397 --> https://bugzilla.kernel.org/attachment.cgi?id=286397&action=edit dmesg (kernel 5.5-rc2+, KASAN_VMALLOC + OUTLINE KASAN, PowerMac G4 DP) -- You are receivin

Re: [PATCH v11 00/25] mm/gup: track dma-pinned pages: FOLL_PIN

2019-12-21 Thread John Hubbard
On 12/21/19 2:08 AM, Leon Romanovsky wrote: On Fri, Dec 20, 2019 at 03:54:55PM -0800, John Hubbard wrote: On 12/20/19 10:29 AM, Leon Romanovsky wrote: ... $ ./build.sh $ build/bin/run_tests.py If you get things that far I think Leon can get a reproduction for you I'm not so optimistic about