Re: [RFC PATCH V3 3/4] KVM: X86: Alloc role.pae_root shadow page

From: Paolo Bonzini
Date: Thu Apr 14 2022 - 11:34:33 EST


On 4/14/22 13:06, Lai Jiangshan wrote:
Right, but then load_pdptrs only needs to zap the page before (or
instead of) calling kvm_mmu_free_roots().


Guest PAE page is write-protected instead now (see patch4) and
kvm_mmu_pte_write() needs to handle this special write operation
with respect to sp->pae_off (todo).
And load_pdptrs() doesn't need to check if the pdptrs are changed.

Write-protecting the PDPTR page is unnecessary, the PDPTRs cannot change without another CR3. That should be easy to do in account_shadowed and unaccount_shadowed

I think role.guest_pae_root is needed to distinguish it from
a sp for a level-3 guest page in a 4-level pagetable.

Or just role.guest_root_level(or role.root_level) and it can replace
role.passthrough_depth and role.guest_pae_root and role.pae_root.

Yes, I agree. Though this would also get change patch 1 substantially, so I'll wait for you to respin.

Paolo