[PATCH v2 23/52] powerpc/64s/exception: fix indenting irregularities

2019-06-20 Thread Nicholas Piggin
Generally, macros that result in instructions being expanded are indented by a tab, and those that don't have no indent. Fix the obvious cases that go contrary to style. No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 92

[PATCH v2 26/52] powerpc/64s/exception: remove pointless EXCEPTION_PROLOG macro indirection

2019-06-20 Thread Nicholas Piggin
No generated code change. File is change is in bug table line numbers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 97 +--- 1 file changed, 45 insertions(+), 52 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 31/52] powerpc/64s/exception: mtmsrd L=1 cleanup

2019-06-20 Thread Nicholas Piggin
All supported 64s CPUs support mtmsrd L=1 instruction, so a cleanup can be made in sreset and mce handlers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 35/52] powerpc/64s/exception: shuffle windup code around

2019-06-20 Thread Nicholas Piggin
Restore all SPRs and CR up-front, these are longer latency instructions. Move register restore around to maximise pairs of adjacent loads (e.g., restore r0 next to r1). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 40 +++- 1 file changed, 16

[PATCH v2 40/52] powerpc/64s/exception: move SET_SCRATCH0 into EXCEPTION_PROLOG_0

2019-06-20 Thread Nicholas Piggin
No generated code change. File is change is in bug table line numbers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 25 + 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 41/52] powerpc/tm: update comment about interrupt re-entrancy

2019-06-20 Thread Nicholas Piggin
Since the system reset interrupt began to use its own stack, and machine check interrupts have done so for some time, r1 can be changed without clearing MSR[RI], provided no other interrupts (including SLB misses) are taken. MSR[RI] does have to be cleared when using SCRATCH0, however.

[PATCH v2 46/52] powerpc/64s/exception: fix machine check early should not set AMR

2019-06-20 Thread Nicholas Piggin
The early machine check runs in real mode, so locking is unnecessary. Worse, the windup does not restore AMR, so this can result in a false KUAP fault after a recoverable machine check hits inside a user copy operation. Fix this similarly to HMI by just avoiding the kuap lock in the early machine

[PATCH v2 50/52] powerpc/64s/exception: untangle early machine check handler

2019-06-20 Thread Nicholas Piggin
machine_check_early_common now branches to machine_check_handle_early which is its only caller, and they're separated by a bunch of other code which makes no sense. This patch moves that other code out of the way, and removes the branch instruction. Signed-off-by: Nicholas Piggin ---

Re: [PATCH] crypto: talitos - fix max key size for sha384 and sha512

