Re: [PATCH 00/54] KVM: x86/mmu: Bug fixes and summer cleaning

From: Sean Christopherson
Date: Wed Jun 23 2021 - 17:07:03 EST


On Wed, Jun 23, 2021, Paolo Bonzini wrote:
> On 22/06/21 19:56, Sean Christopherson wrote:
> > Patch 01 is the only patch that is remotely 5.13 worthy, and even then
> > only because it's about as safe as a patch can be. Everything else is far
> > from urgent as these bugs have existed for quite some time.
>
> Maybe patch 54 (not sarcastic), but I agree it's not at all necessary.
>
> This is good stuff, I made a few comments but almost all of them (all except
> the last comment on patch 9, "Unconditionally zap unsync SPs") are cosmetic
> and I can resolve them myself.

The 0-day bot also reported some warnings. vcpu_to_role_regs() needs to be
static, the helpers are added without a user. I liked the idea of adding the
helpers in one patch, but I can't really defend adding them without a user. :-/

arch/x86/kvm/mmu/mmu.c:209:26: warning: no previous prototype for function 'vcpu_to_role_regs' [-Wmissing-prototypes]
struct kvm_mmu_role_regs vcpu_to_role_regs(struct kvm_vcpu *vcpu)
^
arch/x86/kvm/mmu/mmu.c:209:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct kvm_mmu_role_regs vcpu_to_role_regs(struct kvm_vcpu *vcpu)
^
static
arch/x86/kvm/mmu/mmu.c:199:1: warning: unused function '____is_cr0_wp' [-Wunused-function]
BUILD_MMU_ROLE_REGS_ACCESSOR(cr0, wp, X86_CR0_WP);

>
> I'd like your input on renaming is_{cr0,cr4,efer}_* to is_mmu_* (and
> possibly reduce the four underscores to two...).
>
> If I get remarks by tomorrow, I'll get this into 5.14, otherwise consider
> everything but the first eight patches queued only for 5.15.
>
> > I labeled the "sections" of this mess in the shortlog below.
> >
> > P.S. Does anyone know how PKRU interacts with NPT? I assume/hope NPT
> > accesses, which are always "user", ignore PKRU, but the APM doesn't
> > say a thing. If PKRU is ignored, KVM has some fixing to do. If PKRU
> > isn't ignored, AMD has some fixing to do:-)
> >
> > P.S.S. This series pulled in one patch from my vCPU RESET/INIT series,
> > "Properly reset MMU context at vCPU RESET/INIT", as that was needed
> > to fix a root_level bug on VMX. My goal is to get the RESET/INIT
> > series refreshed later this week and thoroughly bombard everyone.
>
> Note that it won't get into 5.14 anyway, since I plan to send my first pull
> request to Linus as soon as Friday.

Good to know. I'll still try to get it out tomorrow as I'll be on vacation
for a few weeks starting Friday, and I'm afraid I'll completely forget what's in
the series :-)