Received: by 10.223.185.116 with SMTP id b49csp3408178wrg; Tue, 13 Feb 2018 01:59:13 -0800 (PST) X-Google-Smtp-Source: AH8x224QhNhVDsRI3Xoa7NSkG0wRl0A/7ETmsZJdzIzr2lunDRgnTE/88+nqtitCRWR6wl14Ti/o X-Received: by 2002:a17:902:bd4b:: with SMTP id b11-v6mr599865plx.313.1518515953283; Tue, 13 Feb 2018 01:59:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518515953; cv=none; d=google.com; s=arc-20160816; b=HZ8FmGhMSw4riSFOQ62VjPxegZAKJHjvkPFJWh9P0eoQJzJS1xScQxnKMN7Wa74X9m UeBtc7BRgXBT7riSlU1fnoVMui3uyE69nP0uxcfTJfHLka8i/MTE5hnJYQScLh3CX9M0 cf24vjRYllZ3w9PD4BEImCTCI4j1+iDQzHzcP1r78XvA5dlk3Pi97Sk1BvLyx70xnZm8 EzGGzueY0xFeAM51naP+sWuB8chFYvyAp4hEfFltuRSQTn5bNXa897We4rape0oK60tH vJklPRLiKjsF+crFpZ/qSCxIC+rulBMCEhYw/yViDdoOumFygTcVVCy3J8Q4Lg1o4P5m n4CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=5589dXZ4jqeoKd+ArgCZ/F2pH75WcbkAJ4dZc59u23M=; b=CWENPINWQ9MnuhoIQn2uLSZP5elm6hRkvdf2lWv8eApGa4n0nbrdjEE5bMwtwXDgSZ a4soqhYdkG9HR0A3FDdCCf4OSca7WuLb9Zo6tCeGR91ag7d0BxjKSbMzcFkkMIa8tOGI Gm3NyosdCwaB5FIZyGCMTSfM1L5zYRnPgzBe6dZVPcYfVSwOMhFYyZxi9iBrwX1jPmIN fVkgo7koup0SkAViRXpkZ7AP1XcTDCw/FogPmaTSF1kkkO9iAX5AVmEvY4/qFZX6/hg6 M/q0bejDgvtxmA0Qu/qL39rjkvhd/ecNKdM7TkhJiSsMbGdBr2bLdntu57uXZhjDGiiX IfNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14si694331pgt.277.2018.02.13.01.58.58; Tue, 13 Feb 2018 01:59:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934849AbeBMJ6K (ORCPT + 99 others); Tue, 13 Feb 2018 04:58:10 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49826 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934683AbeBMJ6G (ORCPT ); Tue, 13 Feb 2018 04:58:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78D4E7D845; Tue, 13 Feb 2018 09:58:05 +0000 (UTC) Received: from [10.36.116.223] (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFB531C718; Tue, 13 Feb 2018 09:58:03 +0000 (UTC) Subject: Re: [PATCH 2/2] x86/speculation: Support "Enhanced IBRS" on future CPUs To: David Woodhouse , tglx@linutronix.de, x86@kernel.org, kvm@vger.kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, arjan.van.de.ven@intel.com, dave.hansen@intel.com References: <1518449255-2182-1-git-send-email-dwmw@amazon.co.uk> <1518449255-2182-2-git-send-email-dwmw@amazon.co.uk> <7e2e5ad1-49b6-1fdb-4a62-8ad6aefc30a0@redhat.com> <1518509708.12890.33.camel@infradead.org> From: Paolo Bonzini Message-ID: <27c85759-e662-d281-f8a0-0a80ca8ee18f@redhat.com> Date: Tue, 13 Feb 2018 10:58:00 +0100 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: <1518509708.12890.33.camel@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 13 Feb 2018 09:58:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 13 Feb 2018 09:58:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/02/2018 09:15, David Woodhouse wrote: >>>   >>> - if (!data) >>> + if (!data && !spectre_v2_ibrs_all()) >>>   break; >> This should check the value of IBRS_ALL in the VM, not in the host. > No, it's host we want. If IBRS_ALL is set in the host, we set the > actual hardware MSR once at boot time and never touch it again. The > SPEC_CTRL MSR we expose to guests is purely a no-op fiction. > > If spectre_v2_ibrs_all() is true then KVM should *never* actually pass > through or touch the real MSR. That would be nice but unfortunately it's not possible. :( The VM might actually not have IBRS_ALL, as usual the reason is migration compatibility. In that case, that no-op fiction would be very slow because the VM will actually do a lot of SPEC_CTRL writes. So the right logic is: - if the VM has IBRS_ALL, pass through the MSR when it is zero and intercept writes when it is one (no writes should happen) - if the VM doesn't have IBRS_ALL, do as we are doing now, independent of what the host spectre_v2_ibrs_all() setting is. Paolo