2019-06-20 Thread Herbert Xu
On Wed, Jun 12, 2019 at 05:49:50AM +, Christophe Leroy wrote: > Below commit came with a typo in the CONFIG_ symbol, leading > to a permanently reduced max key size regarless of the driver > capabilities. > > Reported-by: Horia Geantă > Fixes: b8fbdc2bc4e7 ("crypto: talitos - reduce max key

[PATCH v2 30/52] powerpc/64s/exception: optimise system_reset for idle, clean up non-idle case

2019-06-20 Thread Nicholas Piggin
The idle wake up code in the system reset interrupt is not very optimal. There are two requirements: perform idle wake up quickly; and save everything including CFAR for non-idle interrupts, with no performance requirement. The problem with placing the idle test in the middle of the handler and

[PATCH v2 32/52] powerpc/64s/exception: windup use r9 consistently to restore SPRs

2019-06-20 Thread Nicholas Piggin
Trivial code change, r3->r9. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 539bb1b83d90..804438669454

[PATCH v2 34/52] powerpc/64s/exception: simplify hmi windup code

2019-06-20 Thread Nicholas Piggin
Duplicate the hmi windup code for both cases, rather than to put a special case branch in the middle of it. Remove unused label. This helps with later code consolidation. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 22 ++ 1 file changed, 18

[PATCH v2 38/52] powerpc/64s/exception: machine check use standard macros to save dar/dsisr

2019-06-20 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 16d5ea1c86bb..437f91179537 100644 ---

[PATCH v2 39/52] powerpc/64s/exception: denorm handler use standard scratch save macro

2019-06-20 Thread Nicholas Piggin
Although the 0x1500 interrupt only applies to bare metal, it is better to just use the standard macro for scratch save. Runtime code path remains unchanged (due to instruction patching). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 2 +- 1 file changed, 1

[PATCH v2 44/52] powerpc/64s/exception: separate pseries and powernv mce delivery paths

2019-06-20 Thread Nicholas Piggin
This will allow standardised interrupt entry macros to be used in future. These paths may be de-duplicated again after that if code allows. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff

[PATCH v2 48/52] powerpc/64s/exception: simplify machine check early path

2019-06-20 Thread Nicholas Piggin
machine_check_handle_early_common can reach machine_check_handle_early directly now that it runs at the relocated address. The only reason to do the rfi sequence is to enable MSR[ME]. Move that into a helper function to make the normal code path a bit easier to read. Signed-off-by: Nicholas

[PATCH v2 49/52] powerpc/64s/exceptions: machine check move unrecoverable handling out of line

2019-06-20 Thread Nicholas Piggin
Similarly to the previous patch, move unrecoverable handling out of line, which makes the regular path less cluttered and easier to follow. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 83 +--- 1 file changed, 39 insertions(+), 44

[PATCH v2 51/52] powerpc/64s/exception: machine check improve branch labels

2019-06-20 Thread Nicholas Piggin
Short forward and backward branches can be given number labels, but larger significant divergences in code path a more readable if they're given descriptive names. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 10 +- 1 file changed, 5 insertions(+), 5

Re: [PATCH v2 30/52] powerpc/64s/exception: optimise system_reset for idle, clean up non-idle case

2019-06-20 Thread Nicholas Piggin
Nicholas Piggin's on June 20, 2019 3:14 pm: > The idle wake up code in the system reset interrupt is not very > optimal. There are two requirements: perform idle wake up quickly; > and save everything including CFAR for non-idle interrupts, with > no performance requirement. > > The problem with

Re: [PATCH 3/4] powerpc/powernv: remove dead NPU DMA code

2019-06-20 Thread Christoph Hellwig
Hi Linus, this goes back to the discussion at last years kernel summit, where we had the discussion on removing code never used by any in-kernel user an no prospects of one. The IBM folks are unfortunately still dragging their feet on the powerpc side. Can we revise this discussion? The use

Re: [PATCH 3/4] powerpc/powernv: remove dead NPU DMA code

2019-06-20 Thread Alexey Kardashevskiy
On 20/06/2019 16:21, Christoph Hellwig wrote: > On Thu, Jun 20, 2019 at 04:20:08PM +1000, Alexey Kardashevskiy wrote: >> >> >> On 20/06/2019 16:03, Christoph Hellwig wrote: >>> Hi Linus, >>> >>> this goes back to the discussion at last years kernel summit, where >>> we had the discussion on

[PATCH v2 24/52] powerpc/64s/exception: generate regs clear instructions using .rept

2019-06-20 Thread Nicholas Piggin
No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 29 +++- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index

[PATCH v2 29/52] powerpc/64s/exception: avoid SPR RAW scoreboard stall in real mode entry

2019-06-20 Thread Nicholas Piggin
Move SPR reads ahead of writes. Real mode entry that is not a KVM guest is rare these days, but bad practice propagates. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git

[PATCH v2 28/52] powerpc/64s/exception: clean up system call entry

2019-06-20 Thread Nicholas Piggin
syscall / hcall entry unnecessarily differs between KVM and non-KVM builds. Move the SMT priority instruction to the same location (after INTERRUPT_TO_KERNEL). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 25 +++-- 1 file changed, 7

[PATCH v2 36/52] powerpc/64s/exception: use common macro for windup

2019-06-20 Thread Nicholas Piggin
No generated code change. File is change is in bug table line numbers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 112 +-- 1 file changed, 36 insertions(+), 76 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 42/52] powerpc/64s/exception: machine check fwnmi does not trigger when in HV mode

2019-06-20 Thread Nicholas Piggin
Remove dead code. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 286bd5670d60..b12755a4f884 100644 ---

[PATCH v2 45/52] powerpc/64s/exception: machine check windup restore cfar for host delivery

2019-06-20 Thread Nicholas Piggin
Bare metal machine checks run an "early" handler in real mode which potentially flushes faulting translation structures, among other things, before running the main handler which reports the event. The main handler runs as a normal interrupt handler, after a "windup" that sets registers back as

[PATCH v2 52/52] powerpc/64s/exception: add missing branch to self after RFI

2019-06-20 Thread Nicholas Piggin
For consistency. These may not be required on modern processors, and they don't quite fit with the RFI_TO macros, but they should be all removed in that case. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 3 +++ 1 file changed, 3 insertions(+) diff --git

Re: [PATCH v4 1/4] lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE

