On Wed, 2023-09-27 at 10:35 -0500, Haitao Huang wrote: > > > + > > > + /* Possible owner types */ > > > + union { > > > + struct sgx_encl_page *encl_page; > > > + struct sgx_encl *encl; > > > + }; > > > > Sadly for virtual EPC page the owner is set to the 'sgx_vepc' instance it > > belongs to. > > > > Given how sgx_{alloc|free}_epc_page() arbitrarily uses encl_page, > > perhaps we > > should do below? > > > > union { > > struct sgx_encl_page *encl_page; > > struct sgx_encl *encl; > > struct sgx_vepc *vepc; > > void *owner; > > }; > > > > And in sgx_{alloc|free}_epc_page() we can use 'owner' instead. > > > > As I mentioned in cover letter and change log in 11/18, this series does > not track virtual EPC. It's not about how does the cover letter says. We cannot ignore the fact that currently virtual EPC uses owner too. But given the virtual EPC code currently doesn't use the owner, I can live with not having the 'vepc' member in the union now. > We can add vepc field into the union in future if such tracking is needed. > Don't think "void *owner" is needed though. As mentioned, using 'encl_page' arbitrarily in sgx_alloc_epc_page() doesn't look nice. Do you have example in the current kernel code to prove it is acceptable?