mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
x86/sgx: Hook arch_memory_failure() into mainline code
Add a call inside memory_failure() to call the arch specific code to check if the address is an SGX EPC page and handle it. Note the SGX EPC pages do not have a "struct page" entry, so the hook goes in at the same point as the device mapping hook. Pull the call to acquire the mutex earlier so the SGX errors are also protected. Make set_mce_nospec() skip SGX pages when trying to adjust the 1:1 map. Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com> Tested-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lkml.kernel.org/r/20211026220050.697075-6-tony.luck@intel.com
This commit is contained in:
parent
a495cbdffa
commit
03b122da74
4 changed files with 38 additions and 6 deletions
|
@ -1651,21 +1651,28 @@ int memory_failure(unsigned long pfn, int flags)
|
|||
if (!sysctl_memory_failure_recovery)
|
||||
panic("Memory failure on page %lx", pfn);
|
||||
|
||||
mutex_lock(&mf_mutex);
|
||||
|
||||
p = pfn_to_online_page(pfn);
|
||||
if (!p) {
|
||||
res = arch_memory_failure(pfn, flags);
|
||||
if (res == 0)
|
||||
goto unlock_mutex;
|
||||
|
||||
if (pfn_valid(pfn)) {
|
||||
pgmap = get_dev_pagemap(pfn, NULL);
|
||||
if (pgmap)
|
||||
return memory_failure_dev_pagemap(pfn, flags,
|
||||
pgmap);
|
||||
if (pgmap) {
|
||||
res = memory_failure_dev_pagemap(pfn, flags,
|
||||
pgmap);
|
||||
goto unlock_mutex;
|
||||
}
|
||||
}
|
||||
pr_err("Memory failure: %#lx: memory outside kernel control\n",
|
||||
pfn);
|
||||
return -ENXIO;
|
||||
res = -ENXIO;
|
||||
goto unlock_mutex;
|
||||
}
|
||||
|
||||
mutex_lock(&mf_mutex);
|
||||
|
||||
try_again:
|
||||
if (PageHuge(p)) {
|
||||
res = memory_failure_hugetlb(pfn, flags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue