With the increase of memory capacity and density, the probability of memory error also increases. The increasing size and density of server RAM in data centers and clouds have shown increased uncorrectable memory errors.
Currently, the kernel has mechanism to recover from hardware memory errors. This patchset provides a new recovery mechanism.
For arm64, the hardware memory error handling in do_sea(), which is divided into two cases: 1. If the user state consumed the memory errors, the solution is to kill the user process and isolate the error page. 2. If the kernel state consumed the memory errors, the solution is to panic.
For case 2, Undifferentiated panic may not be the optimal choice, as it can be handled better. In some scenarios, we can avoid panic, such as uaccess, if the uaccess fails due to memory error, only the user process will be affected, killing the user process and isolating the user page with hardware memory errors is a better choice.
Tong Tiangen (7): uaccess: add generic fallback version of copy_mc_to_user() arm64: add support for machine check error safe arm64: add uaccess to machine check safe mm/hwpoison: return -EFAULT when copy fail in copy_mc_[user]_highpage() arm64: support copy_mc_[user]_highpage() arm64: introduce copy_mc_to_kernel() implementation arm64: add machine check safe sysctl interface
Documentation/admin-guide/sysctl/kernel.rst | 14 ++ arch/arm64/Kconfig | 1 + arch/arm64/include/asm/asm-extable.h | 15 ++ arch/arm64/include/asm/assembler.h | 4 + arch/arm64/include/asm/extable.h | 1 + arch/arm64/include/asm/mte.h | 5 + arch/arm64/include/asm/page.h | 10 + arch/arm64/include/asm/string.h | 5 + arch/arm64/include/asm/uaccess.h | 21 ++ arch/arm64/lib/Makefile | 4 +- arch/arm64/lib/copy_from_user.S | 10 +- arch/arm64/lib/copy_mc_page.S | 89 +++++++ arch/arm64/lib/copy_to_user.S | 10 +- arch/arm64/lib/memcpy_mc.S | 257 ++++++++++++++++++++ arch/arm64/lib/mte.S | 27 ++ arch/arm64/mm/copypage.c | 66 ++++- arch/arm64/mm/extable.c | 21 +- arch/arm64/mm/fault.c | 58 ++++- arch/powerpc/include/asm/uaccess.h | 1 + arch/x86/include/asm/uaccess.h | 1 + include/linux/highmem.h | 16 +- include/linux/uaccess.h | 9 + mm/kasan/shadow.c | 12 + mm/khugepaged.c | 4 +- 24 files changed, 635 insertions(+), 26 deletions(-) create mode 100644 arch/arm64/lib/copy_mc_page.S create mode 100644 arch/arm64/lib/memcpy_mc.S