[PATCH 3/5] ocxl: read_pasid never returns an error, so make it void

2019-02-26 Thread Alastair D'Silva
From: Alastair D'Silva No need for a return value in read_pasid as it only returns 0. Signed-off-by: Alastair D'Silva Reviewed-by: Greg Kurz --- drivers/misc/ocxl/config.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/dr

[PATCH 5/5] ocxl: Remove some unused exported symbols

2019-02-26 Thread Alastair D'Silva
From: Alastair D'Silva Remove some unused exported symbols. Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/config.c| 2 -- drivers/misc/ocxl/ocxl_internal.h | 26 +- include/misc/ocxl.h | 23 --- 3 files c

[PATCH 2/5] ocxl: Clean up printf formats

2019-02-26 Thread Alastair D'Silva
From: Alastair D'Silva Use %# instead of using a literal '0x' Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/config.c | 6 +++--- drivers/misc/ocxl/context.c | 2 +- drivers/misc/ocxl/trace.h | 10 +- 3 files changed, 9 insertions(+), 9 deletions(-)

[PATCH 4/5] ocxl: Remove superfluous 'extern' from headers

2019-02-26 Thread Alastair D'Silva
From: Alastair D'Silva The 'extern' keyword adds no value here. Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/ocxl_internal.h | 54 +++ include/misc/ocxl.h | 36 ++--- 2 files changed, 44 insertions(+), 4

[PATCH 1/5] ocxl: Rename struct link to ocxl_link

2019-02-26 Thread Alastair D'Silva
From: Alastair D'Silva The term 'link' is ambiguous (especially when the struct is used for a list), so rename it for clarity. Signed-off-by: Alastair D'Silva Reviewed-by: Greg Kurz --- drivers/misc/ocxl/file.c | 2 +- drivers/misc/ocxl/link.c | 36 ++-

[PATCH 0/5] ocxl: OpenCAPI Cleanup

2019-02-26 Thread Alastair D'Silva
From: Alastair D'Silva Some minor cleanups for the OpenCAPI driver as a prerequisite for an ocxl driver refactoring to allow the driver core to be utilised by external drivers. Alastair D'Silva (5): ocxl: Rename struct link to ocxl_link ocxl: Clean up printf formats ocxl: read_p

RE: [PATCH 1/5] ocxl: Rename struct link to ocxl_link

2019-02-26 Thread Alastair D'Silva
> -Original Message- > From: Andrew Donnellan > Sent: Wednesday, 27 February 2019 6:16 PM > To: Alastair D'Silva ; alast...@d-silva.org > Cc: Greg Kurz ; Frederic Barrat ; > Arnd Bergmann ; Greg Kroah-Hartman > ; linuxppc-...@lists.ozlabs.org; linux- > ker...@

RE: [PATCH 1/5] ocxl: Rename struct link to ocxl_link

2019-02-27 Thread Alastair D'Silva
> -Original Message- > From: Andrew Donnellan > Sent: Wednesday, 27 February 2019 6:55 PM > To: Alastair D'Silva ; 'Alastair D'Silva' > > Cc: 'Greg Kurz' ; 'Frederic Barrat' > ; 'Arnd Bergmann' ; 'Greg Kroah

[PATCH v2 7/7] ocxl: Provide global MMIO accessors for external drivers

2019-03-19 Thread Alastair D'Silva
From: Alastair D'Silva External drivers that communicate via OpenCAPI will need to make MMIO calls to interact with the devices. Signed-off-by: Alastair D'Silva Reviewed-by: Greg Kurz --- drivers/misc/ocxl/Makefile | 2 +- drivers/misc/ocxl/mmio

[PATCH v2 4/7] ocxl: Allow external drivers to use OpenCAPI contexts

2019-03-19 Thread Alastair D'Silva
From: Alastair D'Silva Most OpenCAPI operations require a valid context, so exposing these functions to external drivers is necessary. Signed-off-by: Alastair D'Silva Reviewed-by: Greg Kurz --- drivers/misc/ocxl/context.c | 9 +-- drivers/misc/ocxl/file.c | 2 +

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

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

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

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

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

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

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

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

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

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()")

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

[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

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

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

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

[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

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

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

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

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

[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

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

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

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

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

[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

[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

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

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

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

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

[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: [PATCH v2 3/7] lib/hexdump.c: Optionally suppress lines of repeated bytes

2019-05-09 Thread Alastair D'Silva
On Wed, 2019-05-08 at 17:58 -0700, Randy Dunlap wrote: > On 5/8/19 12:01 AM, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > Some buffers may only be partially filled with useful data, while > > the rest > > is padded (typically with 0x00

  1   2   >