[PATCH v5 2/8] mm: apply_to_pte_range warn and fail if a large pte is encountered

2020-08-20 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- mm/memory.c | 60 +++-- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index f95edbb77326..19986af291e0 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2261,13 +2261,20 @@

[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

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

2020-08-20 Thread Nicholas Piggin
On platforms that define HAVE_ARCH_HUGE_VMAP and support PMD vmaps, vmalloc will attempt to allocate PMD-sized pages first, before falling back to small pages. Allocations which use something other than PAGE_KERNEL protections are not permitted to use huge pages yet, not all callers expect this

[powerpc:fixes-test] BUILD SUCCESS 90a9b102eddf6a3f987d15f4454e26a2532c1c98

2020-08-20 Thread kernel test robot
allyesconfig powerpc allmodconfig powerpc allnoconfig powerpc defconfig i386 randconfig-a002-20200820 i386 randconfig-a004-20200820 i386 randconfig-a005

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

2020-08-20 Thread Shawn Anastasio
Since migration of guests using SAO to ISA 3.1 hosts may cause issues, disable PROT_SAO in LPARs by default and introduce a new Kconfig option PPC_PROT_SAO_LPAR to allow users to enable it if desired. Signed-off-by: Shawn Anastasio --- arch/powerpc/Kconfig| 12

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

2020-08-20 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:44:22PM +1000, Nicholas Piggin wrote: > 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 >

Re: [PATCH v2 00/13] mm/debug_vm_pgtable fixes

2020-08-20 Thread Anshuman Khandual
On 08/21/2020 09:03 AM, Anshuman Khandual wrote: > > > On 08/19/2020 07:15 PM, Aneesh Kumar K.V wrote: >> "Aneesh Kumar K.V" writes: >> >>> This patch series includes fixes for debug_vm_pgtable test code so that >>> they follow page table updates rules correctly. The first two patches >>>

[PATCH v5 1/8] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings

2020-08-20 Thread Nicholas Piggin
vmalloc_to_page returns NULL for addresses mapped by larger pages[*]. Whether or not a vmap is huge depends on the architecture details, alignments, boot options, etc., which the caller can not be expected to know. Therefore HUGE_VMAP is a regression for vmalloc_to_page. This change teaches

[PATCH v5 0/8] huge vmalloc mappings

2020-08-20 Thread Nicholas Piggin
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 with it enabled, just may not have audited everything. Hi Andrew, would you care to put this in your tree? Thanks, Nick Since v4: - Fixed an

[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 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

[powerpc:merge] BUILD SUCCESS 7c25bda14d66718f9fa428808dae289dd84f1da3

2020-08-20 Thread kernel test robot
allyesconfig powerpc allmodconfig powerpc allnoconfig powerpc defconfig i386 randconfig-a002-20200820 i386 randconfig-a004-20200820 i386 randconfig-a005-20200820 i386

[PATCH 0/2] Reintroduce PROT_SAO

2020-08-20 Thread Shawn Anastasio
This set re-introduces the PROT_SAO prot flag removed in Commit 5c9fa16e8abd ("powerpc/64s: Remove PROT_SAO support"). To address concerns regarding live migration of guests using SAO to P10 hosts without SAO support, the flag is disabled by default in LPARs. A new config option,

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

2020-08-20 Thread Christophe Leroy
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, to one where the arch is queried for each call. This removes code and indirection, and allows

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

2020-08-20 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:44:25PM +1000, Nicholas Piggin wrote: > This is a generic kernel virtual memory mapper, not specific to ioremap. lib/ioremap doesn't exist any more. > > Signed-off-by: Nicholas Piggin > --- > include/linux/vmalloc.h | 2 + > mm/ioremap.c| 192

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

2020-08-20 Thread Christoph Hellwig
> static int vmap_try_huge_pmd(pmd_t *pmd, unsigned long addr, unsigned long > end, > - phys_addr_t phys_addr, pgprot_t prot) > + phys_addr_t phys_addr, pgprot_t prot, unsigned int > max_page_shift) > { ... and here.

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

2020-08-20 Thread Christophe Leroy
Le 21/08/2020 à 06:44, Nicholas Piggin a écrit : 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|

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

2020-08-20 Thread Christophe Leroy
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 with it enabled, just may not have audited everything. I like this series, but if I understand

Re: [PATCH] powerpc/powernv/pci: Fix typo when releasing DMA resources

2020-08-20 Thread Michael Ellerman
On Wed, 19 Aug 2020 15:07:41 +0200, Frederic Barrat wrote: > Fix typo introduced during recent code cleanup, which could lead to > silently not freeing resources or oops message (on PCI hotplug or CAPI > reset). > Only impacts ioda2, the code path for ioda1 is correct. Applied to powerpc/fixes.

Re: [PATCH v2 07/13] mm/debug_vm_pgtable/set_pte/pmd/pud: Don't use set_*_at to update an existing pte entry

2020-08-20 Thread Christophe Leroy
Le 19/08/2020 à 15:01, Aneesh Kumar K.V a écrit : set_pte_at() should not be used to set a pte entry at locations that already holds a valid pte entry. Architectures like ppc64 don't do TLB invalidate in set_pte_at() and hence expect it to be used to set locations that are not a valid PTE.

[PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero

2020-08-20 Thread Guohua Zhong
When cat /proc/pid/stat, do_task_stat will call into cputime_adjust, which call stack is like this: [17179954.674326]BookE Watchdog detected hard LOCKUP on cpu 0 [17179954.674331]dCPU: 0 PID: 1262 Comm: TICK Tainted: PW O4.4.176 #1 [17179954.674339]dtask: dc9d7040 task.stack:

Re: [PATCH v2] powerpc/pseries: Do not initiate shutdown when system is running on UPS

2020-08-20 Thread Michael Ellerman
On Thu, 20 Aug 2020 11:48:44 +0530, Vasant Hegde wrote: > As per PAPR we have to look for both EPOW sensor value and event modifier to > identify type of event and take appropriate action. > > Sensor value = 3 (EPOW_SYSTEM_SHUTDOWN) schedule system to be shutdown after > OS

Re: [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero

2020-08-20 Thread Christophe Leroy
Le 20/08/2020 à 15:10, Guohua Zhong a écrit : When cat /proc/pid/stat, do_task_stat will call into cputime_adjust, which call stack is like this: [17179954.674326]BookE Watchdog detected hard LOCKUP on cpu 0 [17179954.674331]dCPU: 0 PID: 1262 Comm: TICK Tainted: PW O4.4.176 #1

Re: [PATCH] powerpc/perf: Account for interrupts during PMC overflow for an invalid SIAR check

2020-08-20 Thread Michael Ellerman
On Thu, 6 Aug 2020 08:46:32 -0400, Athira Rajeev wrote: > Performance monitor interrupt handler checks if any counter has overflown > and calls `record_and_restart` in core-book3s which invokes > `perf_event_overflow` to record the sample information. > Apart from creating sample,

Re: [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero

2020-08-20 Thread Christophe Leroy
Le 20/08/2020 à 15:10, Guohua Zhong a écrit : When cat /proc/pid/stat, do_task_stat will call into cputime_adjust, which call stack is like this: [17179954.674326]BookE Watchdog detected hard LOCKUP on cpu 0 [17179954.674331]dCPU: 0 PID: 1262 Comm: TICK Tainted: PW O4.4.176 #1

Re: [PATCH v2 3/4] powerpc/memhotplug: Make lmb size 64bit

2020-08-20 Thread Nathan Lynch
"Aneesh Kumar K.V" writes: > @@ -322,12 +322,16 @@ static int pseries_remove_mem_node(struct device_node > *np) > /* >* Find the base address and size of the memblock >*/ > - regs = of_get_property(np, "reg", NULL); > - if (!regs) > + prop = of_get_property(np,

Re: [PATCH v2 1/4] powerpc/drmem: Make lmb_size 64 bit

2020-08-20 Thread Nathan Lynch
"Aneesh Kumar K.V" writes: > Similar to commit 89c140bbaeee ("pseries: Fix 64 bit logical memory block > panic") > make sure different variables tracking lmb_size are updated to be 64 bit. > > This was found by code audit. > > Cc: sta...@vger.kernel.org > Signed-off-by: Aneesh Kumar K.V > --- >

Re: [PATCH] powerpc/powernv/pci: Fix typo when releasing DMA resources

2020-08-20 Thread Frederic Barrat
Le 20/08/2020 à 06:18, Michael Ellerman a écrit : I changed the subject to: powerpc/powernv/pci: Fix possible crash when releasing DMA resources Much better, thanks! Fred

[RFT][PATCH 1/7] powerpc/iommu: Avoid overflow at boundary_size

2020-08-20 Thread Nicolin Chen
The boundary_size might be as large as ULONG_MAX, which means that a device has no specific boundary limit. So either "+ 1" or passing it to ALIGN() would potentially overflow. According to kernel defines: #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define ALIGN(x, a)

Re: [PATCH v2 00/13] mm/debug_vm_pgtable fixes

2020-08-20 Thread Anshuman Khandual
On 08/19/2020 07:15 PM, Aneesh Kumar K.V wrote: > "Aneesh Kumar K.V" writes: > >> This patch series includes fixes for debug_vm_pgtable test code so that >> they follow page table updates rules correctly. The first two patches >> introduce >> changes w.r.t ppc64. The patches are included in

[RFT][PATCH 0/7] Avoid overflow at boundary_size

2020-08-20 Thread Nicolin Chen
We are expending the default DMA segmentation boundary to its possible maximum value (ULONG_MAX) to indicate that a device doesn't specify a boundary limit. So all dma_get_seg_boundary callers should take a precaution with the return values since it would easily get overflowed. I scanned the

Re: [PATCH net-next v2 0/4] refactoring of ibmvnic code

2020-08-20 Thread David Miller
From: Lijun Pan Date: Wed, 19 Aug 2020 17:52:22 -0500 > This patch series refactor reset_init and init functions, > and make some other cosmetic changes to make the code > easier to read and debug. v2 removes __func__ and v1's 1/5. Series applied, thank you.

Re: [PATCH v2 3/6] powerpc/32s: Only leave NX unset on segments used for modules

2020-08-20 Thread Andreas Schwab
On Jun 29 2020, Christophe Leroy wrote: > Instead of leaving NX unset on all segments above the start > of vmalloc space, only leave NX unset on segments used for > modules. I'm getting this crash: kernel tried to execute exec-protected page (f294b000) - exploit attempt (uid: 0) BUG: Unable to

[PATCH] tty: hvcs: Don't NULL tty->driver_data until hvcs_cleanup()

2020-08-20 Thread Tyrel Datwyler
The code currently NULLs tty->driver_data in hvcs_close() with the intent of informing the next call to hvcs_open() that device needs to be reconfigured. However, when hvcs_cleanup() is called we copy hvcsd from tty->driver_data which was previoulsy NULLed by hvcs_close() and our call to

[PATCH v2] powerpc/pseries: Do not initiate shutdown when system is running on UPS

2020-08-20 Thread Vasant Hegde
As per PAPR we have to look for both EPOW sensor value and event modifier to identify type of event and take appropriate action. Sensor value = 3 (EPOW_SYSTEM_SHUTDOWN) schedule system to be shutdown after OS defined delay (default 10 mins). EPOW Event Modifier for sensor value

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

2020-08-20 Thread Nicholas Piggin
This changes the awkward approach where architectures provide init functions to determine which levels they can provide large mappings for, to one where the arch is queried for each call. This removes code and indirection, and allows constant-folding of dead code for unsupported levels. This

[PATCH 1/2] Revert "powerpc/64s: Remove PROT_SAO support"

2020-08-20 Thread Shawn Anastasio
This reverts commit 5c9fa16e8abd342ce04dc830c1ebb2a03abf6c05. Since PROT_SAO can still be useful for certain classes of software, reintroduce it. Concerns about guest migration for LPARs using SAO will be addressed next. Signed-off-by: Shawn Anastasio ---

Re: [PATCH v2 3/6] powerpc/32s: Only leave NX unset on segments used for modules

2020-08-20 Thread Christophe Leroy
Le 21/08/2020 à 00:00, Andreas Schwab a écrit : On Jun 29 2020, Christophe Leroy wrote: Instead of leaving NX unset on all segments above the start of vmalloc space, only leave NX unset on segments used for modules. I'm getting this crash: kernel tried to execute exec-protected page

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

2020-08-20 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:44:23PM +1000, Nicholas Piggin wrote: > 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 ++-- >

Re: [PATCH] kernel/watchdog: fix warning -Wunused-variable for watchdog_allowed_mask in ppc64

2020-08-20 Thread Petr Mladek
On Fri 2020-08-14 19:03:30, Balamuruhan S wrote: > In ppc64 config if `CONFIG_SOFTLOCKUP_DETECTOR` is not set then it > warns for unused declaration of `watchdog_allowed_mask` while building, > move the declaration inside ifdef later in the code. > > ``` > kernel/watchdog.c:47:23: warning:

Re: [PATCH v2] powerpc/pseries: Do not initiate shutdown when system is running on UPS

2020-08-20 Thread Michael Ellerman
Vasant Hegde writes: > As per PAPR we have to look for both EPOW sensor value and event modifier to > identify type of event and take appropriate action. > > Sensor value = 3 (EPOW_SYSTEM_SHUTDOWN) schedule system to be shutdown after > OS defined delay (default 10 mins). > >