Re: [PATCH v3 2/4] KVM: SVM: Clear MSR_TSC_AUX[63:32] on write

From: Sean Christopherson
Date: Mon Apr 26 2021 - 15:44:23 EST


On Mon, Apr 26, 2021, Sean Christopherson wrote:
> On Mon, Apr 26, 2021, Vitaly Kuznetsov wrote:
> > Actually, shouldn't we just move wrmsrl() here? Assuming we're not sure
> > how (and if) upper 32 bits are going to be used, it would probably make
> > sense to not write them to the actual MSR...
>
> Argh. I got too clever in trying to minimize the patch deltas and "broke" this
> intermediate patch. Once the user return framework is used, the result of
> setting the MSR is checked before setting svm->tsc_aux, i.e. don't set the
> virtual state if the real state could not be set.
>
> I'm very tempted to add yet another patch to this mess to do:
>
> if (wrmsrl_safe(MSR_TSC_AUX, data))
> return 1;
>
> svm->tsc_aux = data;
>
> And then this patch becomes:
>
> data = (u32)data;
>
> if (wrmsrl_safe(MSR_TSC_AUX, data))
> return 1;
>
> svm->tsc_aux = data;
>
> The above will also make patch 3 cleaner as it will preserve the ordering of
> truncating data and the wrmsr.

Ah, never mind, Paolo already pushed this to kvm/next with your above fix.