From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Andy Lutomirski <luto@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, Dave Hansen <dave.hansen@intel.com>,
Chang Seok Bae <chang.seok.bae@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Sasha Levin <sashal@kernel.org>,
kvm@vger.kernel.org, Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [PATCH] x86/entry/64: Disallow RDPID in paranoid entry if KVM is enabled
Date: Fri, 21 Aug 2020 11:05:24 +0200 [thread overview]
Message-ID: <3b4ba9e9-dbf6-a094-0684-e68248050758@redhat.com> (raw)
In-Reply-To: <20200821081633.GD12181@zn.tnic>
On 21/08/20 10:16, Borislav Petkov wrote:
> On Fri, Aug 21, 2020 at 10:09:01AM +0200, Paolo Bonzini wrote:
>> One more MSR *is* a big deal: KVM's vmentry+vmexit cost is around 1000
>> cycles, adding 100 clock cycles for 2 WRMSRs is a 10% increase.
>
> The kernel uses TSC_AUX so we can't reserve it to KVM either.
KVM only uses TSC_AUX while in kernel space, because the kernel hadn't
used it until now. That's for a good reason:
* if possible, __this_cpu_read(cpu_number) is always faster.
* The kernel can just block preemption at its will and has no need for
the atomic rdtsc+vgetcpu provided by RDTSCP.
So far, the kernel had always used LSL instead of RDPID when
__this_cpu_read was not available. In one place, RDTSCP is used as an
ordered rdtsc but it discards the TSC_AUX value. RDPID is also used in
the vDSO but it isn't kernel space.
Hence the assumption that KVM makes (and has made ever since TSC_AUX was
introduced. What is the difference in speed between LSL and RDPID? I
don't have a machine that has RDPID to test it, unfortunately.
Paolo
next prev parent reply other threads:[~2020-08-21 9:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 2:50 Sean Christopherson
2020-08-21 7:24 ` peterz
2020-08-21 7:44 ` Borislav Petkov
2020-08-21 7:47 ` Borislav Petkov
2020-08-21 8:09 ` Paolo Bonzini
2020-08-21 8:16 ` Borislav Petkov
2020-08-21 9:05 ` Paolo Bonzini [this message]
2020-08-21 9:22 ` Borislav Petkov
2020-08-21 9:44 ` Paolo Bonzini
2020-08-21 9:48 ` Borislav Petkov
2020-08-21 10:07 ` Paolo Bonzini
2020-08-22 16:42 ` Andy Lutomirski
2020-09-16 16:54 ` Paolo Bonzini
2020-08-21 9:28 ` Thomas Gleixner
2020-08-21 9:37 ` Paolo Bonzini
2020-08-21 19:55 ` hpa
2020-08-21 20:02 ` Peter Zijlstra
2020-08-21 8:56 ` kernel test robot
2020-08-21 10:28 ` kernel test robot
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=3b4ba9e9-dbf6-a094-0684-e68248050758@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=chang.seok.bae@intel.com \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sashal@kernel.org \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome