On 3/1/23 14:59, Zhi Wang wrote: > When the userspace sets the memory attribute of a GFN range through the > restricted memory ioctl, the sev logic (sev_update_mem_attr() in PATCH 48, to > be precise) will try to build a large page description in the RMP table if the > PFNs are continuous. When kernel mm breaks the the large page due to THP, KVM > updates the NPT accordingly. Gah, this really confused me. It's *NOT* looking for contiguous PFNs. It's looking for a restrictedmem THP, which really is something different. Restrictedmem THPs have contiguous PFNs, but not all contiguous PFNs will result in trying to build a large page. Anyway, I'll reply over to the other patch. But, either way, I'd appreciate this kind of summary in the changelogs and probably a comment or two: The RMP needs to be consistent with the contents of the NPT. KVM updates the NPT but will neglect to update the RMP. It is updated in response to faults when RMP and NPT get out of sync. Right? BTW, why doesn't KVM just update the RMP? Why bother taking the fault?