diff options
author | Tony Luck <tony.luck@intel.com> | 2021-10-27 01:00:46 +0300 |
---|---|---|
committer | Dave Hansen <dave.hansen@linux.intel.com> | 2021-11-15 22:13:16 +0300 |
commit | 992801ae92431761b3d8ec88abd5793d154d34ac (patch) | |
tree | 41ebad4edc2061debcb9d2ddc3fddb0597fb459c /arch/x86/kernel/cpu/sgx/sgx.h | |
parent | 40e0e7843e23d164625b9031514f5672f8758bf4 (diff) | |
download | linux-992801ae92431761b3d8ec88abd5793d154d34ac.tar.xz |
x86/sgx: Initial poison handling for dirty and free pages
A memory controller patrol scrubber can report poison in a page
that isn't currently being used.
Add "poison" field in the sgx_epc_page that can be set for an
sgx_epc_page. Check for it:
1) When sanitizing dirty pages
2) When freeing epc pages
Poison is a new field separated from flags to avoid having to make all
updates to flags atomic, or integrate poison state changes into some
other locking scheme to protect flags (Currently just sgx_reclaimer_lock
which protects the SGX_EPC_PAGE_RECLAIMER_TRACKED bit in page->flags).
In both cases place the poisoned page on a per-node list of poisoned
epc pages to make sure it will not be reallocated.
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>
Tested-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lkml.kernel.org/r/20211026220050.697075-4-tony.luck@intel.com
Diffstat (limited to 'arch/x86/kernel/cpu/sgx/sgx.h')
-rw-r--r-- | arch/x86/kernel/cpu/sgx/sgx.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h index 5906471156c5..9ec3136c7800 100644 --- a/arch/x86/kernel/cpu/sgx/sgx.h +++ b/arch/x86/kernel/cpu/sgx/sgx.h @@ -31,7 +31,8 @@ struct sgx_epc_page { unsigned int section; - unsigned int flags; + u16 flags; + u16 poison; struct sgx_encl_page *owner; struct list_head list; }; @@ -42,6 +43,7 @@ struct sgx_epc_page { */ struct sgx_numa_node { struct list_head free_page_list; + struct list_head sgx_poison_page_list; spinlock_t lock; }; |