[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bba7e537fd9197a92358640ebb0aef365984cebc.camel@kernel.org>
Date: Wed, 22 Sep 2021 00:28:16 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Tony Luck <tony.luck@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
Dave Hansen <dave.hansen@...el.com>
Cc: Cathy Zhang <cathy.zhang@...el.com>, linux-sgx@...r.kernel.org,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/7] x86/sgx: Provide indication of life-cycle of EPC
pages
On Fri, 2021-09-17 at 14:38 -0700, Tony Luck wrote:
> SGX EPC pages go through the following life cycle:
>
> DIRTY ---> FREE ---> IN-USE --\
> ^ |
> \-----------------/
>
> Recovery action for poison for a DIRTY or FREE page is simple. Just
> make sure never to allocate the page. IN-USE pages need some extra
> handling.
>
> It would be good to use the sgx_epc_page->owner field as an indicator
> of where an EPC page is currently in that cycle (owner != NULL means
> the EPC page is IN-USE). But there is one caller, sgx_alloc_va_page(),
> that calls with NULL.
>
> Since there are multiple uses of the "owner" field with different types
> change the sgx_epc_page structure to define an anonymous union with
> each of the uses explicitly called out.
But it's still always a pointer.
And not only that, but two alternative fields in that union have *exactly* the
same type, so it's kind of artifically representing the problem more complex
than it really is.
I'm not just getting, why all this complexity, and not a few casts instead?
I neither get the rename of "owner" to "private". It serves very little value.
I'm not saying that "owner" is best name ever but it's not *that* confusing
either. That I'm sure that it is definitely not very productive to rename it.
Also there was still this "dirty". We could use ((void *)-1), which was also
suggested for earlier revisions.
/Jarkko
Powered by blists - more mailing lists