Re: [PATCH v5 1/7] x86/sgx: Provide indication of life-cycle of EPC pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux