From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
jmattson@google.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86: Allow guests to see MSR_IA32_TSX_CTRL even if tsx=off
Date: Mon, 1 Feb 2021 09:36:57 -0800 [thread overview]
Message-ID: <YBg8OcuPFhQjsz3w@google.com> (raw)
In-Reply-To: <cac389ad-96b0-293e-f977-4e9c6d719dea@redhat.com>
On Mon, Feb 01, 2021, Paolo Bonzini wrote:
> On 01/02/21 17:38, Sean Christopherson wrote:
> > > > > /*
> > > > > * On TAA affected systems:
> > > > > * - nothing to do if TSX is disabled on the host.
> > > > > * - we emulate TSX_CTRL if present on the host.
> > > > > * This lets the guest use VERW to clear CPU buffers.
> > > > > */
> >
> > it says "nothing to do..." and then clears a
> > flag. The other interpretation of "nothing to do... at runtime" is also wrong
> > as KVM emulates the MSR as a nop.
> >
> > I guess I just find the whole comment more confusing than the code itself.
>
> What about:
>
>
> if (!boot_cpu_has(X86_FEATURE_RTM)) {
> /*
> * If RTM=0 because the kernel has disabled TSX, the host might
> * have TAA_NO or TSX_CTRL. Clear TAA_NO (the guest sees RTM=0
> * and therefore knows that there cannot be TAA) but keep
> * TSX_CTRL: some buggy userspaces leave it set on tsx=on hosts,
> * and we want to allow migrating those guests to tsx=off hosts.
> */
> data &= ~ARCH_CAP_TAA_NO;
> } else if (!boot_cpu_has_bug(X86_BUG_TAA)) {
> data |= ARCH_CAP_TAA_NO;
> } else {
> /*
> * Nothing to do here; we emulate TSX_CTRL if present on the
> * host so the guest can choose between disabling TSX or
> * using VERW to clear CPU buffers.
> */
> }
Awesome! Thanks much!
next prev parent reply other threads:[~2021-02-01 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 10:19 [PATCH v2] KVM: x86: Allow guests to see MSR_IA32_TSX_CTRL even if tsx=off Paolo Bonzini
2021-01-29 16:58 ` Sean Christopherson
2021-02-01 8:46 ` Paolo Bonzini
2021-02-01 9:08 ` Paolo Bonzini
2021-02-01 16:38 ` Sean Christopherson
2021-02-01 17:34 ` Paolo Bonzini
2021-02-01 17:36 ` Sean Christopherson [this message]
2021-02-01 17:03 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YBg8OcuPFhQjsz3w@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.