From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x226ZiAKQVs1nzT/GHnWMf5+sco1WB32X+TedzP8YmEmBA7k68xSMH/JtqeHcKpVCghDrFJsZ ARC-Seal: i=1; a=rsa-sha256; t=1517357814; cv=none; d=google.com; s=arc-20160816; b=c6+NcAza31IJEUuanyIbaTczX+DcZWmQB8UfxFVjxX6aiYikhKcGX/MH35nYJLBBcs 4piZHBc++p6IbvZsqklCErX9gE6REhJUGIr9bYihNv/LvBNRgDCVbAUOoSDRQuJApuAb W6k91QQHAJJXQGEgeM29FgTV1jcOsvNc0Yn3QtEh6pfhtbAn0DjDTBVSR6ArNgZLxtIB WHM9rsOe5zGbtVssfaePPPZBpMu1NWuxaccVFOht3k8VWREWQtp3NQ+HDn0HN1lKAPTh p2cNKE48SGvlJP0ZytWGflKSOdWLnzjVThgC/LujAFe3R+47dr2mmAMbvwttkfNZbF3X xk3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :arc-authentication-results; bh=0DQNG7DM0OZbyt29zRCbUlGLqTYDusKhTHGaHnlXYXY=; b=z+5PNCl/yO9ICccItRs/DhXJfgVjq0cwIb5MAhxSbRahdS3e9kRMhaJL1L/T/fglO0 yqjigfD+ngkD7EqoFrutUKdTNGE2jm+raEjN2Hs0feGIx2QyPUjMykU2DPhEIa5SVdkg w3GbpP1VAaT6bOb9wmyAPfpfdCrXciTpgIaHs5sg1odTqzVCcLg6Xhq28rlF5AfFLsyk 1f3DKMJHmjZSnCcbDmiUDVBs48mS5PJ60JJQx66J5+JzUfgQjWwAvJdmgnYCuaxOzwxh nJjNE5XzKvjf6TCw/3M32+74QI7OTyXy195ZqpD2DV+Nuh6vPk+yfy4JCJROBQIKXrCb IhVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of pbonzini@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of pbonzini@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Subject: Re: [PATCH v3 0/4] KVM: Expose speculation control feature to guests To: "Raj, Ashok" 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 , 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?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Tim Chen , Tom Lendacky 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> From: Paolo Bonzini Message-ID: Date: Tue, 30 Jan 2018 19:16:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180130234822.GA62797@otc-nc-03> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590974343910960333?= X-GMAIL-MSGID: =?utf-8?q?1591064987285104108?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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. If the host is using IBRS, then writing IBRS=1 at vmexit has established a barrier from the less privileged VMX guest environment. Paolo > If Qemu is protected by !dumpable/retpoline that should give that gaurantee. > We do VM->VM IBPB at vmload() time that should provide that gaurantee.