RE: [PATCH v7 1/1] memory_hotplug: Add a bounds check to __add_pages

2019-10-02 Thread Alastair D'Silva
> struct vmem_altmap *altmap = restrictions->altmap; > > > > > > + err = check_hotplug_memory_addressable(pfn, nr_pages); > > > + if (err) > > > + return err; > > > + > > > if (altmap) { > > > /* > > >

[PATCH v7 0/1] Add bounds check for Hotplugged memory

2019-09-30 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog

[PATCH v7 1/1] memory_hotplug: Add a bounds check to __add_pages

2019-09-30 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

[PATCH v6 1/1] memory_hotplug: Add a bounds check to __add_pages

2019-09-29 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

[PATCH v6 0/1] Add bounds check for Hotplugged memory

2019-09-29 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog

Re: [PATCH v5 1/1] memory_hotplug: Add a bounds check to __add_pages

2019-09-29 Thread Alastair D'Silva
On Mon, 2019-09-30 at 12:21 +1000, Alastair D'Silva wrote: > From: Alastair D'Silva > > On PowerPC, the address ranges allocated to OpenCAPI LPC memory > are allocated from firmware. These address ranges may be higher > than what older kernels permit, as we increased

[PATCH v5 0/1] Add bounds check for Hotplugged memory

2019-09-29 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog

[PATCH v5 1/1] memory_hotplug: Add a bounds check to __add_pages

2019-09-29 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

RE: [PATCH v4 5/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-09-26 Thread Alastair D'Silva
On Fri, 2019-09-27 at 08:37 +0200, Mark Marshall wrote: > Comment below... > > On Thu, 26 Sep 2019 at 12:18, Alastair D'Silva > wrote: > > From: Alastair D'Silva > > > > When presented with large amounts of memory being hotplugged > > (in my test

RE: [PATCH v4] memory_hotplug: Add a bounds check to __add_pages

2019-09-26 Thread Alastair D'Silva
On Thu, 2019-09-26 at 09:46 +0200, David Hildenbrand wrote: > On 26.09.19 09:43, Michal Hocko wrote: > > On Thu 26-09-19 09:12:50, David Hildenbrand wrote: > > > On 26.09.19 03:34, Alastair D'Silva wrote: > > > > From: Alastair D'Silva > > > >

Re: [PATCH v4] memory_hotplug: Add a bounds check to __add_pages

2019-09-26 Thread Alastair D'Silva
On Thu, 2019-09-26 at 09:53 +0200, Oscar Salvador wrote: > On Thu, Sep 26, 2019 at 11:34:05AM +1000, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > On PowerPC, the address ranges allocated to OpenCAPI LPC memory > > are allocated from firmwar

[PATCH v4 6/6] powerpc: Don't flush caches when adding memory

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva This operation takes a significant amount of time when hotplugging large amounts of memory (~50 seconds with 890GB of persistent memory). This was orignally in commit fb5924fddf9e ("powerpc/mm: Flush cache on memory hot(un)plug") to support memtrace, but t

[PATCH v4 5/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva When presented with large amounts of memory being hotplugged (in my test case, ~890GB), the call to flush_dcache_range takes a while (~50 seconds), triggering RCU stalls. This patch breaks up the call into 1GB chunks, calling cond_resched() inbetween to allo

[PATCH v4 3/6] powerpc: define helpers to get L1 icache sizes

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva This patch adds helpers to retrieve icache sizes, and renames the existing helpers to make it clear that they are for dcache. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 29 +++ arch/powerpc/i

[PATCH v4 2/6] powerpc: Allow 64bit VDSO __kernel_sync_dicache to work across ranges >4GB

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva When calling __kernel_sync_dicache with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signe

[PATCH v4 4/6] powerpc: Convert flush_icache_range & friends to C

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva Similar to commit 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") this patch converts the following ASM symbols to C: flush_icache_range() __flush_dcache_icache() __flush_dcache_icache_phys() This was done as we di

[PATCH v4 1/6] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva When calling flush_icache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signed-off-by:

[PATCH v4 0/6] powerpc: convert cache asm to C

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva This series addresses a few issues discovered in how we flush caches: 1. Flushes were truncated at 4GB, so larger flushes were incorrect. 2. Flushing the dcache in arch_add_memory was unnecessary This series also converts much of the cache assembler to C, with the a

Re: [PATCH 4/5] ocxl: Add functions to map/unmap LPC memory

2019-09-25 Thread Alastair D'Silva
t; +/** > > + * Map the LPC system & special purpose memory for an AFU > > + * > > + * Do not call this during device discovery, as there may me > > multiple > > + * devices on a link, and the memory is mapped for the whole link, > > not > > + * just one

[PATCH v4 0/1] Add bounds check for Hotplugged memory

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog

[PATCH v4] memory_hotplug: Add a bounds check to __add_pages

2019-09-25 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

Re: [PATCH v3 1/2] memory_hotplug: Add a bounds check to check_hotplug_memory_range()

2019-09-23 Thread Alastair D'Silva
On Mon, 2019-09-23 at 14:25 +0200, Michal Hocko wrote: > On Tue 17-09-19 11:07:47, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > On PowerPC, the address ranges allocated to OpenCAPI LPC memory > > are allocated from firmware. These address ran

Re: [PATCH 3/5] ocxl: Tally up the LPC memory on a link & allow it to be mapped

2019-09-18 Thread Alastair D'Silva
On Wed, 2019-09-18 at 16:02 +0200, Frederic Barrat wrote: > > Le 17/09/2019 à 03:42, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > Tally up the LPC memory on an OpenCAPI link & allow it to be mapped > > > > Signed-off-by: Alasta

Re: [PATCH v3 1/5] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-09-18 Thread Alastair D'Silva
On Thu, 2019-09-19 at 13:43 +1000, Michael Ellerman wrote: > "Alastair D'Silva" writes: > > From: Alastair D'Silva > > > > When calling flush_icache_range with a size >4GB, we were masking > > off the upper 32 bits, so we would incor

Re: [PATCH 4/5] ocxl: Add functions to map/unmap LPC memory

2019-09-18 Thread Alastair D'Silva
On Tue, 2019-09-17 at 11:43 +1000, Alastair D'Silva wrote: > From: Alastair D'Silva > > Add functions to map/unmap LPC memory > > Signed-off-by: Alastair D'Silva > --- > drivers/misc/ocxl/config.c| 4 +++ >

Re: [PATCH 4/5] ocxl: Add functions to map/unmap LPC memory

2019-09-18 Thread Alastair D'Silva
On Wed, 2019-09-18 at 16:03 +0200, Frederic Barrat wrote: > > Le 17/09/2019 à 03:43, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > Add functions to map/unmap LPC memory > > > > Signed-off-by: Alastair D'Silva &

Re: [PATCH 2/5] powerpc: Map & release OpenCAPI LPC memory

2019-09-18 Thread Alastair D'Silva
On Wed, 2019-09-18 at 16:03 +0200, Frederic Barrat wrote: > > Le 17/09/2019 à 03:42, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > Map & release OpenCAPI LPC memory. > > > > Signed-off-by: Alastair D'Silva > > --- &

[PATCH v3 5/5] powerpc: Don't flush caches when adding memory

2019-09-17 Thread Alastair D'Silva
From: Alastair D'Silva This operation takes a significant amount of time when hotplugging large amounts of memory (~50 seconds with 890GB of persistent memory). This was orignally in commit fb5924fddf9e ("powerpc/mm: Flush cache on memory hot(un)plug") to support memtrace, but t

[PATCH v3 3/5] powerpc: Convert flush_icache_range & friends to C

2019-09-17 Thread Alastair D'Silva
From: Alastair D'Silva Similar to commit 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") this patch converts the following ASM symbols to C: flush_icache_range() __flush_dcache_icache() __flush_dcache_icache_phys() This was done as we di

[PATCH v3 4/5] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-09-17 Thread Alastair D'Silva
From: Alastair D'Silva When presented with large amounts of memory being hotplugged (in my test case, ~890GB), the call to flush_dcache_range takes a while (~50 seconds), triggering RCU stalls. This patch breaks up the call into 1GB chunks, calling cond_resched() inbetween to allo

[PATCH v3 2/5] powerpc: define helpers to get L1 icache sizes

2019-09-17 Thread Alastair D'Silva
From: Alastair D'Silva This patch adds helpers to retrieve icache sizes, and renames the existing helpers to make it clear that they are for dcache. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 29 +++ arch/powerpc/i

[PATCH v3 0/5] powerpc: convert cache asm to C

2019-09-17 Thread Alastair D'Silva
From: Alastair D'Silva This series addresses a few issues discovered in how we flush caches: 1. Flushes were truncated at 4GB, so larger flushes were incorrect. 2. Flushing the dcache in arch_add_memory was unnecessary This series also converts much of the cache assembler to C, with the a

[PATCH v3 1/5] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-09-17 Thread Alastair D'Silva
From: Alastair D'Silva When calling flush_icache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. __kernel_sync_dicache in the 64 bit VDSO has the same bug. This patch replaces the 32 bit shifts with 64 bit

Re: [PATCH 5/5] ocxl: Provide additional metadata to userspace

2019-09-16 Thread Alastair D'Silva
On Tue, 2019-09-17 at 11:43 +1000, Alastair D'Silva wrote: > From: Alastair D'Silva > > This patch exposes the OpenCAPI device serial number to > userspace. > > It also includes placeholders for the LPC & special purpose > memory information (which will be po

[PATCH 5/5] ocxl: Provide additional metadata to userspace

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva This patch exposes the OpenCAPI device serial number to userspace. It also includes placeholders for the LPC & special purpose memory information (which will be populated in a subsequent patch) to avoid creating excessive versions of the IOCTL. Signed-off-by:

[PATCH 4/5] ocxl: Add functions to map/unmap LPC memory

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva Add functions to map/unmap LPC memory Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/config.c| 4 +++ drivers/misc/ocxl/core.c | 50 +++ drivers/misc/ocxl/link.c | 4 +-- drivers/misc/ocxl/ocxl_

[PATCH 2/5] powerpc: Map & release OpenCAPI LPC memory

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva Map & release OpenCAPI LPC memory. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/pnv-ocxl.h | 2 ++ arch/powerpc/platforms/powernv/ocxl.c | 42 +++ 2 files changed, 44 insertions(+) diff --git a/arch/powerpc/i

[PATCH 1/5] powerpc: Add OPAL calls for LPC memory alloc/release

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva Add OPAL calls for LPC memory alloc/release Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/opal-api.h| 4 +++- arch/powerpc/include/asm/opal.h| 3 +++ arch/powerpc/platforms/powernv/opal-call.c | 2 ++ 3 files changed, 8

[PATCH 3/5] ocxl: Tally up the LPC memory on a link & allow it to be mapped

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva Tally up the LPC memory on an OpenCAPI link & allow it to be mapped Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/core.c | 9 + drivers/misc/ocxl/link.c | 61 +++ drivers/misc/ocxl/ocxl_i

[PATCH 0/5] ocxl: Allow external drivers to access LPC memory

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva This series provides the prerequisite infrastructure to allow external drivers to map & access OpenCAPI LPC memory. Alastair D'Silva (5): powerpc: Add OPAL calls for LPC memory alloc/release powerpc: Map & release OpenCAPI LPC memory ocxl: Tally up

[PATCH v3 2/2] mm: Add a bounds check in devm_memremap_pages()

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva The call to check_hotplug_memory_addressable() validates that the memory is fully addressable. Without this call, it is possible that we may remap pages that is not physically addressable, resulting in bogus section numbers being returned from __section_nr(). Signe

[PATCH v3 1/2] memory_hotplug: Add a bounds check to check_hotplug_memory_range()

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

[PATCH v3 0/2] Add bounds check for Hotplugged memory

2019-09-16 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog

[PATCH v2 2/2] mm: Add a bounds check in devm_memremap_pages()

2019-09-15 Thread Alastair D'Silva
From: Alastair D'Silva The call to check_hotplug_memory_addressable() validates that the memory is fully addressable. Without this call, it is possible that we may remap pages that is not physically addressable, resulting in bogus section numbers being returned from __section_nr(). Signe

[PATCH v2 1/2] memory_hotplug: Add a bounds check to check_hotplug_memory_range()

2019-09-15 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

[PATCH v2 0/2] Add bounds check for Hotplugged memory

2019-09-15 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog

RE: [PATCH v2 1/6] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-09-15 Thread Alastair D'Silva
On Sat, 2019-09-14 at 09:46 +0200, Christophe Leroy wrote: > > Le 03/09/2019 à 07:23, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > When calling flush_icache_range with a size >4GB, we were masking > > off the upper 32 bits, so we

RE: [PATCH 1/2] memory_hotplug: Add a bounds check to check_hotplug_memory_range()

2019-09-10 Thread Alastair D'Silva
> -Original Message- > From: Kirill A. Shutemov > Sent: Tuesday, 10 September 2019 8:15 PM > To: Alastair D'Silva > Cc: alast...@d-silva.org; Andrew Morton ; > David Hildenbrand ; Oscar Salvador > ; Michal Hocko ; Pavel Tatashin > ; Wei Yang ; >

RE: [PATCH 1/2] memory_hotplug: Add a bounds check to check_hotplug_memory_range()

2019-09-10 Thread Alastair D'Silva
> -Original Message- > From: David Hildenbrand > Sent: Tuesday, 10 September 2019 5:46 PM > To: Alastair D'Silva ; alast...@d-silva.org > Cc: Andrew Morton ; Oscar Salvador > ; Michal Hocko ; Pavel Tatashin > ; Wei Yang ; > Dan Williams ; Qian Cai ; Jason

RE: [PATCH 2/2] mm: Add a bounds check in devm_memremap_pages()

2019-09-10 Thread Alastair D'Silva
> -Original Message- > From: David Hildenbrand > Sent: Tuesday, 10 September 2019 5:39 PM > To: Alastair D'Silva ; alast...@d-silva.org > Cc: Andrew Morton ; Oscar Salvador > ; Michal Hocko ; Pavel Tatashin > ; Dan Williams ; > Wei Yang ; Qian Cai ; Jason

[PATCH 0/2] Add bounds check for Hotplugged memory

2019-09-09 Thread Alastair D'Silva
From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Ala

[PATCH 2/2] mm: Add a bounds check in devm_memremap_pages()

2019-09-09 Thread Alastair D'Silva
From: Alastair D'Silva The call to check_hotplug_memory_addressable() validates that the memory is fully addressable. Without this call, it is possible that we may remap pages that is not physically addressable, resulting in bogus section numbers being returned from __section_nr(). Signe

[PATCH 1/2] memory_hotplug: Add a bounds check to check_hotplug_memory_range()

2019-09-09 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max a

Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory

2019-09-03 Thread Alastair D'Silva
On Mon, 2019-09-02 at 09:28 +0200, David Hildenbrand wrote: > On 02.09.19 01:54, Alastair D'Silva wrote: > > On Tue, 2019-08-27 at 09:13 +0200, David Hildenbrand wrote: > > > On 27.08.19 08:39, Alastair D'Silva wrote: > > > > On Tue, 2019-08-27 at 08:28 +02

RE: [PATCH v2 4/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-09-03 Thread Alastair D'Silva
> > But you tell me that you leave to people the opportunity to not > apply > that subsequent patch, and that's the reason you didn't put that > patch > before this one. In that case adding a helper is worth it. > > Christophe I factored it out anyway, since it

RE: [PATCH v2 3/6] powerpc: Convert flush_icache_range & friends to C

2019-09-03 Thread Alastair D'Silva
3", it is always possible to copy %0 to %3 and use it > as > an address register for the second loop. One register less to > allocate > for the compiler. Constraints of course have to be adjusted. > > Given that we're dealing with registers holding data that has be

RE: [PATCH v2 3/6] powerpc: Convert flush_icache_range & friends to C

2019-09-03 Thread Alastair D'Silva
On Tue, 2019-09-03 at 11:04 -0500, Segher Boessenkool wrote: > On Tue, Sep 03, 2019 at 04:28:09PM +0200, Christophe Leroy wrote: > > Le 03/09/2019 à 15:04, Segher Boessenkool a écrit : > > > On Tue, Sep 03, 2019 at 03:23:57PM +1000, Alastair D'Silva wrote: >

RE: [PATCH v2 3/6] powerpc: Convert flush_icache_range & friends to C

2019-09-03 Thread Alastair D'Silva
On Tue, 2019-09-03 at 08:08 +0200, Christophe Leroy wrote: > > Le 03/09/2019 à 07:23, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > Similar to commit 22e9c88d486a > > ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")

Re: [PATCH v2 6/6] powerpc: Don't flush caches when adding memory

2019-09-02 Thread Alastair D'Silva
On Tue, 2019-09-03 at 08:23 +0200, Christophe Leroy wrote: > > Le 03/09/2019 à 07:24, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > This operation takes a significant amount of time when hotplugging > > large amounts of memory (~50 sec

Re: [PATCH v2 4/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-09-02 Thread Alastair D'Silva
On Tue, 2019-09-03 at 08:19 +0200, Christophe Leroy wrote: > > Le 03/09/2019 à 07:23, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > When presented with large amounts of memory being hotplugged > > (in my test case, ~890GB), the call to f

[PATCH v2 3/6] powerpc: Convert flush_icache_range & friends to C

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva Similar to commit 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") this patch converts the following ASM symbols to C: flush_icache_range() __flush_dcache_icache() __flush_dcache_icache_phys() This was done as we di

[PATCH v2 6/6] powerpc: Don't flush caches when adding memory

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva This operation takes a significant amount of time when hotplugging large amounts of memory (~50 seconds with 890GB of persistent memory). This was orignally in commit fb5924fddf9e ("powerpc/mm: Flush cache on memory hot(un)plug") to support memtrace, but t

[PATCH v2 5/6] powerpc: Remove 'extern' from func prototypes in cache headers

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva The 'extern' keyword does not value-add for function prototypes. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 8 arch/powerpc/include/asm/cacheflush.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-

[PATCH v2 4/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva When presented with large amounts of memory being hotplugged (in my test case, ~890GB), the call to flush_dcache_range takes a while (~50 seconds), triggering RCU stalls. This patch breaks up the call into 1GB chunks, calling cond_resched() inbetween to allo

[PATCH v2 2/6] powerpc: define helpers to get L1 icache sizes

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva This patch adds helpers to retrieve icache sizes, and renames the existing helpers to make it clear that they are for dcache. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 29 +++ arch/powerpc/i

[PATCH v2 0/6] powerpc: convert cache asm to C

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva This series addresses a few issues discovered in how we flush caches: 1. Flushes were truncated at 4GB, so larger flushes were incorrect. 2. Flushing the dcache in arch_add_memory was unnecessary This series also converts much of the cache assembler to C, with the a

[PATCH v2 1/6] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-09-02 Thread Alastair D'Silva
From: Alastair D'Silva When calling flush_icache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signed-off-by:

RE: [PATCH] powerpc: Perform a bounds check in arch_add_memory

2019-09-01 Thread Alastair D'Silva
On Tue, 2019-08-27 at 09:13 +0200, David Hildenbrand wrote: > On 27.08.19 08:39, Alastair D'Silva wrote: > > On Tue, 2019-08-27 at 08:28 +0200, Michal Hocko wrote: > > > On Tue 27-08-19 15:20:46, Alastair D'Silva wrote: > > > > From: Alastair D'Silva

[PATCH] mm: Remove NULL check in clear_hwpoisoned_pages()

2019-08-28 Thread Alastair D'Silva
e passed a NULL has been removed, so there is no longer a possibility that memmap can be NULL. Signed-off-by: Alastair D'Silva --- mm/sparse.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 78979c142b7d..9f7e3682cdcb 100644 --- a/mm/sparse.c ++

Re: [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section

2019-08-27 Thread Alastair D'Silva
On Tue, 2019-08-27 at 08:24 +0200, Michal Hocko wrote: > On Tue 27-08-19 15:36:55, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > By adding offset to memmap before passing it in to > > clear_hwpoisoned_pages, > > we hide a theoretic

Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory

2019-08-26 Thread Alastair D'Silva
On Tue, 2019-08-27 at 08:28 +0200, Michal Hocko wrote: > On Tue 27-08-19 15:20:46, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > It is possible for firmware to allocate memory ranges outside > > the range of physical memory that we support (MAX_P

[PATCH 1/2] mm: Don't manually decrement num_poisoned_pages

2019-08-26 Thread Alastair D'Silva
From: Alastair D'Silva Use the function written to do it instead. Signed-off-by: Alastair D'Silva --- mm/sparse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index 72f010d9bff5..e41917a7e844 100644 --- a/mm/sparse.c +++ b/m

[PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section

2019-08-26 Thread Alastair D'Silva
From: Alastair D'Silva By adding offset to memmap before passing it in to clear_hwpoisoned_pages, we hide a theoretically null memmap from the null check inside clear_hwpoisoned_pages. This patch passes the offset to clear_hwpoisoned_pages instead, allowing memmap to successfully perform

[PATCH 0/2] mm: Minor cleanup

2019-08-26 Thread Alastair D'Silva
From: Alastair D'Silva This series addresses some minor issues & obsoletes: mm: Cleanup & allow modules to hotplug memory Alastair D'Silva (2): mm: Don't manually decrement num_poisoned_pages mm: don't hide potentially null memmap pointer in sparse_remov

[PATCH] powerpc: Perform a bounds check in arch_add_memory

2019-08-26 Thread Alastair D'Silva
From: Alastair D'Silva It is possible for firmware to allocate memory ranges outside the range of physical memory that we support (MAX_PHYSMEM_BITS). This patch adds a bounds check to ensure that any hotplugged memory is addressable. Signed-off-by: Alastair D'Silva --- arch/powerp

RE: [RFC PATCH] powerpc: Convert ____flush_dcache_icache_phys() to C

2019-08-21 Thread Alastair D'Silva
On Thu, 2019-08-22 at 07:06 +0200, Christophe Leroy wrote: > > Le 22/08/2019 à 02:27, Alastair D'Silva a écrit : > > On Wed, 2019-08-21 at 22:27 +0200, Christophe Leroy wrote: > > > Le 20/08/2019 à 06:36, Alastair D'Silva a écrit : > > > > On Fri, 2019-0

RE: [RFC PATCH] powerpc: Convert ____flush_dcache_icache_phys() to C

2019-08-21 Thread Alastair D'Silva
On Wed, 2019-08-21 at 22:27 +0200, Christophe Leroy wrote: > > Le 20/08/2019 à 06:36, Alastair D'Silva a écrit : > > On Fri, 2019-08-16 at 15:52 +, Christophe Leroy wrote: > > [...] > > > > > Thanks Christophe, > > > > I'm

[PATCH v2] powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB

2019-08-20 Thread Alastair D'Silva
From: Alastair D'Silva The upstream commit: 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") has a similar effect, but since it is a rewrite of the assembler to C, is too invasive for stable. This patch is a minimal fix to address the issue in assembl

Re: [RFC PATCH] powerpc: Convert ____flush_dcache_icache_phys() to C

2019-08-19 Thread Alastair D'Silva
uction cache */ address = addr; for (i = 0; i < ilines; i++, address += ibytes) icbi((void *)address); mtmsr(msr); } void test_flush_phys(unsigned long addr) { flush_dcache_icache_phys(addr); } This gives the following assembler (using pmac32_

RE: [PATCH 4/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-08-15 Thread Alastair D'Silva
On Thu, 2019-08-15 at 09:36 +0200, christophe leroy wrote: > > Le 15/08/2019 à 06:10, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > When presented with large amounts of memory being hotplugged > > (in my test case, ~890GB), the call to f

Re: [PATCH 3/6] powerpc: Convert flush_icache_range & friends to C

2019-08-15 Thread Alastair D'Silva
On Thu, 2019-08-15 at 09:29 +0200, christophe leroy wrote: > > Le 15/08/2019 à 06:10, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > Similar to commit 22e9c88d486a > > ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")

[PATCH] powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva Heads Up: This patch cannot be submitted to Linus's tree, as the affected assembler functions have already been converted to C. When calling flush_(inval_)dcache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a

[PATCH 0/6] powerpc: convert cache asm to C

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva This series addresses a few issues discovered in how we flush caches: 1. Flushes were truncated at 4GB, so larger flushes were incorrect. 2. Flushing the dcache in arch_add_memory was unnecessary This series also converts much of the cache assembler to C, with the a

[PATCH 6/6] powerpc: Don't flush caches when adding memory

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva This operation takes a significant amount of time when hotplugging large amounts of memory (~50 seconds with 890GB of persistent memory). This was orignally in commit fb5924fddf9e ("powerpc/mm: Flush cache on memory hot(un)plug") to support memtrace, but t

[PATCH 5/6] powerpc: Remove 'extern' from func prototypes in cache headers

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva The 'extern' keyword does not value-add for function prototypes. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 8 arch/powerpc/include/asm/cacheflush.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-

[PATCH 3/6] powerpc: Convert flush_icache_range & friends to C

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva Similar to commit 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") this patch converts flush_icache_range() to C, and reimplements the following functions as wrappers around it: __flush_dcache_icache __flush_dcache_icache_phys T

[PATCH 4/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva When presented with large amounts of memory being hotplugged (in my test case, ~890GB), the call to flush_dcache_range takes a while (~50 seconds), triggering RCU stalls. This patch breaks up the call into 16GB chunks, calling cond_resched() inbetween to allo

[PATCH 2/6] powerpc: define helpers to get L1 icache sizes

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva This patch adds helpers to retrieve icache sizes, and renames the existing helpers to make it clear that they are for dcache. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 29 +++ arch/powerpc/i

[PATCH 1/6] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-08-14 Thread Alastair D'Silva
From: Alastair D'Silva When calling flush_icache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signed-off-by:

Re: [PATCH 1/2] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-08-11 Thread Alastair D'Silva
On Fri, 2019-08-09 at 10:59 +0200, Christophe Leroy wrote: > > Le 09/08/2019 à 02:45, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > When calling flush_icache_range with a size >4GB, we were masking > > off the upper 32 bits, so we

[PATCH 2/2] powerpc: Convert flush_icache_range to C

2019-08-08 Thread Alastair D'Silva
From: Alastair D'Silva Similar to commit 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") this patch converts flush_icache_range to C. This was done as we discovered a long-standing bug where the length of the range was truncated due to using a 32 bit s

[PATCH 1/2] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-08-08 Thread Alastair D'Silva
From: Alastair D'Silva When calling flush_icache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Heads-up for bac

Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr

2019-07-01 Thread Alastair D'Silva
On Tue, 2019-07-02 at 08:13 +0200, Michal Hocko wrote: > On Tue 02-07-19 14:13:25, Alastair D'Silva wrote: > > On Mon, 2019-07-01 at 12:46 +0200, Michal Hocko wrote: > > > On Fri 28-06-19 10:46:28, Alastair D'Silva wrote: > > > [...] > > > > Given t

Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr

2019-07-01 Thread Alastair D'Silva
On Mon, 2019-07-01 at 12:46 +0200, Michal Hocko wrote: > On Fri 28-06-19 10:46:28, Alastair D'Silva wrote: > [...] > > Given that there is already a VM_BUG_ON in the code, how do you > > feel > > about broadening the scope from 'VM_BUG_ON(!root)' t

Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr

2019-06-27 Thread Alastair D'Silva
On Thu, 2019-06-27 at 10:10 +0200, Michal Hocko wrote: > On Thu 27-06-19 10:50:57, Alastair D'Silva wrote: > > On Wed, 2019-06-26 at 08:57 +0200, Michal Hocko wrote: > > > On Wed 26-06-19 16:27:30, Alastair D'Silva wrote: > > > > On Wed, 2019-06-26 at 08:21

Re: [PATCH v2 0/3] mm: Cleanup & allow modules to hotplug memory

2019-06-26 Thread Alastair D'Silva
On Wed, 2019-06-26 at 00:57 -0700, Christoph Hellwig wrote: > On Wed, Jun 26, 2019 at 04:11:20PM +1000, Alastair D'Silva wrote: > > - Drop mm/hotplug: export try_online_node > > (not necessary) > > With this the subject line of the cover letter seems incorre

Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr

2019-06-26 Thread Alastair D'Silva
On Wed, 2019-06-26 at 08:57 +0200, Michal Hocko wrote: > On Wed 26-06-19 16:27:30, Alastair D'Silva wrote: > > On Wed, 2019-06-26 at 08:21 +0200, Michal Hocko wrote: > > > On Wed 26-06-19 16:11:21, Alastair D'Silva wrote: > > > > From: Alastair D'Silv

Re: [PATCH v2 2/3] mm: don't hide potentially null memmap pointer in sparse_remove_one_section

2019-06-25 Thread Alastair D'Silva
On Wed, 2019-06-26 at 08:23 +0200, Michal Hocko wrote: > On Wed 26-06-19 16:11:22, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > By adding offset to memmap before passing it in to > > clear_hwpoisoned_pages, > > we hide a potenti

Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr

2019-06-25 Thread Alastair D'Silva
On Wed, 2019-06-26 at 08:21 +0200, Michal Hocko wrote: > On Wed 26-06-19 16:11:21, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > If a memory section comes in where the physical address is greater > > than > > that which is managed by the

[PATCH v2 3/3] mm: Don't manually decrement num_poisoned_pages

2019-06-25 Thread Alastair D'Silva
From: Alastair D'Silva Use the function written to do it instead. Signed-off-by: Alastair D'Silva --- mm/sparse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index 1ec32aef5590..d9b3625bfdf0 100644 --- a/mm/sparse.c +++ b/m

  1   2   >