On 1/4/22 23:14, Sean Christopherson wrote:
Alternatively, should we mark passthrough shadow pages as direct=1? That would naturally handle this code, and for things like reexecute_instruction()'s usage of kvm_mmu_unprotect_page(), I don't think passthrough shadow pages should be considered indirect, e.g. zapping them won't help and the shadow page can't become unsync.
So the main difference between direct and passthrough shadow pages is that passthrough pages can have indirect children. A direct page maps the page at sp->gfn, while a passthrough page maps the page _table_ at sp->gfn. Is this correct? If so, I think there is a difference between a passthrough page that maps a level-2 page from level-4, and a passthrough page that maps a level-3 page from level-4. This means that a single bit in the role is not enough. One way to handle this could be to have a single field "direct_levels" that subsumes both "direct" and "passthrough". direct && !passthrough would correspond to "direct_levels == level", while !direct && !passthrough would correspond to "direct_levels == 0". Paolo