[PATCH v2 0/6] Memory corruption may occur due to incorrent tlb flush

2020-03-03 Thread Santosh Sivaraj
The TLB flush optimisation (a46cc7a90f: powerpc/mm/radix: Improve TLB/PWC flushes) may result in random memory corruption. Any concurrent page-table walk could end up with a Use-after-Free. Even on UP this might give issues, since mmu_gather is preemptible these days. An interrupt or preempted task

[PATCH v2 1/6] asm-generic/tlb: Track freeing of page-table directories in struct mmu_gather

2020-03-03 Thread Santosh Sivaraj
higher up the tree. Add a new bit to the flags bitfield in struct mmu_gather so that the architecture code can operate accordingly if it's the intermediate levels being invalidated. Signed-off-by: Peter Zijlstra Signed-off-by: Will Deacon Cc: # 4.19 Signed-off-by: Santosh Sivaraj [sa

[PATCH v2 2/6] asm-generic/tlb: Track which levels of the page tables have been cleared

2020-03-03 Thread Santosh Sivaraj
that are cleared and provide a means to query the smallest granule required for invalidation. Signed-off-by: Will Deacon Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for upcoming tlbflush backports] --- include/asm-generic/tlb.h | 58 +-- mm

[PATCH v2 3/6] asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE

2020-03-03 Thread Santosh Sivaraj
require this. Make it an opt-out, instead of an opt-in. No change in behavior intended. Signed-off-by: Peter Zijlstra (Intel) Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for upcoming tlbflush backports] --- arch/Kconfig | 2 +- arch/powerpc/Kconfig | 1 + arch

[PATCH v2 4/6] powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case

2020-03-03 Thread Santosh Sivaraj
83522-2-aneesh.ku...@linux.ibm.com Signed-off-by: Aneesh Kumar K.V Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported for 4.19 stable] --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/book3s/32/pgalloc.h | 8 arch/powerpc/include/asm/book3s

[PATCH v2 5/6] mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush

2020-03-03 Thread Santosh Sivaraj
-aneesh.ku...@linux.ibm.com Fixes: a46cc7a90fd8 ("powerpc/mm/radix: Improve TLB/PWC flushes") Signed-off-by: Peter Zijlstra (Intel) Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported to 4.19 stable] --- arch/Kconfig| 3 --- arch/powerpc/Kconfig

[PATCH v2 6/6] asm-generic/tlb: avoid potential double flush

2020-03-03 Thread Santosh Sivaraj
ibm.com Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Aneesh Kumar K.V Reported-by: "Aneesh Kumar K.V" Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported to 4.19 stable] --- include/asm-generic/tlb.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --

[PATCH v3 0/6] Memory corruption may occur due to incorrent tlb flush

2020-03-12 Thread Santosh Sivaraj
The TLB flush optimisation (a46cc7a90f: powerpc/mm/radix: Improve TLB/PWC flushes) may result in random memory corruption. Any concurrent page-table walk could end up with a Use-after-Free. Even on UP this might give issues, since mmu_gather is preemptible these days. An interrupt or preempted task

[PATCH v3 1/6] asm-generic/tlb: Track freeing of page-table directories in struct mmu_gather

2020-03-12 Thread Santosh Sivaraj
higher up the tree. Add a new bit to the flags bitfield in struct mmu_gather so that the architecture code can operate accordingly if it's the intermediate levels being invalidated. Signed-off-by: Peter Zijlstra Signed-off-by: Will Deacon Cc: # 4.19 Signed-off-by: Santosh Sivaraj [sa

[PATCH v3 2/6] asm-generic/tlb: Track which levels of the page tables have been cleared

2020-03-12 Thread Santosh Sivaraj
that are cleared and provide a means to query the smallest granule required for invalidation. Signed-off-by: Will Deacon Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for upcoming tlbflush backports] --- include/asm-generic/tlb.h | 58 +-- mm

[PATCH v3 3/6] asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE

2020-03-12 Thread Santosh Sivaraj
require this. Make it an opt-out, instead of an opt-in. No change in behavior intended. Signed-off-by: Peter Zijlstra (Intel) Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for upcoming tlbflush backports] --- arch/Kconfig | 2 +- arch/powerpc/Kconfig | 1 + arch

[PATCH v3 4/6] powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case

2020-03-12 Thread Santosh Sivaraj
83522-2-aneesh.ku...@linux.ibm.com Signed-off-by: Aneesh Kumar K.V Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported for 4.19 stable] --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/book3s/32/pgalloc.h | 8 arch/powerpc/include/asm/book3s/

[PATCH v3 5/6] mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush

2020-03-12 Thread Santosh Sivaraj
-aneesh.ku...@linux.ibm.com Fixes: a46cc7a90fd8 ("powerpc/mm/radix: Improve TLB/PWC flushes") Signed-off-by: Peter Zijlstra (Intel) Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported to 4.19 stable] --- arch/Kconfig| 3 --- arch/powerpc/Kconfig

[PATCH v3 6/6] asm-generic/tlb: avoid potential double flush

2020-03-12 Thread Santosh Sivaraj
ibm.com Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Aneesh Kumar K.V Reported-by: "Aneesh Kumar K.V" Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported to 4.19 stable] --- include/asm-generic/tlb.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --

[PATCH] papr/scm: Add bad memory ranges to nvdimm bad ranges

2020-04-01 Thread Santosh Sivaraj
Subscribe to the MCE notification and add the physical address which generated a memory error to nvdimm bad range. Signed-off-by: Santosh Sivaraj --- This patch depends on "powerpc/mce: Add MCE notification chain" [1]. Unlike the previous series[2], the patch adds badblock registr

Re: [PATCH] papr/scm: Add bad memory ranges to nvdimm bad ranges

2020-04-09 Thread Santosh Sivaraj
On Wed, Apr 1, 2020 at 1:18 PM Santosh Sivaraj wrote: > Subscribe to the MCE notification and add the physical address which > generated a memory error to nvdimm bad range. > > Signed-off-by: Santosh Sivaraj > --- > Any comments on this? Thanks, Santosh > This patch de

Re: [PATCH] papr/scm: Add bad memory ranges to nvdimm bad ranges

2020-04-13 Thread Santosh Sivaraj
-dev/20200330071219.12284-1-ganes...@linux.ibm.com/ Thanks, Santosh > > url: > https://github.com/0day-ci/linux/commits/Santosh-Sivaraj/papr-scm-Add-bad-memory-ranges-to-nvdimm-bad-ranges/20200401-171233 > base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linu

Re: [PATCH] papr/scm: Add bad memory ranges to nvdimm bad ranges

2020-04-13 Thread Santosh Sivaraj
Mahesh J Salgaonkar writes: > On 2020-04-01 13:17:41 Wed, Santosh Sivaraj wrote: >> Subscribe to the MCE notification and add the physical address which >> generated a memory error to nvdimm bad range. >> >> Signed-off-by: Santosh Sivaraj >> --- >> >

[PATCH v2] papr/scm: Add bad memory ranges to nvdimm bad ranges

2020-04-16 Thread Santosh Sivaraj
Subscribe to the MCE notification and add the physical address which generated a memory error to nvdimm bad range. Reviewed-by: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/platforms/pseries/papr_scm.c | 98 ++- 1 file changed, 97 insertions(+), 1

