mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 05:16:53 +07:00
284ce4011b
Currently memory_failure() returns zero if the error was handled. On that result mce_unmap_kpfn() is called to zap the page out of the kernel linear mapping to prevent speculative fetches of potentially poisoned memory. However, in the case of dax mapped devmap pages the page may be in active permanent use by the device driver, so it cannot be unmapped from the kernel. Instead of marking the page not present, marking the page UC should be sufficient for preventing poison from being pre-fetched into the cache. Convert mce_unmap_pfn() to set_mce_nospec() remapping the page as UC, to hide it from speculative accesses. Given that that persistent memory errors can be cleared by the driver, include a facility to restore the page to cacheable operation, clear_mce_nospec(). Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Borislav Petkov <bp@alien8.de> Cc: <linux-edac@vger.kernel.org> Cc: <x86@kernel.org> Acked-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Acked-by: Ingo Molnar <mingo@redhat.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/*
|
|
* Copyright 2017, Michael Ellerman, IBM Corporation.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version
|
|
* 2 as published by the Free Software Foundation;
|
|
*/
|
|
#ifndef _LINUX_SET_MEMORY_H_
|
|
#define _LINUX_SET_MEMORY_H_
|
|
|
|
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
|
#include <asm/set_memory.h>
|
|
#else
|
|
static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
|
|
static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
|
|
static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
|
|
static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
|
|
#endif
|
|
|
|
#ifndef set_mce_nospec
|
|
static inline int set_mce_nospec(unsigned long pfn)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#ifndef clear_mce_nospec
|
|
static inline int clear_mce_nospec(unsigned long pfn)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT
|
|
static inline int set_memory_encrypted(unsigned long addr, int numpages)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int set_memory_decrypted(unsigned long addr, int numpages)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
|
|
|
|
#endif /* _LINUX_SET_MEMORY_H_ */
|