On 2/4/22 19:32, David Matlack wrote:
- vcpu->arch.root_mmu.mmu_role.ext.valid = 0;
- vcpu->arch.guest_mmu.mmu_role.ext.valid = 0;
- vcpu->arch.nested_mmu.mmu_role.ext.valid = 0;
+ vcpu->arch.root_mmu.mmu_role.base.level = 0;
+ vcpu->arch.guest_mmu.mmu_role.base.level = 0;
+ vcpu->arch.nested_mmu.mmu_role.base.level = 0;
I agree this will work but I think it makes the code more difficult to
follow (and I start worrying that some code that relies on level being
accurate will creep in in the future). At minimum we should extend the
comment here to describe why level is being changed.
I did a half-assed attempt to pass something like "bool force_role_reset"
down to the MMU initialization functions as an alternative but it very
quickly got out of hand.
What about just changing `valid` to `cpuid_stale` and flip the meaning?
kvm_mmu_after_set_cpuid() would set the cpuid_stale bit and then reset
the MMUs.
For now I'll swap this patch with one that clears the whole word, but
keep the ext bit as described in my other reply.
Paolo