On 2022/5/20 08:48, Kai Huang wrote: > On Fri, 2022-05-20 at 00:59 +0300, Jarkko Sakkinen wrote: >>> I think this patch set is going taking wrong approach. Instead it would >>> be better just to re-use struct sgx_encl_page. >>> >>> Things will get out of hands, if we have a struct of each flavor of the >>> same entity. >>> >>> Additionally, it will take virtualization code a step closer to be >>> feasible for the page reclaimer consumption. >> I have a better idea. Why don't you simply store 'vaddr' to 'owner', >> i.e. >> >> epc_page = sgx_alloc_epc_page((void *)addr, false); >> >> The new struct is useless, or harmful, because it consumes memory. >> SGX_EPC_PAGE_IS_VEPC is there to interpret the meaning of the field >> correctly. Many thanks, Jarkko! It's really a good idea. Actually I've ever considered re-using struct sgx_encl_page, but in such case we just use the field 'desc', the others four fields are useless. Which means a virtual EPC page will have 32 bytes additional memory consumption outside of VM. Repurpose the "owner" field of struct sgx_epc_page now looks the best idea, there is no extra memory consumption and the code changes are more brief than before :-) I'll send v3 after testing. > This is also fine to me. Thanks for your review, Kai. Best Regards, Zhiquan > > > -- Thanks, -Kai