On Wed, 2022-10-12 at 12:42 +0800, Zhiquan Li wrote: > I added more descriptions for motivation and reduced explanations > for details in changelog as below, could you help me review if it is > easier to understand now? > > When a page triggers a machine check, it only reports the PFN. But > in order to inject #MC into VM through hypervisor, the virtual > address of virtual EPC page is required. To avoid introduce a new > dedicated structure to track it, repurpose the 'encl_owner' field as > it is useless in virtualization case, so that arch_memory_failure() > can retrieve the virtual address easily and attach it to the extra > info of SIGBUS which will be sent to hypervisor. > > The union can prevent playing the casting games while using it. And > add a new EPC page flag - SGX_EPC_PAGE_KVM_GUEST to interpret the > meaning of the field. > > The changes take place while allocating an EPC page to a KVM guests. > After applying it, the reversed relationship from an EPC page to > virtual EPC doesn't exist, in practice, such relationship is > useless. Beyond that, other behaviors have not been changed. To me the above last paragraph is very hard to comprehend. I would just point out the fact: Virtual EPC pages's 'encl_owner' is not used so it's safe to repurpose it to carry virtual EPC page's virtual address. (and perhaps somehow to merge to your first paragraph where why the virtual address is needed is explained.) -- Thanks, -Kai