[5.0.0-next-20190306] [powerpc] kernel BUG at mm/page_alloc.c:3124 while running stress

2019-03-07 Thread Sachin Sant
While running stress test from avocado-misc-test against next-20190306 (SHA: cf08baa296) on a POWER9 LPAR ran into following kernel bug followed by panic. next-20190305 was good. (1/1) avocado-misc-tests/perf/stress.py:Stress.test: [ 947.743425] request_module: kmod_concurrent_max (0) close t

[PATCH] powerpc/highmem: change BUG_ON() to WARN_ON()

2019-03-07 Thread Christophe Leroy
In arch/powerpc/mm/highmem.c, BUG_ON() is called only when CONFIG_DEBUG_HIGHMEM is selected, this means the BUG_ON() is not vital and can be replaced by a a WARN_ON At the sametime, use IS_ENABLED() instead of #ifdef to clean a bit. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/highmem.c

Re: [PATCH v2 5/7] counter: add FlexTimer Module Quadrature decoder counter driver

2019-03-07 Thread William Breathitt Gray
On Wed, Mar 06, 2019 at 12:12:06PM +0100, Patrick Havelange wrote: > This driver exposes the counter for the quadrature decoder of the > FlexTimer Module, present in the LS1021A soc. > > Signed-off-by: Patrick Havelange > --- > Changes v2 > - Rebased on new counter subsystem > - Cleaned up incl

Re: [PATCH v2 6/7] counter: ftm-quaddec: Documentation: Add specific counter sysfs documentation

2019-03-07 Thread William Breathitt Gray
On Wed, Mar 06, 2019 at 12:12:07PM +0100, Patrick Havelange wrote: > This adds documentation for the specific prescaler entry. > > Signed-off-by: Patrick Havelange > --- > Changes v2 > - Add doc for prescaler entry > --- > .../ABI/testing/sysfs-bus-counter-ftm-quaddec| 16 >

Re: [PATCH v2 0/7] FlexTimer Module Quadrature decoder counter

2019-03-07 Thread William Breathitt Gray
On Wed, Mar 06, 2019 at 12:12:01PM +0100, Patrick Havelange wrote: > This patch serie is to be applied on top of > https://patchwork.kernel.org/project/linux-iio/list/?series=147 > (a more recent version of the serie is available here : > https://gitlab.com/vilhelmgray/iio/tree/generic_counter_v1

[GIT PULL] Please pull powerpc/linux.git powerpc-5.1-1 tag

2019-03-07 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Linus, Please pull powerpc updates for 5.1. Stephen reported a couple of conflicts with the dma & swiotlb trees due to Christoph's DMA series, but you haven't merged those trees yet so I'm not seeing them when I test merge. They were both fairly t

[PATCH v6 0/4] Fix free/allocation of runtime gigantic pages

2019-03-07 Thread Alexandre Ghiti
This series fixes sh and sparc that did not advertise their gigantic page support and then were not able to allocate and free those pages at runtime. It renames MEMORY_ISOLATION && COMPACTION || CMA condition into the more accurate CONTIG_ALLOC, since it allows the definition of alloc_contig_range

[PATCH v6 1/4] sh: Advertise gigantic page support

2019-03-07 Thread Alexandre Ghiti
sh actually supports gigantic pages and selecting ARCH_HAS_GIGANTIC_PAGE allows it to allocate and free gigantic pages at runtime. At least sdk7786_defconfig exposes such a configuration with huge pages of 64MB, pages of 4KB and MAX_ORDER = 11: HPAGE_SHIFT (26) - PAGE_SHIFT (12) = 14 >= MAX_ORDER

[PATCH v6 2/4] sparc: Advertise gigantic page support

2019-03-07 Thread Alexandre Ghiti
sparc actually supports gigantic pages and selecting ARCH_HAS_GIGANTIC_PAGE allows it to allocate and free gigantic pages at runtime. sparc allows configuration such as huge pages of 16GB, pages of 8KB and MAX_ORDER = 13 (default): HPAGE_SHIFT (34) - PAGE_SHIFT (13) = 21 >= MAX_ORDER (13) Signed-

[PATCH v6 3/4] mm: Simplify MEMORY_ISOLATION && COMPACTION || CMA into CONTIG_ALLOC

2019-03-07 Thread Alexandre Ghiti
This condition allows to define alloc_contig_range, so simplify it into a more accurate naming. Suggested-by: Vlastimil Babka Signed-off-by: Alexandre Ghiti Acked-by: Vlastimil Babka --- arch/arm64/Kconfig | 2 +- arch/powerpc/platforms/Kconfig.cputype | 2 +- arch/s390/Kco

[PATCH v6 4/4] hugetlb: allow to free gigantic pages regardless of the configuration

2019-03-07 Thread Alexandre Ghiti
On systems without CONTIG_ALLOC activated but that support gigantic pages, boottime reserved gigantic pages can not be freed at all. This patch simply enables the possibility to hand back those pages to memory allocator. Signed-off-by: Alexandre Ghiti Acked-by: David S. Miller [sparc] --- arch/

