Re: [PATCH v4 1/3] x86/sgx: Split SGX_ENCL_PAGE_BEING_RECLAIMED into two flags

Huang, Kai
2024-07-25T02:01:12Z

On 5/07/2024 7:45 pm, Dmitrii Kuvaiskii wrote:
> SGX_ENCL_PAGE_BEING_RECLAIMED flag is set when the enclave page is being
> reclaimed (moved to the backing store). This flag however has two
> logical meanings:
>
> 1. Don't attempt to load the enclave page (the page is busy).
> 2. Don't attempt to remove the PCMD page corresponding to this enclave
> page (the PCMD page is busy).

Nit:

I think the SGX_ENCL_PAGE_PCMD_BUSY isn't that accurate, because
obviously the actual backing page is busy (i.e., cannot be truncated)
too. So the current SGX_ENCL_PAGE_BEING_RECLAIMED is also fine to me.

But truncating the actual backing page can also be determined by
SGX_ENCL_PAGE_PCMD_BUSY I suppose (if needed in the future), so this
looks fine to me too.

>
> To reflect these two meanings, split SGX_ENCL_PAGE_BEING_RECLAIMED into
> two flags: SGX_ENCL_PAGE_BUSY and SGX_ENCL_PAGE_PCMD_BUSY. Currently,
> both flags are set only when the enclave page is being reclaimed. A
> future commit will introduce a new case when the enclave page is being
> removed; this new case will set only the SGX_ENCL_PAGE_BUSY flag.

As replied to the last patch, IIUC EREMOVE ioctl doesn't seem to be the
only case where the BUSY needs to be marked, so let's just say something
general but not mention the removal case specifically.

Anyway, feel free to add:

Acked-by: Kai Huang <kai.huang@intel.com>