[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a7cc6ead-c30b-4d21-c92c-faf37d9023b7@redhat.com>
Date: Sat, 5 Feb 2022 15:50:49 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: David Matlack <dmatlack@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
seanjc@...gle.com, vkuznets@...hat.com
Subject: Re: [PATCH 03/23] KVM: MMU: remove valid from extended role
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
Powered by blists - more mailing lists