2019-06-20 Thread Herbert Xu
On Mon, Jun 17, 2019 at 09:15:02PM +, Christophe Leroy wrote: > All mapping iterator logic is based on the assumption that sg->offset > is always lower than PAGE_SIZE. > > But there are situations where sg->offset is such that the SG item > is on the second page. In that case

Re: [PATCH 3/4] powerpc/powernv: remove dead NPU DMA code

2019-06-20 Thread Alexey Kardashevskiy
On 20/06/2019 16:03, Christoph Hellwig wrote: > Hi Linus, > > this goes back to the discussion at last years kernel summit, where > we had the discussion on removing code never used by any in-kernel > user an no prospects of one. The IBM folks are unfortunately still > dragging their feet on

Re: [PATCH 3/3] KVM: PPC: Book3S HV: Clear pending decr exceptions on nested guest entry

2019-06-20 Thread Laurent Vivier
On 20/06/2019 03:46, Suraj Jitindar Singh wrote: > If we enter an L1 guest with a pending decrementer exception then this > is cleared on guest exit if the guest has writtien a positive value into > the decrementer (indicating that it handled the decrementer exception) > since there is no other

Re: [PATCH] crypto: vmx - Document CTR mode counter width quirks

2019-06-20 Thread Herbert Xu
On Tue, Jun 11, 2019 at 11:54:31AM +1000, Daniel Axtens wrote: > The CTR code comes from OpenSSL, where it does a 32-bit counter. > The kernel has a 128-bit counter. This difference has lead to > issues. > > Document it. > > Signed-off-by: Daniel Axtens > --- > drivers/crypto/vmx/aesp8-ppc.pl

Re: [PATCH v2] crypto: nx: no need to check return value of debugfs_create functions

2019-06-20 Thread Herbert Xu
Greg Kroah-Hartman wrote: > When calling debugfs functions, there is no need to ever check the > return value. The function can work or not, but the code logic should > never do something different based on this. > > Also, there is no need to store the individual debugfs file names, >

Re: [PATCH 3/3] KVM: PPC: Book3S HV: Clear pending decr exceptions on nested guest entry

2019-06-20 Thread Cédric Le Goater
On 20/06/2019 09:57, Laurent Vivier wrote: > On 20/06/2019 03:46, Suraj Jitindar Singh wrote: >> If we enter an L1 guest with a pending decrementer exception then this >> is cleared on guest exit if the guest has writtien a positive value into >> the decrementer (indicating that it handled the

[PATCH v2 25/52] powerpc/64s/exception: remove bad stack branch

2019-06-20 Thread Nicholas Piggin
The bad stack test in interrupt handlers has a few problems. For performance it is taken in the common case, which is a fetch bubble and a waste of i-cache. For code development and maintainence, it requires yet another stack frame setup routine, and that constrains all exception handlers to

[PATCH v2 27/52] powerpc/64s/exception: move paca save area offsets into exception-64s.S

2019-06-20 Thread Nicholas Piggin
No generated code change. File is change is in bug table line numbers. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/exception-64s.h | 17 +++-- arch/powerpc/kernel/exceptions-64s.S | 22 ++ 2 files changed, 25 insertions(+), 14 deletions(-)

[PATCH v2 33/52] powerpc/64s/exception: move machine check windup in_mce handling

2019-06-20 Thread Nicholas Piggin
Move in_mce decrement earlier before registers are restored (but still after RI=0). This helps with later consolidation. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v2 37/52] powerpc/64s/exception: add dar and dsisr options to exception macro

2019-06-20 Thread Nicholas Piggin
Some exception entry requires DAR and/or DSISR to be saved into the paca exception save area. Add options to the standard exception macros for these. Generated code changes slightly due to code structure. - 554: a6 02 72 7d mfdsisr r11 - 558: a8 00 4d f9 std

[PATCH v2 43/52] powerpc/64s/exception: machine check early only runs in HV mode

2019-06-20 Thread Nicholas Piggin
machine_check_common_early and machine_check_handle_early only run in HVMODE. Remove dead code. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 38 +--- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git

[PATCH v2 47/52] powerpc/64s/exception: machine check restructure handler to be more regular

2019-06-20 Thread Nicholas Piggin
Follow the pattern of sreset and HMI handlers more closely, in using EXCEPTION_PROLOG_COMMON_1 rather than open-coding it. Run the handler at the relocated location. This will help with simplification and code sharing. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S |

Re: [PATCH v2] ocxl: Allow contexts to be attached with a NULL mm

2019-06-20 Thread Nicholas Piggin
Alastair D'Silva's on June 20, 2019 2:12 pm: > From: Alastair D'Silva > > If an OpenCAPI context is to be used directly by a kernel driver, there > may not be a suitable mm to use. > > The patch makes the mm parameter to ocxl_context_attach optional. > > Signed-off-by: Alastair D'Silva Yeah

[PATCH] KVM: PPC: Book3S HV: Fix CR0 setting in TM emulation

2019-06-20 Thread Michael Neuling
When emulating tsr, treclaim and trechkpt, we incorrectly set CR0. The code currently sets: CR0 <- 00 || MSR[TS] but according to the ISA it should be: CR0 <- 0 || MSR[TS] || 0 This fixes the bit shift to put the bits in the correct location. Tested-by: Suraj Jitindar Singh

Re: [PATCH 3/4] powerpc/powernv: remove dead NPU DMA code

2019-06-20 Thread Christoph Hellwig
On Thu, Jun 20, 2019 at 04:20:08PM +1000, Alexey Kardashevskiy wrote: > > > On 20/06/2019 16:03, Christoph Hellwig wrote: > > Hi Linus, > > > > this goes back to the discussion at last years kernel summit, where > > we had the discussion on removing code never used by any in-kernel > > user an

Re: [PATCH 2/3] KVM: PPC: Book3S HV: Signed extend decrementer value if not using large decr

2019-06-20 Thread Laurent Vivier
On 20/06/2019 03:46, Suraj Jitindar Singh wrote: > On POWER9 the decrementer can operate in large decrementer mode where > the decrementer is 56 bits and signed extended to 64 bits. When not > operating in this mode the decrementer behaves as a 32 bit decrementer > which is NOT signed extended (as

Re: [PATCH v12 00/31] Speculative page faults

2019-06-20 Thread Haiyan Song
Hi Laurent, I downloaded your script and run it on Intel 2s skylake platform with spf-v12 patch serials. Here attached the output results of this script. The following comparison result is statistics from the script outputs. a). Enable THP SPF_0

[PATCH v4 1/6] nvdimm: Consider probe return -EOPNOTSUPP as success

2019-06-20 Thread Aneesh Kumar K.V
This patch add -EOPNOTSUPP as return from probe callback to indicate we were not able to initialize a namespace due to pfn superblock feature/version mismatch. We want to consider this a probe success so that we can create new namesapce seed and there by avoid marking the failed namespace as the

[PATCH v4 6/6] mm/nvdimm: Fix endian conversion issues 

2019-06-20 Thread Aneesh Kumar K.V
nd_label->dpa issue was observed when trying to enable the namespace created with little-endian kernel on a big-endian kernel. That made me run `sparse` on the rest of the code and other changes are the result of that. Fixes: d9b83c756953 ("libnvdimm, btt: rework error clearing") Fixes:

Re: [PATCH v2 42/52] powerpc/64s/exception: machine check fwnmi does not trigger when in HV mode

2019-06-20 Thread Nicholas Piggin
Mahesh Jagannath Salgaonkar's on June 20, 2019 7:26 pm: > On 6/20/19 10:44 AM, Nicholas Piggin wrote: >> Remove dead code. >> >> Signed-off-by: Nicholas Piggin >> --- >> arch/powerpc/kernel/exceptions-64s.S | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git

Re: [PATCH v2 43/52] powerpc/64s/exception: machine check early only runs in HV mode

2019-06-20 Thread Nicholas Piggin
Mahesh J Salgaonkar's on June 20, 2019 7:53 pm: > On 2019-06-20 15:14:50 Thu, Nicholas Piggin wrote: >> machine_check_common_early and machine_check_handle_early only run in >> HVMODE. Remove dead code. > > That's not true. For pseries guest with FWNMI enabled hypervisor, >

[PATCH v2 3/6] mm: Make register_mem_sect_under_node() static

2019-06-20 Thread David Hildenbrand
It is only used internally. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Keith Busch Cc: Oscar Salvador Signed-off-by: David Hildenbrand --- drivers/base/node.c | 3 ++- include/linux/node.h | 7 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git

[PATCH v4 0/6] Fixes related namespace alignment/page size/big endian

2019-06-20 Thread Aneesh Kumar K.V
This series handle configs where hugepage support is not enabled by default. Also, we update some of the information messages to make sure we use PAGE_SIZE instead of SZ_4K. We now store page size and struct page size in pfn_sb and do extra check before enabling namespace. There also an

[PATCH v4 4/6] mm/nvdimm: Pick the right alignment default when creating dax devices

