mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liran Alon <liran.alon@oracle.com>
To: <dwmw2@infradead.org>
Cc: <konrad.wilk@oracle.com>, <luto@kernel.org>, <tglx@linutronix.de>,
	<torvalds@linux-foundation.org>, <gregkh@linuxfoundation.org>,
	<asit.k.mallick@intel.com>, <dave.hansen@intel.com>,
	<karahmed@amazon.de>, <jun.nakajima@intel.com>,
	<dan.j.williams@intel.com>, <ashok.raj@intel.com>,
	<daniel.kiper@oracle.com>, <arjan.van.de.ven@intel.com>,
	<tim.c.chen@linux.intel.com>, <pbonzini@redhat.com>,
	<linux-kernel@vger.kernel.org>, <ak@linux.intel.com>,
	<kvm@vger.kernel.org>, <aarcange@redhat.com>
Subject: Re: [PATCH] x86: vmx: Allow direct access to MSR_IA32_SPEC_CTRL
Date: Sun, 28 Jan 2018 16:39:48 -0800 (PST)	[thread overview]
Message-ID: <6b9a1ec2-5ebd-4624-a825-3f31db5cefb5@default> (raw)


----- dwmw2@infradead.org wrote:

> On Sun, 2018-01-28 at 15:21 -0500, Konrad Rzeszutek Wilk wrote:
> > >To avoid the overhead of atomically saving and restoring the
> MSR_IA32_SPEC_CTRL
> > >for guests that do not actually use the MSR, only
> add_atomic_switch_msr when a
> > >non-zero is written to it.
> > 
> > 
> > We tried this and found that it was about 3% slower that doing the
> > old way of rdmsr and wrmsr.
> > 
> > But that was also with the host doing IBRS  as well.
> 
> The common case will be that neither host nor guest are doing IBRS.
> Until the guest touches the MSR we do absolutely *nothing* with it,
> which is definitely the fastest option.

Windows use IBRS and Microsoft don't have any plans to switch to retpoline.
Running a Windows guest should be a pretty common use-case no?

In addition, your handle of the first WRMSR intercept could be different.
It could signal you to start doing the following:
1. Disable intercept on SPEC_CTRL MSR.
2. On VMEntry, Write vCPU SPEC_CTRL value into physical MSR.
3. On VMExit, read physical MSR into vCPU SPEC_CTRL value.
(And if IBRS is used at host, also set physical SPEC_CTRL MSR here to 1)

That way, you will both have fastest option as long as guest don't use IBRS
and also won't have the 3% performance hit compared to Konrad's proposal.

Am I missing something?

-Liran

             reply	other threads:[~2018-01-29  0:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29  0:39 Liran Alon [this message]
2018-01-29  8:46 ` David Woodhouse
2018-01-29  9:43   ` KarimAllah Ahmed
2018-01-29 10:37     ` David Woodhouse
2018-01-29 10:55       ` Paolo Bonzini
2018-01-29 17:27       ` Konrad Rzeszutek Wilk
2018-01-29 10:47   ` Paolo Bonzini
2018-01-29 17:31   ` Konrad Rzeszutek Wilk
2018-01-29 21:49     ` Daniel Kiper
2018-01-29 23:01       ` Jim Mattson
  -- strict thread matches above, loose matches on Subject: below --
2018-01-28 19:29 KarimAllah Ahmed
2018-01-28 20:21 ` Konrad Rzeszutek Wilk
2018-01-28 20:39   ` David Woodhouse
2018-01-28 20:40   ` Andy Lutomirski
2018-01-28 20:44     ` David Woodhouse
2018-01-28 20:53       ` Andy Lutomirski
2018-01-28 20:56         ` David Woodhouse
2018-01-28 21:41       ` Van De Ven, Arjan
2018-01-28 21:47         ` David Woodhouse
2018-01-29  1:06   ` KarimAllah Ahmed
2018-01-29 18:43 ` Jim Mattson
2018-01-29 19:01   ` David Woodhouse
2018-01-29 19:04     ` Jim Mattson
2018-01-29 19:10       ` KarimAllah Ahmed
2018-01-29 19:16   ` Konrad Rzeszutek Wilk
2018-01-29 19:27     ` Jim Mattson

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=6b9a1ec2-5ebd-4624-a825-3f31db5cefb5@default \
    --to=liran.alon@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=arjan.van.de.ven@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=daniel.kiper@oracle.com \
    --cc=dave.hansen@intel.com \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.nakajima@intel.com \
    --cc=karahmed@amazon.de \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome