[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YBL/tTHHwDW6+vTd@google.com>
Date: Thu, 28 Jan 2021 10:17:25 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
jmattson@...gle.com, stable@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: Allow guests to see MSR_IA32_TSX_CTRL even if
tsx=off
On Thu, Jan 28, 2021, Paolo Bonzini wrote:
> On 28/01/21 18:56, Sean Christopherson wrote:
> > On Thu, Jan 28, 2021, Paolo Bonzini wrote:
> > > - vmx->guest_uret_msrs[j].mask = ~(u64)TSX_CTRL_CPUID_CLEAR;
> > > + if (boot_cpu_has(X86_FEATURE_RTM))
> > > + vmx->guest_uret_msrs[j].mask = ~(u64)TSX_CTRL_CPUID_CLEAR;
> > > + else
> > > + vmx->guest_uret_msrs[j].mask = 0;
> >
> > IMO, this is an unnecessarily confusing way to "remove" the user return MSR.
> > Changing the ordering to do a 'continue' would also provide a separate chunk of
> > code for the new comment. And maybe replace the switch with an if-statement to
> > avoid a 'continue' buried in a switch?
>
> You still need the slot in vmx->guest_uret_msrs to store the guest value,
> even though the two available bits are both no-ops. It's ugly but it makes
> sense: you don't want to ever re-enable TSX, so you use the ignore the guest
> value and run unconditionally with the host value.
Ugh, didn't think about the guest wanting to read back the value it wrote.
> I'll rephrase everything and resend.
Thanks!
Powered by blists - more mailing lists