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

2019-08-12 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 v9 6/7] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-08-12 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 v9 5/7] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-08-12 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 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

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

[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 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 0/7] powerpc: implement machine check safe memcpy

2019-08-12 Thread Santosh Sivaraj
owerpc/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 exception table powerpc/mce:

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

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_

[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

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

[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 0/7] powerpc: implement machine check safe memcpy

2019-08-07 Thread Santosh Sivaraj
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 check safe copy_to_user ar

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

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

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

2019-08-05 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 5/7] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-08-05 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 4/7] extable: Add function to search only kernel exception table

2019-08-05 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 3/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-05 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 2/7] powerpc/mce: Make machine_check_ue_event() static

2019-08-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 Reviewed-by: Nicholas Piggin --- arch/powerpc/kernel/mce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

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

2019-08-05 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-05 Thread Santosh Sivaraj
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 Santosh Sivaraj (4): p

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

[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

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

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

2019-07-28 Thread Santosh Sivaraj
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 only kernel exception table

[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

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

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

2019-07-09 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 Santosh

[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

[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 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 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 2/6] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-06 Thread Santosh Sivaraj
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/asm/mce.h

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

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

2019-07-06 Thread Santosh Sivaraj
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_mcsafe powerpc: a

[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

[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 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 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 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 2/7] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-05 Thread Santosh Sivaraj
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/asm/mce.h

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

2019-07-05 Thread Santosh Sivaraj
/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/include/asm/mce.h

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

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

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

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

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

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

2019-07-02 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,

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

2019-07-02 Thread Santosh Sivaraj
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 machine

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

[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

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

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

[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

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

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

[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 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 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 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 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 00/13] powerpc: implement machine check safe memcpy

2019-06-20 Thread Santosh Sivaraj
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 Santosh

[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

Re: [PATCHv4 3/6] powerpc64: Add .opd based function descriptor dereference

2017-11-12 Thread Santosh Sivaraj
at...@gmail.com> > --- > arch/powerpc/include/asm/module.h | 3 +++ > arch/powerpc/include/asm/sections.h | 12 > arch/powerpc/kernel/module_64.c | 14 ++ > arch/powerpc/kernel/vmlinux.lds.S | 2 ++ > 4 files changed, 31 insertions(+) > Looks go

[PATCH v6] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-15 Thread Santosh Sivaraj
/call clock-gettime-monotonic-coarse:vdso: 11 nsec/call CC: Benjamin Herrenschmidt <b...@kernel.crashing.org> Reviewed-by: Naveen N. Rao <naveen.n@linux.vnet.ibm.com> Signed-off-by: Santosh Sivaraj <sant...@fossix.org> --- arch/powerpc/kernel/asm-offsets.c | 2 + a

Re: [PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Santosh Sivaraj
* Segher Boessenkool <seg...@kernel.crashing.org> wrote (on 2017-10-11 17:02:16 +): Hi Segher, > Hi, > > On Wed, Oct 11, 2017 at 02:05:02PM +0530, Santosh Sivaraj wrote: > > +70:ld r8,CFG_TB_UPDATE_COUNT(r3) > > + andi. r0,r8,1

[PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Santosh Sivaraj
/call clock-gettime-monotonic-coarse:vdso: 11 nsec/call CC: Benjamin Herrenschmidt <b...@kernel.crashing.org> Signed-off-by: Santosh Sivaraj <sant...@fossix.org> --- Changelog: v1: - gettimeofday was moved from asm to C - Coarse timer support addition v2: - Moved Syscall fallback

Re: [PATCH v6] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Santosh Sivaraj
* Naveen N. Rao <naveen.n@linux.vnet.ibm.com> wrote (on 2017-10-11 07:04:43 +): > Hi Santosh, > This seems to have gone from v4 to v6 -- did I miss v5? Nope, this is indeed v5, a typo :-( > > On 2017/10/10 11:10PM, Santosh Sivaraj wrote: > > Current vDSO64 impl

[PATCH v6] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-10 Thread Santosh Sivaraj
/call clock-gettime-monotonic-coarse:vdso: 11 nsec/call CC: Benjamin Herrenschmidt <b...@kernel.crashing.org> Signed-off-by: Santosh Sivaraj <sant...@fossix.org> --- arch/powerpc/kernel/asm-offsets.c | 2 + arch/powerpc/kernel/vdso64/gettime

Re: [PATCH v4] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-10 Thread Santosh Sivaraj
* Naveen N. Rao <naveen.n@linux.vnet.ibm.com> wrote (on 2017-10-09 10:39:18 +): > On 2017/10/09 08:09AM, Santosh Sivaraj wrote: > > Current vDSO64 implementation does not have support for coarse clocks > > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), fo

[PATCH v4] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-09 Thread Santosh Sivaraj
/call clock-gettime-monotonic-coarse:vdso: 11 nsec/call CC: Benjamin Herrenschmidt <b...@kernel.crashing.org> Signed-off-by: Santosh Sivaraj <sant...@fossix.org> --- arch/powerpc/kernel/asm-offsets.c | 2 + arch/powerpc/kernel/vdso64/gettime

Re: [PATCH 2/2] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-09 Thread Santosh Sivaraj
* Naveen N. Rao <naveen.n@linux.vnet.ibm.com> wrote (on 2017-10-06 09:28:30 +): > On 2017/09/18 09:23AM, Santosh Sivaraj wrote: > > Current vDSO64 implementation does not have support for coarse clocks > > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), fo

Re: [PATCH 2/2] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-09 Thread Santosh Sivaraj
* Naveen N. Rao <naveen.n@linux.vnet.ibm.com> wrote (on 2017-10-06 11:25:28 +): > On 2017/09/18 09:23AM, Santosh Sivaraj wrote: > > Current vDSO64 implementation does not have support for coarse clocks > > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), fo

Re: [PATCH] powerpc/perf: Fix for core/nest imc call trace on cpuhotplug

2017-10-05 Thread Santosh Sivaraj
if the reference count is alreday zero, before > decrementing > the count, so that the ref count will not hit a negative value. > > > > Signed-off-by: Anju T Sudhakar <a...@linux.vnet.ibm.com> Reviewed-by: Santosh Sivaraj <sant...@fossix.org> > --- > arch/pow

Re: [RFC PATCH] powerpc/perf: Add compact mode pmu support for powernv

2017-10-05 Thread Santosh Sivaraj
* Madhavan Srinivasan wrote (on 2017-10-03 12:25:15 +): > Most of the power processor generation performance monitoring > unit (PMU) driver code is bundled in the kernel and one of those > is enabled/registered based on the oprofile_cpu_type check at > the boot. >

Re: [RFC][PATCH v2 0/7] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers

2017-09-21 Thread Santosh Sivaraj
ardware, so the patches are not > tested. Sorry about that! Tested patch series on ppc64 sucessfully. You may add tested by to the series. Tested-by: Santosh Sivaraj <sant...@fossix.org> Thanks, Santosh > > Another note: > I need to check what is BPF symbol l

[PATCH 2/2] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-09-18 Thread Santosh Sivaraj
: syscall: 167 nsec/call clock-gettime-monotonic-coarse:libc: 15 nsec/call clock-gettime-monotonic-coarse:vdso: 11 nsec/call CC: Benjamin Herrenschmidt <b...@kernel.crashing.org> Signed-off-by: Santosh Sivaraj <sant...@fossix.org> --- arch/powerpc/kernel/asm-offsets.c |

[PATCH 1/2] powerpc/vdso64: Coarse timer support preparatory patch

2017-09-18 Thread Santosh Sivaraj
Reorganize code to make it easy to introduce CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE timer support. Signed-off-by: Santosh Sivaraj <sant...@fossix.org> --- arch/powerpc/kernel/vdso64/gettimeofday.S | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git

Re: [PATCH resend] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-09-07 Thread Santosh Sivaraj
Hi all, Any comments on the below patch? Thanks, Santosh * Santosh Sivaraj <sant...@fossix.org> wrote (on 2017-08-28 13:14:40 +0530): > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back

<    1   2   3   >