Re: [PATCH 1/4] x86/sgx: Add total number of EPC pages
From: Jarkko Sakkinen
Date: Wed Mar 26 2025 - 15:48:18 EST
On Mon, Mar 24, 2025 at 12:12:41PM +0000, Reshetova, Elena wrote:
> > On Fri, Mar 21, 2025 at 02:34:40PM +0200, Elena Reshetova wrote:
> > > In order to successfully execute ENCLS[EUPDATESVN], EPC must be empty.
> > > SGX already has a variable sgx_nr_free_pages that tracks free
> > > EPC pages. Add a new variable, sgx_nr_total_pages, that will keep
> > > track of total number of EPC pages. It will be used in subsequent
> > > patch to change the sgx_nr_free_pages into sgx_nr_used_pages and
> > > allow an easy check for an empty EPC.
> >
> > First off, remove "in subsequent patch".
>
> Ok
>
> >
> > What does "change sgx_nr_free_pages into sgx_nr_used_pages" mean?
>
> As you can see from patch 2/4, I had to turn around the meaning of the
> existing sgx_nr_free_pages atomic counter not to count the # of free pages
> in EPC, but to count the # of used EPC pages (hence the change of name
> to sgx_nr_used_pages). The reason for doing this is only apparent in patch
Why you *absolutely* need to invert the meaning and cannot make
this work by any means otherwise?
I doubt highly doubt this could not be done other way around.
BR, Jarkko