Re: [PATCH 07/23] KVM: MMU: remove kvm_mmu_calc_root_page_role

Paolo Bonzini
2022-02-05T14:48:35Z

On 2/4/22 20:32, David Matlack wrote:
> On Fri, Feb 04, 2022 at 06:57:02AM -0500, Paolo Bonzini wrote:
>> Since the guest PGD is now loaded after the MMU has been set up
>> completely, the desired role for a cache hit is simply the current
>> mmu_role. There is no need to compute it again, so __kvm_mmu_new_pgd
>> can be folded in kvm_mmu_new_pgd.
>>
>> As an aside, the !tdp_enabled case in the function was dead code,
>> and that also gets mopped up as a side effect.
> Couldn't the !tdp_enabled case be called via kvm_set_cr3() ->
> kvm_mmu_new_pgd()?
>

Right, it's not dead code. Rather, there never was a need for
kvm_mmu_calc_root_page_role(vcpu) as opposed to just using what is
already in vcpu->arch.mmu.

Paolo