2019-06-20 Thread Aneesh Kumar K.V
Allow arch to provide the supported alignments and use hugepage alignment only if we support hugepage. Right now we depend on compile time configs whereas this patch switch this to runtime discovery. Architectures like ppc64 can have THP enabled in code, but then can have hugepage size disabled

[PATCH v4 3/6] mm/nvdimm: Use correct #defines instead of open coding

2019-06-20 Thread Aneesh Kumar K.V
Use PAGE_SIZE instead of SZ_4K and sizeof(struct page) instead of 64. If we have a kernel built with different struct page size the previous patch should handle marking the namespace disabled. Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/label.c | 2 +-

[PATCH v4 5/6] mm/nvdimm: Use correct alignment when looking at first pfn from a region

2019-06-20 Thread Aneesh Kumar K.V
vmem_altmap_offset() adjust the section aligned base_pfn offset. So we need to make sure we account for the same when computing base_pfn. ie, for altmap_valid case, our pfn_first should be: pfn_first = altmap->base_pfn + vmem_altmap_offset(altmap); Signed-off-by: Aneesh Kumar K.V ---

Re: [PATCH v2 42/52] powerpc/64s/exception: machine check fwnmi does not trigger when in HV mode

2019-06-20 Thread Mahesh Jagannath Salgaonkar
On 6/20/19 10:44 AM, Nicholas Piggin wrote: > Remove dead code. > > Signed-off-by: Nicholas Piggin > --- > arch/powerpc/kernel/exceptions-64s.S | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/arch/powerpc/kernel/exceptions-64s.S > b/arch/powerpc/kernel/exceptions-64s.S > index

Re: [PATCH v2 43/52] powerpc/64s/exception: machine check early only runs in HV mode

2019-06-20 Thread Mahesh J Salgaonkar
On 2019-06-20 15:14:50 Thu, Nicholas Piggin wrote: > machine_check_common_early and machine_check_handle_early only run in > HVMODE. Remove dead code. That's not true. For pseries guest with FWNMI enabled hypervisor, machine_check_common_early gets called in non-HV mode as well.

[PATCH v2 0/6] mm: Further memory block device cleanups

2019-06-20 Thread David Hildenbrand
@Andrew: Only patch 1 and 6 changed. The patches are based on the same state as the previous patches (replace the old ones if possible). Some further cleanups around memory block devices. Especially, clean up and simplify walk_memory_range(). Including some other minor cleanups. Compiled +

[PATCH v2 2/6] drivers/base/memory: Use "unsigned long" for block ids

2019-06-20 Thread David Hildenbrand
Block ids are just shifted section numbers, so let's also use "unsigned long" for them, too. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git

[PATCH v2 6/6] drivers/base/memory.c: Get rid of find_memory_block_hinted()

2019-06-20 Thread David Hildenbrand
No longer needed, let's remove it. Also, drop the "hint" parameter completely from "find_memory_block_by_id", as nobody needs it anymore. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: "mike.tra...@hpe.com" Signed-off-by: David

Re: [PATCH v2 43/52] powerpc/64s/exception: machine check early only runs in HV mode

2019-06-20 Thread Mahesh Jagannath Salgaonkar
On 6/20/19 3:46 PM, Nicholas Piggin wrote: > Mahesh J Salgaonkar's on June 20, 2019 7:53 pm: >> On 2019-06-20 15:14:50 Thu, Nicholas Piggin wrote: >>> machine_check_common_early and machine_check_handle_early only run in >>> HVMODE. Remove dead code. >> >> That's not true. For pseries guest with

[PATCH v2 5/6] mm/memory_hotplug: Move and simplify walk_memory_blocks()

2019-06-20 Thread David Hildenbrand
Let's move walk_memory_blocks() to the place where memory block logic resides and simplify it. While at it, add a type for the callback function. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: David Hildenbrand Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: Andrew Banman

[PATCH v4 2/6] mm/nvdimm: Add page size and struct page size to pfn superblock

2019-06-20 Thread Aneesh Kumar K.V
This is needed so that we don't wrongly initialize a namespace which doesn't have enough space reserved for holding struct pages with the current kernel. Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/pfn.h | 5 - drivers/nvdimm/pfn_devs.c | 27 ++- 2 files

Re: [PATCH v2] ocxl: Allow contexts to be attached with a NULL mm

2019-06-20 Thread Frederic Barrat
Le 20/06/2019 à 06:12, Alastair D'Silva a écrit : From: Alastair D'Silva If an OpenCAPI context is to be used directly by a kernel driver, there may not be a suitable mm to use. The patch makes the mm parameter to ocxl_context_attach optional. Signed-off-by: Alastair D'Silva --- Thanks

[PATCH v2 1/6] mm: Section numbers use the type "unsigned long"

2019-06-20 Thread David Hildenbrand
We are using a mixture of "int" and "unsigned long". Let's make this consistent by using "unsigned long" everywhere. We'll do the same with memory block ids next. While at it, turn the "unsigned long i" in removable_show() into an int - sections_per_block is an int. Cc: Greg Kroah-Hartman Cc:

[PATCH v2 4/6] mm/memory_hotplug: Rename walk_memory_range() and pass start+size instead of pfns

2019-06-20 Thread David Hildenbrand
walk_memory_range() was once used to iterate over sections. Now, it iterates over memory blocks. Rename the function, fixup the documentation. Also, pass start+size instead of PFNs, which is what most callers already have at hand. (we'll rework link_mem_sections() most probably soon) Follow-up

Re: switch the remaining architectures to use generic GUP v3

2019-06-20 Thread Christoph Hellwig
I just noticed I didn't have Andrew explicitly on the receipents list, so adding him. Is everyone happy enough to give this a spin in -mm and linux-next?

Re: [PATCH 16/16] mm: pass get_user_pages_fast iterator arguments in a structure

2019-06-20 Thread Nicholas Piggin
Linus Torvalds's on June 12, 2019 11:09 am: > On Tue, Jun 11, 2019 at 2:55 PM Nicholas Piggin wrote: >> >> What does this do for performance? I've found this pattern can be >> bad for store aliasing detection. > > I wouldn't expect it to be noticeable, and the lack of argument > reloading etc

[PATCH v3 0/6] mm: Further memory block device cleanups

2019-06-20 Thread David Hildenbrand
@Andrew: Only patch 1, 4 and 6 changed compared to v1. Some further cleanups around memory block devices. Especially, clean up and simplify walk_memory_range(). Including some other minor cleanups. Compiled + tested on x86 with DIMMs under QEMU. Compile-tested on ppc64. v2 -> v3: -

[PATCH v3 3/6] mm: Make register_mem_sect_under_node() static

2019-06-20 Thread David Hildenbrand
It is only used internally. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Keith Busch Cc: Oscar Salvador Signed-off-by: David Hildenbrand --- drivers/base/node.c | 3 ++- include/linux/node.h | 7 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git

[PATCH v3 1/6] mm: Section numbers use the type "unsigned long"

2019-06-20 Thread David Hildenbrand
We are using a mixture of "int" and "unsigned long". Let's make this consistent by using "unsigned long" everywhere. We'll do the same with memory block ids next. While at it, turn the "unsigned long i" in removable_show() into an int - sections_per_block is an int. Cc: Greg Kroah-Hartman Cc:

[PATCH v3 4/6] mm/memory_hotplug: Rename walk_memory_range() and pass start+size instead of pfns

2019-06-20 Thread David Hildenbrand
walk_memory_range() was once used to iterate over sections. Now, it iterates over memory blocks. Rename the function, fixup the documentation. Also, pass start+size instead of PFNs, which is what most callers already have at hand. (we'll rework link_mem_sections() most probably soon) Follow-up

Re: [PATCH v2 6/6] drivers/base/memory.c: Get rid of find_memory_block_hinted()

2019-06-20 Thread David Hildenbrand
On 20.06.19 12:35, David Hildenbrand wrote: > No longer needed, let's remove it. Also, drop the "hint" parameter > completely from "find_memory_block_by_id", as nobody needs it anymore. > > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Andrew Morton > Cc: Stephen Rothwell > Cc: Pavel

[PATCH v3 2/6] drivers/base/memory: Use "unsigned long" for block ids

2019-06-20 Thread David Hildenbrand
Block ids are just shifted section numbers, so let's also use "unsigned long" for them, too. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git

[PATCH v3 6/6] drivers/base/memory.c: Get rid of find_memory_block_hinted()

2019-06-20 Thread David Hildenbrand
No longer needed, let's remove it. Also, drop the "hint" parameter completely from "find_memory_block_by_id", as nobody needs it anymore. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: "mike.tra...@hpe.com" Signed-off-by: David

Re: [PATCH 16/16] mm: pass get_user_pages_fast iterator arguments in a structure

2019-06-20 Thread Linus Torvalds
On Thu, Jun 20, 2019 at 5:19 AM Nicholas Piggin wrote: > > The processor aliasing problem happens because the struct will > be initialised with stores using one base register (e.g., stack > register), and then same memory is loaded using a different > register (e.g., parameter register). Hmm.

[PATCH v3 5/6] mm/memory_hotplug: Move and simplify walk_memory_blocks()

2019-06-20 Thread David Hildenbrand
Let's move walk_memory_blocks() to the place where memory block logic resides and simplify it. While at it, add a type for the callback function. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: David Hildenbrand Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: Andrew Banman

Re: [PATCH v2 4/6] mm/memory_hotplug: Rename walk_memory_range() and pass start+size instead of pfns

2019-06-20 Thread David Hildenbrand
On 20.06.19 18:05, Nathan Chancellor wrote: > On Thu, Jun 20, 2019 at 12:35:18PM +0200, David Hildenbrand wrote: >> walk_memory_range() was once used to iterate over sections. Now, it >> iterates over memory blocks. Rename the function, fixup the >> documentation. Also, pass start+size instead of

[PATCH 06/13] powerpc/mce: Do not process notifier-handled UE events

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab Signed-off-by: Reza Arbab --- arch/powerpc/include/asm/mce.h | 3 ++- arch/powerpc/kernel/mce.c | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/mce.h b/arch/powerpc/include/asm/mce.h index 948bef579086..240dd1fdfe35

[PATCH 07/13] powerpc/mce: Add fixup address to UE events

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab If the instruction causing a UE has an exception table entry with fixup address, save it in the machine_check_event struct. If a machine check notifier callback returns NOTIFY_STOP to indicate it has handled the error, set nip to continue execution from the fixup address.

Re: [PATCH 2/4] powerpc/powernv: remove the unused tunneling exports

2019-06-20 Thread Oliver O'Halloran
On Thu, May 23, 2019 at 5:51 PM Christoph Hellwig wrote: > > These have been unused ever since they've been added to the kernel. > > Signed-off-by: Christoph Hellwig > --- > arch/powerpc/include/asm/pnv-pci.h| 4 -- > arch/powerpc/platforms/powernv/pci-ioda.c | 4 +- >

[PATCH 08/13] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-06-20 Thread Santosh Sivaraj
From: Balbir Singh The pmem infrastructure uses memcpy_mcsafe in the pmem layer so as to convert machine check exceptions into a return value on failure in case a machine check exception is encountered during the memcpy. This patch largely borrows from the copyuser_power7 logic and does not add

[PATCH] powerpc/powernv: Rename pe_level_printk to pe_printk and embed KERN_LEVEL in format

2019-06-20 Thread Joe Perches
Remove the separate KERN_ from each pe_level_printk and instead add the KERN_ to the format. pfix in pe_level_printk could also be used uninitialized so add a new else and set pfx to the hex value of pe->flags. Rename pe_level_printk to pe_printk and update the pe_ macros. Signed-off-by: Joe

Re: [PATCH v2] ocxl: Allow contexts to be attached with a NULL mm

2019-06-20 Thread Andrew Donnellan
On 20/6/19 2:12 pm, Alastair D'Silva wrote: From: Alastair D'Silva If an OpenCAPI context is to be used directly by a kernel driver, there may not be a suitable mm to use. The patch makes the mm parameter to ocxl_context_attach optional. Signed-off-by: Alastair D'Silva Acked-by: Andrew

[PATCH 01/13] powerpc/mce: Make machine_check_ue_event() static

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab The function doesn't get used outside this file, so make it static. Signed-off-by: Reza Arbab --- arch/powerpc/kernel/mce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c index

[PATCH 00/13] powerpc: implement machine check safe memcpy

2019-06-20 Thread Santosh Sivaraj
During a memcpy from a pmem device, if a machine check exception is generated we end up in a panic. In case of fsdax read, this should only result in a -EIO. Avoid MCE by implementing memcpy_mcsafe. Before this patch series: ``` bash-4.4# mount -o dax /dev/pmem0 /mnt/pmem/ [ 7621.714094]

[PATCH 13/13] powerpc: add machine check safe copy_to_user

2019-06-20 Thread Santosh Sivaraj
Use memcpy_mcsafe() implementation to define copy_to_user_mcsafe() Signed-off-by: Santosh Sivaraj --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/uaccess.h | 12 2 files changed, 13 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig

[PATCH 12/13] powerpc/memcpy_mcsafe: return remaining bytes

2019-06-20 Thread Santosh Sivaraj
memcpy_mcsafe currently return -EFAULT on a machine check exception, change it to return the remaining bytes that needs to be copied, so that machine check safe copy_to_user can maintain the same behavior as copy_to_user. Signed-off-by: Santosh Sivaraj --- arch/powerpc/lib/memcpy_mcsafe_64.S |

[PATCH 03/13] powerpc/mce: Add MCE notification chain

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab Signed-off-by: Reza Arbab --- arch/powerpc/include/asm/asm-prototypes.h | 1 + arch/powerpc/include/asm/mce.h| 4 arch/powerpc/kernel/exceptions-64s.S | 4 arch/powerpc/kernel/mce.c | 22 ++ 4 files changed, 31

[PATCH 04/13] powerpc/mce: Move machine_check_ue_event() call

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab Move the call site of machine_check_ue_event() slightly later in the MCE codepath. No functional change intended--this is prep for a later patch to conditionally skip the call. Signed-off-by: Reza Arbab --- arch/powerpc/kernel/mce.c | 5 - 1 file changed, 4 insertions(+),

[PATCH kernel] powerpc/of/pci: Rewrite pci_parse_of_flags

2019-06-20 Thread Alexey Kardashevskiy
The existing code uses bunch of hardcoded values from the PCI Bus Binding to IEEE Std 1275 spec; and it does so in quite non-obvious way. This defines fields from the cell#0 of the "reg" property of a PCI device and uses them for parsing. This should cause no behavioral change. Signed-off-by:

[PATCH 05/13] powerpc/mce: Allow notifier callback to handle MCE

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab If a notifier returns NOTIFY_STOP, consider the MCE handled, just as we do when machine_check_early() returns 1. Signed-off-by: Reza Arbab --- arch/powerpc/include/asm/asm-prototypes.h | 2 +- arch/powerpc/kernel/exceptions-64s.S | 3 +++ arch/powerpc/kernel/mce.c

Re: [PATCH 4/4] powerpc/powernv: remove the unused vas_win_paste_addr and vas_win_id functions

2019-06-20 Thread Oliver O'Halloran
On Thu, May 23, 2019 at 5:56 PM Christoph Hellwig wrote: > > These two function have never been used since they were added to the > kernel. > > Signed-off-by: Christoph Hellwig > --- > arch/powerpc/include/asm/vas.h | 10 -- > arch/powerpc/platforms/powernv/vas-window.c |

[PATCH 02/13] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-06-20 Thread Santosh Sivaraj
From: Balbir Singh The code currently assumes PAGE_SHIFT as the shift value of the pfn, this works correctly (mostly) for user space pages, but the correct thing to do is 1. Extract the shift value returned via the pte-walk API's 2. Use the shift value to access the instruction address. Note,

[PATCH 11/13] powerpc/64s: Save r13 in machine_check_common_early

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab Testing my memcpy_mcsafe() work in progress with an injected UE, I get an error like this immediately after the function returns: BUG: Unable to handle kernel data access at 0x7fff84dec8f8 Faulting instruction address: 0xc008009c00b0 Oops: Kernel access of bad area, sig: 11

[PATCH 10/13] powerpc/mce: Enable MCE notifiers in external modules

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab Signed-off-by: Reza Arbab --- arch/powerpc/kernel/exceptions-64s.S | 6 ++ arch/powerpc/kernel/mce.c| 2 ++ 2 files changed, 8 insertions(+) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index

[PATCH 09/13] powerpc/mce: Handle memcpy_mcsafe()

2019-06-20 Thread Santosh Sivaraj
From: Reza Arbab Add an mce notifier intended to service memcpy_mcsafe(). The notifier uses this heuristic; if a UE occurs when accessing device memory, and the faulting instruction had a fixup entry, the callback will return NOTIFY_STOP. This causes the notification mechanism to consider the

Re: [PATCH v2 4/6] mm/memory_hotplug: Rename walk_memory_range() and pass start+size instead of pfns

2019-06-20 Thread Nathan Chancellor
On Thu, Jun 20, 2019 at 12:35:18PM +0200, David Hildenbrand wrote: > walk_memory_range() was once used to iterate over sections. Now, it > iterates over memory blocks. Rename the function, fixup the > documentation. Also, pass start+size instead of PFNs, which is what most > callers already have

Re: [PATCH] powerpc: enable a 30-bit ZONE_DMA for 32-bit pmac

2019-06-20 Thread Michael Ellerman
Benjamin Herrenschmidt writes: > On Wed, 2019-06-19 at 22:32 +1000, Michael Ellerman wrote: >> Christoph Hellwig writes: >> > Any chance this could get picked up to fix the regression? >> >> Was hoping Ben would Ack it. He's still powermac maintainer :) >> >> I guess he OK'ed it in the other