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

From: Paolo Bonzini
Date: Thu Feb 10 2022 - 12:43:16 EST


On 2/10/22 18:29, Sean Christopherson wrote:
On Thu, Feb 10, 2022, Paolo Bonzini wrote:
On 2/10/22 01:47, Sean Christopherson wrote:
The nested mess is likely easily solved, I don't see any obvious issue with swapping
the order. But I still don't love the subtlety. I do like shaving cycles, just
not the subtlety...

Not so easily, but it's doable and it's essentially what I did in the other
series (the one that reworks the root cache).

Sounds like I should reveiw that series first?

Yeah, this one is still a nice step in the direction of guest pt walk from shadow pt build(*), but with no immediate use for TDP MMU root reuse.

The original idea was to use the MMU role to decide whether to do kvm_mmu_unload(), but that would have still been a bandaid---inefficient and a bad idea overall. Patches 6+7 of this series (once fixed, because they were buggy as hell) turned out to be enough to tame the PGD cache and remove kvm_mmu_unload() altogether from kvm_mmu_reset_context().

Paolo

(*) Your idea of detecting stale roots is quite easily implemented on top of these, for example, because a root is stale if and only if the root_role changes.