From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com ([156.151.31.85]:42340 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbeBWRWj (ORCPT ); Fri, 23 Feb 2018 12:22:39 -0500 Date: Fri, 23 Feb 2018 12:22:20 -0500 From: Konrad Rzeszutek Wilk To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , KarimAllah Ahmed , David Woodhouse , Jim Mattson , Thomas Gleixner , Ingo Molnar , stable@vger.kernel.org Subject: Re: [PATCH 1/3] KVM: x86: use native MSR ops for SPEC_CTRL Message-ID: <20180223172220.GK8252@char.us.oracle.com> References: <1519249297-73718-1-git-send-email-pbonzini@redhat.com> <1519249297-73718-2-git-send-email-pbonzini@redhat.com> <20180222170717.GP31483@char.us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: On Fri, Feb 23, 2018 at 10:37:49AM +0100, Paolo Bonzini wrote: > On 22/02/2018 18:07, Konrad Rzeszutek Wilk wrote: > >> Having a paravirt indirect call in the IBRS restore path is not a > >> good idea, since we are trying to protect from speculative execution > >> of bogus indirect branch targets. It is also slower, so use > >> native_wrmsrl on the vmentry path too. > > But it gets replaced during patching. As in once the machine boots > > the assembler changes from: > > > > callq *0xfffflbah > > > > to > > wrmsr > > > > ? I don't think you need this patch. > > Why not be explicit? According to the spec, PRED_CMD and SPEC_CTRL Explicit is fine. But I would recommend you change the commit message to say so, and perhaps remove 'It is also slower' - as that is incorrect. > should be passed down to the guest without interception so it's safe to > do this. On the other hand, especially with nested virtualization, I > don't think you can absolutely guarantee that the paravirt call will be > patched to rdmsr/wrmsr. If it is detected to be Xen PV, then yes it will be a call to a function. But that won't help as Xen PV runs in ring 3, so it has a whole bunch of other issues. If it detects it as KVM or Xen HVM guest it will patch it with the default - which is normal MSRs. Ditto for HyperV. But no biggie - explicit is fine, just nagging on the commit message could use a bit of expansion. > Paolo >