Re: [PATCH v2 03/10] powerpc/6xx: Store PGDIR physical address in a SPRG

2019-03-07 Thread Guenter Roeck
Hi, On Thu, Feb 21, 2019 at 10:37:55AM +, Christophe Leroy wrote: > Use SPRN_SPRG2 to store the current thread PGDIR and > avoid reading thread_struct.pgdir at every TLB miss. > This patch causes a number of silent (no crash) qemu boot stalls in -next. See https://kerneltests.org/builders/qem

[PATCH v2] powerpc: silence unused-but-set-variable warnings

2019-03-07 Thread Qian Cai
pte_unmap() compiles away on some powerpc platforms, so silence the warnings below by making it a static inline function. mm/memory.c: In function 'copy_pte_range': mm/memory.c:820:24: warning: variable 'orig_dst_pte' set but not used [-Wunused-but-set-variable] mm/memory.c:820:9: warning: variabl

[PATCH] powerpc/mm: move warning from resize_hpt_for_hotplug()

2019-03-07 Thread Laurent Vivier
resize_hpt_for_hotplug() reports a warning when it cannot resize the hash page table ("Unable to resize hash page table to target order") but in some cases it's not a problem and can make user thinks something has not worked properly. This patch moves the warning to arch_remove_memory() to only re

Re: [PATCH v2 03/10] powerpc/6xx: Store PGDIR physical address in a SPRG

2019-03-07 Thread Christophe Leroy
Hi, On 03/07/2019 02:11 PM, Guenter Roeck wrote: Hi, On Thu, Feb 21, 2019 at 10:37:55AM +, Christophe Leroy wrote: Use SPRN_SPRG2 to store the current thread PGDIR and avoid reading thread_struct.pgdir at every TLB miss. This patch causes a number of silent (no crash) qemu boot stalls in

Re: [PATCH v2 03/10] powerpc/6xx: Store PGDIR physical address in a SPRG

2019-03-07 Thread Guenter Roeck
On Thu, Mar 07, 2019 at 06:14:09PM +, Christophe Leroy wrote: > Hi, > > On 03/07/2019 02:11 PM, Guenter Roeck wrote: > >Hi, > > > >On Thu, Feb 21, 2019 at 10:37:55AM +, Christophe Leroy wrote: > >>Use SPRN_SPRG2 to store the current thread PGDIR and > >>avoid reading thread_struct.pgdir at

Re: [PATCH v2 03/10] powerpc/6xx: Store PGDIR physical address in a SPRG

2019-03-07 Thread Christophe Leroy
Le 07/03/2019 à 20:07, Guenter Roeck a écrit : On Thu, Mar 07, 2019 at 06:14:09PM +, Christophe Leroy wrote: Hi, On 03/07/2019 02:11 PM, Guenter Roeck wrote: Hi, On Thu, Feb 21, 2019 at 10:37:55AM +, Christophe Leroy wrote: Use SPRN_SPRG2 to store the current thread PGDIR and avoi

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

2019-03-07 Thread pr-tracker-bot
The pull request you sent on Fri, 08 Mar 2019 00:12:51 +1100: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.1-1 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/6c3ac1134371b51c9601171af2c32153ccb11100 Thank you! -- Deet-doot-do

Re: [PATCH] powerpc/mm: move warning from resize_hpt_for_hotplug()

2019-03-07 Thread David Gibson
On Thu, Mar 07, 2019 at 03:50:50PM +0100, Laurent Vivier wrote: > resize_hpt_for_hotplug() reports a warning when it cannot > resize the hash page table ("Unable to resize hash page > table to target order") but in some cases it's not a problem > and can make user thinks something has not worked pr

[PATCH v5 01/10] powerpc/powernv/idle: Restore IAMR after idle

2019-03-07 Thread Michael Ellerman
From: Russell Currey Without restoring the IAMR after idle, execution prevention on POWER9 with Radix MMU is overwritten and the kernel can freely execute userspace without faulting. This is necessary when returning from any stop state that modifies user state, as well as hypervisor state. To t

[PATCH v5 02/10] powerpc/powernv/idle: Restore AMR/UAMOR/AMOR after idle

2019-03-07 Thread Michael Ellerman
In order to implement KUAP (Kernel Userspace Access Protection) on Power9 we will be using the AMR, and therefore indirectly the UAMOR/AMOR. So save/restore these regs in the idle code. Signed-off-by: Michael Ellerman --- v5: Unchanged. v4: New. arch/powerpc/kernel/idle_book3s.S | 27 +

[PATCH v5 03/10] powerpc: Add framework for Kernel Userspace Protection

2019-03-07 Thread Michael Ellerman
From: Christophe Leroy This patch adds a skeleton for Kernel Userspace Protection functionnalities like Kernel Userspace Access Protection and Kernel Userspace Execution Prevention The subsequent implementation of KUAP for radix makes use of a MMU feature in order to patch out assembly when KUAP

[PATCH v5 04/10] powerpc: Add skeleton for Kernel Userspace Execution Prevention

2019-03-07 Thread Michael Ellerman
From: Christophe Leroy This patch adds a skeleton for Kernel Userspace Execution Prevention. Then subarches implementing it have to define CONFIG_PPC_HAVE_KUEP and provide setup_kuep() function. Signed-off-by: Christophe Leroy [mpe: Don't split strings, use pr_crit_ratelimited()] Signed-off-by

[PATCH v5 05/10] powerpc: Add a framework for Kernel Userspace Access Protection

2019-03-07 Thread Michael Ellerman
From: Christophe Leroy This patch implements a framework for Kernel Userspace Access Protection. Then subarches will have the possibility to provide their own implementation by providing setup_kuap() and allow/prevent_user_access(). Some platforms will need to know the area accessed and whether

[PATCH v5 06/10] powerpc/64: Setup KUP on secondary CPUs

2019-03-07 Thread Michael Ellerman
From: Russell Currey Some platforms (i.e. Radix MMU) need per-CPU initialisation for KUP. Any platforms that only want to do KUP initialisation once globally can just check to see if they're running on the boot CPU, or check if whatever setup they need has already been performed. Note that this

[PATCH v5 07/10] powerpc/mm/radix: Use KUEP API for Radix MMU

2019-03-07 Thread Michael Ellerman
From: Russell Currey Execution protection already exists on radix, this just refactors the radix init to provide the KUEP setup function instead. Thus, the only functional change is that it can now be disabled. Signed-off-by: Russell Currey Signed-off-by: Michael Ellerman --- v5: Unchanged.

[PATCH v5 08/10] powerpc/lib: Refactor __patch_instruction() to use __put_user_asm()

2019-03-07 Thread Michael Ellerman
From: Russell Currey __patch_instruction() is called in early boot, and uses __put_user_size(), which includes the allow/prevent calls to enforce KUAP, which could either be called too early, or in the Radix case, forced to use "early_" versions of functions just to safely handle this one case.

[PATCH v5 09/10] powerpc/64s: Implement KUAP for Radix MMU

2019-03-07 Thread Michael Ellerman
From: Russell Currey Kernel Userspace Access Prevention utilises a feature of the Radix MMU which disallows read and write access to userspace addresses. By utilising this, the kernel is prevented from accessing user data from outside of trusted paths that perform proper safety checks, such as co

[PATCH v5 10/10] powerpc/mm: Detect bad KUAP faults

2019-03-07 Thread Michael Ellerman
When KUAP is enabled we have logic to detect page faults that occur outside of a valid user access region and are blocked by the AMR. What we don't have at the moment is logic to detect a fault *within* a valid user access region, that has been incorrectly blocked by AMR. This is not meant to ever

Re: [PATCH v9 02/11] powerpc: prepare string/mem functions for KASAN

2019-03-07 Thread Daniel Axtens
Christophe Leroy writes: > Le 04/03/2019 à 06:26, Daniel Axtens a écrit : >> Hi Christophe, >>> diff --git a/arch/powerpc/include/asm/kasan.h >>> b/arch/powerpc/include/asm/kasan.h >>> new file mode 100644 >>> index ..c3161b8fc017 >>> --- /dev/null >>> +++ b/arch/powerpc/include/asm/

Re: [PATCH v9 02/11] powerpc: prepare string/mem functions for KASAN

2019-03-07 Thread Daniel Axtens
>>> +#ifdef CONFIG_KASAN >>> +#define _GLOBAL_KASAN(fn) .weak fn ; _GLOBAL(__##fn) ; _GLOBAL(fn) >>> +#define _GLOBAL_TOC_KASAN(fn) .weak fn ; _GLOBAL_TOC(__##fn) ; >>> _GLOBAL_TOC(fn) >>> +#define EXPORT_SYMBOL_KASAN(fn)EXPORT_SYMBOL(__##fn) ; >>> EXPORT_SYMBOL(fn) >> >> I'm having so

[PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32

2019-03-07 Thread Christophe Leroy
Not only the 603 but all 6xx need SPRN_PGDIR to be initialised at startup. This patch move it from __setup_cpu_603() to start_here() and __secondary_start(), close to the initialisation of SPRN_THREAD. Previously, virt addr of PGDIR was retrieved from thread struct. Now that it is the phys addr wh

Re: [PATCH v2] powerpc: silence unused-but-set-variable warnings

2019-03-07 Thread Christophe Leroy
Le 07/03/2019 à 15:40, Qian Cai a écrit : pte_unmap() compiles away on some powerpc platforms, so silence the warnings below by making it a static inline function. mm/memory.c: In function 'copy_pte_range': mm/memory.c:820:24: warning: variable 'orig_dst_pte' set but not used [-Wunused-but-se