Re: [PATCH v13 09/13] x86/sgx: Enclave Page Cache (EPC) memory manager

From: Andy Shevchenko
Date: Mon Sep 03 2018 - 15:02:30 EST


On Mon, Aug 27, 2018 at 9:58 PM Jarkko Sakkinen
<jarkko.sakkinen@xxxxxxxxxxxxxxx> wrote:
>
> Add a Enclave Page Cache (EPC) memory manager that can be used to
> allocate and free EPC pages. The swapper thread ksgxswapd reclaims pages
> on the event when the number of free EPC pages goes below
> %SGX_NR_LOW_PAGES up until it reaches %SGX_NR_HIGH_PAGES.
>
> Pages are reclaimed in LRU fashion from a global list. The consumers
> take care of calling EBLOCK (block page from new accesses), ETRACK
> (restart counting the entering hardware threads) and EWB (write page to
> the regular memory) because executing these operations usually (if not
> always) requires to do some subsystem-internal locking operations.

> + list_del(&page->list);

Is this page will be completely gone? Otherwise it might be needed to
reinit list head here as well.

> + WARN(ret < 0, "sgx: cannot free page, reclaim in-progress");
> + WARN(ret > 0, "sgx: EREMOVE returned %d (0x%x)", ret, ret);

I'm not sure (though it's easy to check) that you need sgx: prefix
here. WARN() might take pr_fmt() if defined.

--
With Best Regards,
Andy Shevchenko