From: Paolo Bonzini Subject: Re: [PATCH v3 0/4] KVM: Expose speculation control feature to guests Date: Tue, 30 Jan 2018 18:36:20 -0500 Message-ID: <6b7db789-9cc1-1b4d-9209-8d082e0d8def@redhat.com> References: <1517271028-15916-1-git-send-email-karahmed@amazon.de> <1517302830.18619.78.camel@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Andi Kleen , Andrea Arcangeli , Andy Lutomirski , Arjan van de Ven , Ashok Raj , Asit Mallick , Borislav Petkov , Dan Williams , Dave Hansen , Greg Kroah-Hartman , "H . Peter Anvin" , Ingo Molnar , Janakarajan Natarajan , Joerg Roedel , Jun Nakajima , Laura Abbott , Linus Torvalds , Masami Hiramatsu , Peter Zijlstra , =?UTF-8?B?UmFkaW To: David Woodhouse , KarimAllah Ahmed , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Return-path: In-Reply-To: <1517302830.18619.78.camel@infradead.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 30/01/2018 04:00, David Woodhouse wrote: > I believe Ashok sent you a change which made us do IBPB on *every* > vmexit; I don't think we need that. It's currently done in vcpu_load() > which means we'll definitely have done it between running one vCPU and > the next, and when vCPUs are pinned we basically never need to do it. > > We know that VMM (e.g. qemu) userspace could be vulnerable to attacks > from guest ring 3, because there is no flush between the vmexit and the > host kernel "returning" to the userspace thread. Doing a full IBPB on > *every* vmexit would protect from that, but it's overkill. If that's > the reason, let's come up with something better. Certainly not every vmexit! But doing it on every userspace vmexit and every sched_out would not be *that* bad. We try really hard to avoid userspace vmexits for everything remotely critical to performance (the main exception that's left is the PMTIMER I/O port, that Windows likes to access quite a lot), so they shouldn't happen that often. Paolo