Re: [PATCH v3 3/6] KVM: x86: Do not unload MMU roots when only toggling CR0.WP
From: Sean Christopherson
Date: Wed Mar 15 2023 - 17:22:44 EST
On Wed, Feb 08, 2023, Mathias Krause wrote:
> On 07.02.23 14:36, Zhi Wang wrote:
> > On Wed, 1 Feb 2023 20:46:01 +0100
> > Mathias Krause <minipli@xxxxxxxxxxxxxx> wrote:
> > I suppose this is a critical path according to the patch comments and
> > kvm_init_mmu() is a non-critical path. Is it better to seperate
> > them now for saving the maintanence efforts in future? E.g. something heavier
> > might be introduced into the kvm_init_mmu() path and slows down this path.
>
> I'll look into what can be done about it. But this change is a first
> step that can be further optimized via follow up changes.
>
> As you can see from the numbers below, it's already way faster that what
> we have right now, so I'd rather land this (imperfect) change sooner
> than later and gradually improve on it. This will, however, likely only
> bring minor speedups compared to this change, so they're less important,
> IMHO.
>
> The question is really what's better from a maintenance point of view:
> Keeping the call to the commonly used kvm_init_mmu() function or special
> case even further? I fear the latter might regress easier, but YMMV, of
> course.
Agreed. Unless the performance benefits of getting super precise are significant,
I would much rather keep things simpler and reduce the risk of introducing bugs.
Bugs in this area in particular have a nasty habit of being really good at hiding.