[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 b18df633eae9..e78c4f1

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

2019-06-20 Thread Santosh Sivaraj
erpc/mce: Allow notifier callback to handle MCE powerpc/mce: Do not process notifier-handled UE events powerpc/mce: Add fixup address to UE events powerpc/mce: Handle memcpy_mcsafe() powerpc/mce: Enable MCE notifiers in external modules powerpc/64s: Save r13 in machine_check_common_early San

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

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

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

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

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

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

[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 c83e38a403fd..311f1392a2

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

[v2 01/12] powerpc/mce: Make machine_check_ue_event() static

2019-07-01 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 b18df633eae9..e78c4f1

[v2 05/12] powerpc/mce: Allow notifier callback to handle MCE

2019-07-01 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/include/asm/mce.h| 3 +- arch/powerpc/kernel/exceptions-6

[v2 06/12] powerpc/mce: Add fixup address to UE events

2019-07-01 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. Signe

[v2 07/12] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-07-01 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

[v2 08/12] powerpc/mce: Handle memcpy_mcsafe()

2019-07-01 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 M

[v2 09/12] powerpc/mce: Enable MCE notifiers in external modules

2019-07-01 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 c83e38a403fd..311f1392a2

[v2 10/12] powerpc/memcpy_mcsafe: return remaining bytes

2019-07-01 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

[v2 11/12] powerpc: add machine check safe copy_to_user

2019-07-01 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

[v2 12/12] powerpc/64s: Save r13 in machine_check_common_early

2019-07-01 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

[v2 00/12] powerpc: implement machine check safe memcpy

2019-07-01 Thread Santosh Sivaraj
k to handle MCE powerpc/mce: Add fixup address to UE events powerpc/mce: Handle memcpy_mcsafe() powerpc/mce: Enable MCE notifiers in external modules powerpc/64s: Save r13 in machine_check_common_early Santosh Sivaraj (2): powerpc/memcpy_mcsafe: return remaining bytes powerpc: add mac

[v2 02/12] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-01 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, t

[v2 03/12] powerpc/mce: Add MCE notification chain

2019-07-01 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 i

[v2 04/12] powerpc/mce: Move machine_check_ue_event() call

2019-07-01 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(+),

[v3 1/7] powerpc/mce: Make machine_check_ue_event() static

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

[v3 0/7] powerpc: implement machine check safe memcpy

2019-07-05 Thread Santosh Sivaraj
tatic powerpc/64s: save r13 in MCE handler (simulator workaroud) Santosh Sivaraj (3): powerpc/mce: Handle UE event for memcpy_mcsafe powerpc/memcpy_mcsafe: return remaining bytes powerpc: add machine check safe copy_to_user arch/powerpc/Kconfig | 1 + arch/powerpc/incl

[v3 2/7] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-05 Thread Santosh Sivaraj
ic and can handle shift values returned. Fixes: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/

[v3 3/7] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-07-05 Thread Santosh Sivaraj
the VMX optimizations, largely to keep the patch simple. If needed those optimizations can be folded in. Signed-off-by: Balbir Singh Acked-by: Nicholas Piggin [ar...@linux.ibm.com: Added symbol export] Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/string.h | 2 + arch/powerpc

[v3 4/7] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-07-05 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue exucution at the fixup entry. Stop processing the event further or print it. Based-on-patch-by: Reza Arbab Cc: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h

[v3 5/7] powerpc/memcpy_mcsafe: return remaining bytes

2019-07-05 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

[v3 6/7] powerpc: add machine check safe copy_to_user

2019-07-05 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

[v3 7/7] powerpc/64s: save r13 in MCE handler (simulator workaroud)

2019-07-05 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

[v4 0/6] powerpc: implement machine check safe memcpy

2019-07-06 Thread Santosh Sivaraj
owerpc/mce: Bug fixes for MCE handling in kernel space powerpc/memcpy: Add memcpy_mcsafe for pmem Reza Arbab (2): powerpc/mce: Make machine_check_ue_event() static powerpc/64s: save r13 in MCE handler (simulator workaroud) Santosh Sivaraj (2): powerpc/mce: Handle UE event for memcpy_mcsa

[v4 1/6] powerpc/mce: Make machine_check_ue_event() static

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

[v4 2/6] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-06 Thread Santosh Sivaraj
ic and can handle shift values returned. Fixes: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/

[v4 3/6] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-07-06 Thread Santosh Sivaraj
] Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/string.h | 2 + arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/memcpy_mcsafe_64.S | 239 3 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/lib/memcpy_mcsafe_64

[v4 4/6] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-07-06 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue exucution at the fixup entry. Stop processing the event further or print it. Based-on-patch-by: Reza Arbab Cc: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h

[v4 5/6] powerpc: add machine check safe copy_to_user

2019-07-06 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 | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig

[v4 6/6] powerpc/64s: save r13 in MCE handler (simulator workaroud)

2019-07-06 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

[v5 0/6] powerpc: implement machine check safe memcpy

2019-07-09 Thread Santosh Sivaraj
or; not to be merged] v2: * Don't set RI bit explicitly [mahesh] * Re-ordered series to get r13 workaround as the last patch --- Balbir Singh (2): powerpc/mce: Fix MCE handling for huge pages powerpc/memcpy: Add memcpy_mcsafe for pmem Reza Arbab (1): powerpc/mce: Make machine_check_ue_even

[v5 1/6] powerpc/mce: Make machine_check_ue_event() static

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

[v5 2/6] powerpc/mce: Fix MCE handling for huge pages

2019-07-09 Thread Santosh Sivaraj
("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h | 3 ++- arch/powerpc/kernel/mce_power.c

[v5 3/6] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-07-09 Thread Santosh Sivaraj
] Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/string.h | 2 + arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/memcpy_mcsafe_64.S | 239 3 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/lib/memcpy_mcsafe_64

[v5 4/6] extable: Add function to search only kernel exception table

2019-07-09 Thread Santosh Sivaraj
In real mode, the search_exception tables cannot be called because it also searches the module exception tables if entry is not found in the kernel exception tables. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Nicholas Piggin Signed-off-by: Santosh Sivaraj --- include/linux/extable.h | 2

[v5 6/6] powerpc: add machine check safe copy_to_user

2019-07-09 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 | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig

[v5 5/6] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-07-09 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue execution at the fixup entry. Stop processing the event further or print it. Based-on-patch-by: Reza Arbab Cc: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h

[v6 0/6] powerpc: implement machine check safe memcpy

2019-07-28 Thread Santosh Sivaraj
esh] * Re-ordered series to get r13 workaround as the last patch -- Balbir Singh (2): powerpc/mce: Fix MCE handling for huge pages powerpc/memcpy: Add memcpy_mcsafe for pmem Reza Arbab (1): powerpc/mce: Make machine_check_ue_event() static Santosh Sivaraj (3): extable: Add function to search on

[v6 1/6] powerpc/mce: Make machine_check_ue_event() static

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

[v6 2/6] powerpc/mce: Fix MCE handling for huge pages

2019-07-28 Thread Santosh Sivaraj
: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab [santosh: return physical address instead of pfn; change commit log] Signed-off-by: Santosh Sivaraj --- ar

[v6 3/6] extable: Add function to search only kernel exception table

2019-07-28 Thread Santosh Sivaraj
Gleixner Cc: Ingo Molnar Cc: Nicholas Piggin Signed-off-by: Santosh Sivaraj Reviewed-by: Nicholas Piggin --- include/linux/extable.h | 2 ++ kernel/extable.c| 11 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/extable.h b/include/linux/extable.h

[v6 4/6] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-07-28 Thread Santosh Sivaraj
] Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/string.h | 2 + arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/memcpy_mcsafe_64.S | 239 3 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/lib/memcpy_mcsafe_64

[v6 5/6] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-07-28 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue execution at the fixup entry. Stop processing the event further or print it. Based-on-patch-by: Reza Arbab Cc: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h

[v6 6/6] powerpc: add machine check safe copy_to_user

2019-07-28 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 | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig

[PATCH] powerpc/kvm: Fall through switch case explicitly

2019-07-28 Thread Santosh Sivaraj
Implicit fallthrough warning was enabled globally which broke the build. Make it explicit with a `fall through` comment. Signed-off-by: Santosh Sivaraj --- arch/powerpc/kvm/book3s_32_mmu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm

[PATCH] powerpc/mce: Schedule work from irq_work

2019-08-01 Thread Santosh Sivaraj
schedule_work() cannot be called from MCE exception context as MCE can interrupt even in interrupt disabled context. fixes: 733e4a4c ("powerpc/mce: hookup memory_failure for UE errors") Signed-off-by: Santosh Sivaraj --- arch/powerpc/kernel/mce.c | 8 +--- 1 file changed, 5 insert

[PATCH v7 0/7] powerpc: implement machine check safe memcpy

2019-08-04 Thread Santosh Sivaraj
erged] v2: * Don't set RI bit explicitly [mahesh] * Re-ordered series to get r13 workaround as the last patch -- Balbir Singh (2): powerpc/mce: Fix MCE handling for huge pages powerpc/memcpy: Add memcpy_mcsafe for pmem Reza Arbab (1): powerpc/mce: Make machine_check_ue_event() static

[PATCH v7 1/7] powerpc/mce: Schedule work from irq_work

2019-08-04 Thread Santosh Sivaraj
schedule_work() cannot be called from MCE exception context as MCE can interrupt even in interrupt disabled context. fixes: 733e4a4c ("powerpc/mce: hookup memory_failure for UE errors") Signed-off-by: Santosh Sivaraj --- arch/powerpc/kernel/mce.c | 8 +--- 1 file changed, 5 insert

[PATCH v7 2/7] powerpc/mce: Make machine_check_ue_event() static

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

[PATCH v7 3/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-04 Thread Santosh Sivaraj
: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab [santosh: return physical address instead of pfn; change commit log] Signed-off-by: Santosh Sivaraj --- ar

[PATCH v7 4/7] extable: Add function to search only kernel exception table

2019-08-04 Thread Santosh Sivaraj
Gleixner Cc: Ingo Molnar Cc: Nicholas Piggin Signed-off-by: Santosh Sivaraj Reviewed-by: Nicholas Piggin --- include/linux/extable.h | 2 ++ kernel/extable.c| 11 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/extable.h b/include/linux/extable.h

[PATCH v7 5/7] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-08-04 Thread Santosh Sivaraj
] Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/string.h | 2 + arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/memcpy_mcsafe_64.S | 239 3 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/lib/memcpy_mcsafe_64

[PATCH v7 6/7] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-08-04 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue execution at the fixup entry. Stop processing the event further or print it. Based-on-patch-by: Reza Arbab Cc: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h

