From: Dave Hansen Subject: Re: [PATCH v3 0/4] KVM: Expose speculation control feature to guests Date: Tue, 30 Jan 2018 22:54:37 -0800 Message-ID: References: <1517271028-15916-1-git-send-email-karahmed@amazon.de> <1517302830.18619.78.camel@infradead.org> <6b7db789-9cc1-1b4d-9209-8d082e0d8def@redhat.com> <20180130234822.GA62797@otc-nc-03> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: David Woodhouse , KarimAllah Ahmed , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Andi Kleen , Andrea Arcangeli , Andy Lutomirski , Arjan van de Ven , Asit Mallick , Borislav Petkov , Dan Williams , Greg Kroah-Hartman , "H . Peter Anvin" , Ingo Molnar , Janakarajan Natarajan , Joerg Roedel , Jun Nakajima , Laura Abbott , Linus Torvalds , Masami Hiramatsu , "Raj, Ashok" Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 01/30/2018 04:16 PM, Paolo Bonzini wrote: > On 30/01/2018 18:48, Raj, Ashok wrote: >>> Certainly not every vmexit! But doing it on every userspace vmexit and >>> every sched_out would not be *that* bad. >> Right.. agreed. We discussed the different scenarios that doing IBPB >> on VMexit would help, and decided its really not required on every exit. >> >> One obvious case is when there is a VMexit and return back to Qemu >> process (witout a real context switch) do we need that to be >> protected from any poisoned BTB from guest? > If the host is using retpolines, then some kind of barrier is needed. I > don't know if the full PRED_CMD barrier is needed, or two IBRS=1/IBRS=0 > writes back-to-back are enough. I think the spec is pretty clear here: protection is only provided *while* IBRS=1. Once it goes back to 0, all bets are off.