On Tue, 28 May 2024 11:23:13 -0500, Dave Hansen <dave.hansen@xxxxxxxxx>
wrote:
On 5/17/24 04:06, Dmitrii Kuvaiskii wrote:
...
First, why is SGX so special here? How is the SGX problem different
than what the core mm code does?
--- a/arch/x86/kernel/cpu/sgx/encl.h
+++ b/arch/x86/kernel/cpu/sgx/encl.h
@@ -25,6 +25,9 @@
/* 'desc' bit marking that the page is being reclaimed. */
#define SGX_ENCL_PAGE_BEING_RECLAIMED BIT(3)
+/* 'desc' bit marking that the page is being removed. */
+#define SGX_ENCL_PAGE_BEING_REMOVED BIT(2)
Second, convince me that this _needs_ a new bit. Why can't we just have
a bit that effectively means "return EBUSY if you see this bit when
handling a fault".
IIUC, reclaimer_writing_to_pcmd() also uses SGX_ENCL_PAGE_BEING_RECLAIMED
to check if a page is about being reclaimed in order to prevent its VA
slot fro being freed. So I think we do need separate bit for EREMOVE which
does not write to VA slot?
BR
Haitao