[PATCH v7 7/7] powerpc: add machine check safe copy_to_user

2019-08-04 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 | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig

[PATCH v8 0/7] powerpc: implement machine check safe memcpy

2019-08-07 Thread Santosh Sivaraj
y: Add memcpy_mcsafe for pmem Reza Arbab (1): powerpc/mce: Make machine_check_ue_event() static Santosh Sivaraj (4): powerpc/mce: Schedule work from irq_work extable: Add function to search only kernel exception table powerpc/mce: Handle UE event for memcpy_mcsafe powerpc: add machine che

[PATCH v8 1/7] powerpc/mce: Schedule work from irq_work

2019-08-07 Thread Santosh Sivaraj
schedule_work() cannot be called from MCE exception context as MCE can interrupt even in interrupt disabled context. fixes: 733e4a4c ("powerpc/mce: hookup memory_failure for UE errors") Signed-off-by: Santosh Sivaraj --- arch/powerpc/kernel/mce.c | 8 +--- 1 file changed, 5 insert

[PATCH v8 2/7] powerpc/mce: Make machine_check_ue_event() static

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

[PATCH v8 3/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-07 Thread Santosh Sivaraj
: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab Co-developed-by: Santosh Sivaraj Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h |

[PATCH v8 4/7] extable: Add function to search only kernel exception table

2019-08-07 Thread Santosh Sivaraj
Gleixner Cc: Ingo Molnar Cc: Nicholas Piggin Signed-off-by: Santosh Sivaraj Reviewed-by: Nicholas Piggin --- include/linux/extable.h | 2 ++ kernel/extable.c| 11 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/extable.h b/include/linux/extable.h

[PATCH v8 5/7] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-08-07 Thread Santosh Sivaraj
largely borrows from the copyuser_power7 logic and does not add the VMX optimizations, largely to keep the patch simple. If needed those optimizations can be folded in. Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Added symbol export] Co-developed-by: Santosh Sivaraj Signed-off-by: Santosh

[PATCH v8 6/7] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-08-07 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue execution at the fixup entry. Stop processing the event further or print it. Co-developed-by: Reza Arbab Signed-off-by: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include

[PATCH v8 7/7] powerpc: add machine check safe copy_to_user

2019-08-07 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 | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig

Re: [PATCH v8 3/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-10 Thread Santosh Sivaraj
Mahesh Jagannath Salgaonkar writes: > On 8/7/19 8:26 PM, Santosh Sivaraj wrote: >> From: Balbir Singh >> >> The current code would fail on huge pages addresses, since the shift would >> be incorrect. Use the correct page shift value returned by >> __find_linux_

Re: [PATCH v8 7/7] powerpc: add machine check safe copy_to_user

2019-08-10 Thread Santosh Sivaraj
Michael Ellerman writes: > Santosh Sivaraj writes: >> 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 | 14

[PATCH v9 0/7] powerpc: implement machine check safe memcpy

2019-08-12 Thread Santosh Sivaraj
-- Balbir Singh (2): powerpc/mce: Fix MCE handling for huge pages powerpc/memcpy: Add memcpy_mcsafe for pmem Reza Arbab (1): powerpc/mce: Make machine_check_ue_event() static Santosh Sivaraj (4): powerpc/mce: Schedule work from irq_work extable: Add function to search only kernel excep

[PATCH v9 1/7] powerpc/mce: Schedule work from irq_work

2019-08-12 Thread Santosh Sivaraj
schedule_work() cannot be called from MCE exception context as MCE can interrupt even in interrupt disabled context. fixes: 733e4a4c ("powerpc/mce: hookup memory_failure for UE errors") Suggested-by: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj Cc: sta...@vger.kernel.org # v4.15+

[PATCH v9 2/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-12 Thread Santosh Sivaraj
: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Balbir Singh [ar...@linux.ibm.com: Fixup pseries_do_memory_failure()] Signed-off-by: Reza Arbab Co-developed-by: Santosh Sivaraj Signed-off-by: Santosh Sivaraj Tested-by: Mahesh Salgaonkar Cc: sta...@vger.

[PATCH v9 3/7] powerpc/mce: Make machine_check_ue_event() static

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

[PATCH v9 4/7] extable: Add function to search only kernel exception table

2019-08-12 Thread Santosh Sivaraj
Gleixner Cc: Ingo Molnar Cc: Nicholas Piggin Signed-off-by: Santosh Sivaraj Reviewed-by: Nicholas Piggin --- include/linux/extable.h | 2 ++ kernel/extable.c| 11 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/extable.h b/include/linux/extable.h

  1   2   3   >