Received: by 10.223.185.116 with SMTP id b49csp2160133wrg; Mon, 12 Feb 2018 05:26:54 -0800 (PST) X-Google-Smtp-Source: AH8x2267z8Wu+yn38QeS/KlUtskRldPmKC2j6fN7HbLqPC5dNus1+b591cUXI4uc3WuruXaceMdl X-Received: by 2002:a17:902:d203:: with SMTP id t3-v6mr8924643ply.70.1518442014652; Mon, 12 Feb 2018 05:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518442014; cv=none; d=google.com; s=arc-20160816; b=eqL9ce1jVgHpLZzBCS1zZptgWvjuZp+ZZe6ru3TRoVWHrN+p6SILN703tBYNpC0XHM A3BbqWUiVVIw1IEML+1qaTR6UfcWAth+pmTVf4e2boJ2iY9N2KEj09nuOy01h6bBdMlW pxI5Bzltoa0AN8VW5OjbDrTuZ8PjQ2ojCSS61Gha46s+HziVV6DfglyS7uigAQ3t3TfF G80VH3pYAFXWH2Hn+IRLZMXtXAuLiJL0rBnnuARE+cswDDU1Vy685AzlyCpKdDOphGPe KCASmVjvrjkbZ/4Ji45pitAJOlA3vZsmxXrubUJqh80nyUYR9Ji/vIowmM+w7Hwe0rgY LXyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature :arc-authentication-results; bh=yXyZo0eftHK2I/Um0dYt4AqY34L/VH4bsaocifTmbbk=; b=HukQp0qMdVe/jh75OY1OHSTE8IDaXNuBVOViAeg7CGcQVYRvGP3NLe2uBJY3W8Pmhy pdwCHvKDQIk3KySJeo8AkT7fQKlHRBfAgPYLt0OXKPu7mJddL2et6TGHOCL6SFXg5/UZ U/+tkdEn7N6mZv41mcjgdDCw/fwwgm/maRTaggd1akhLd3Tco5JRKt4xNx1u1Dl3UF8F r3MThJYvSHf38Yawu3Wn0aEE5POdqVQlvwSXC7EUgR6zDdJmQVw9+wA+7+LdsCsjyLaG UNg6MaZenETVp9k8pTjWvbcjkngnjUGJ7oFT+xhlJo/YQBh94McyQkXKwivR3GmmQhx0 jFyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=LqGrjePh; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Kp7G/f+F; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj1-v6si2120531plb.286.2018.02.12.05.26.37; Mon, 12 Feb 2018 05:26:54 -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; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=LqGrjePh; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Kp7G/f+F; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934253AbeBLLu6 (ORCPT + 99 others); Mon, 12 Feb 2018 06:50:58 -0500 Received: from casper.infradead.org ([85.118.1.10]:35568 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933898AbeBLLu4 (ORCPT ); Mon, 12 Feb 2018 06:50:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yXyZo0eftHK2I/Um0dYt4AqY34L/VH4bsaocifTmbbk=; b=LqGrjePh22yfBOVQki7mvwVM3 9WHyB/pAQ2hW9d3jiJiVX89R1DtJWoiTHpH6iEB0lCzII5Q3FJBLjnFkMQS+xDIY2wUvoP/0tR6VI w0Gvvq0qaMg74Rj2eivB53EioSGNiTm/eCawWviY2SAGvasNYf3XNE856OehEFQEl7kUwSbbeyTLI PKI/oELsX8X9cudNozOowDcgo9KpbpC0V42aPDzoLHfOShl9+I1m7XWCibj0uchlEwiiaD9FNEsNy L6NOIIAbnrR/Ft7pbhCiKil+gWiY1q6/Y6kxxemjnAo/HfJxSIb+ZL2s12a7F+vbYcMXK3iCzj5pE tAesJJKtg==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elCcw-0001kh-NU; Mon, 12 Feb 2018 11:50:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yXyZo0eftHK2I/Um0dYt4AqY34L/VH4bsaocifTmbbk=; b=Kp7G/f+FIhxDfaR10yGNCi75T 6GG09Ofw5X/MXmiI/xvmBcXNawqjcmrYait/vf9QGEZKoZZ3RPKvuUlQBMGYOO+y5dXoHABKGxSLz iiaoVbP+BEW5M3NN4t0flAXWgiE0EH0pIO2saQDhQoaXpNuc7K2M3ikhOERTx4+KrGuBF4aKlyHLx CKZHoKfsloGcqHhZJOg23UFU2RQHLwLpVlLZqpWxKfpp97VbQKb8SLGNSPS+N6BOwCTsQGMgpgLHV Rf1N4UIMoyhO4g1lc9MTHJV80nv2+qYsgy/2ReQt/LCNq7aLzfF+a7XcYHahkgcM2VJ2YPgrT9ak1 ImSeQIbzw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1elCcX-0006Dg-Ja; Mon, 12 Feb 2018 11:50:05 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E988320274D62; Mon, 12 Feb 2018 12:50:02 +0100 (CET) Date: Mon, 12 Feb 2018 12:50:02 +0100 From: Peter Zijlstra To: Ingo Molnar Cc: hpa@zytor.com, tglx@linutronix.de, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, linux-tip-commits@vger.kernel.org, Dave Hansen , Borislav Petkov , Arjan van de Ven Subject: Re: [tip:x86/pti] x86/speculation: Use IBRS if available before calling into firmware Message-ID: <20180212115002.GI25181@hirez.programming.kicks-ass.net> References: <1518362359-1005-1-git-send-email-dwmw@amazon.co.uk> <20180212102211.cdrrqqd4hdw7xu5y@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180212102211.cdrrqqd4hdw7xu5y@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 12, 2018 at 11:22:11AM +0100, Ingo Molnar wrote: > > +static inline void firmware_restrict_branch_speculation_start(void) > > +{ > > + alternative_msr_write(MSR_IA32_SPEC_CTRL, SPEC_CTRL_IBRS, > > + X86_FEATURE_USE_IBRS_FW); > > +} > > + > > +static inline void firmware_restrict_branch_speculation_end(void) > > +{ > > + alternative_msr_write(MSR_IA32_SPEC_CTRL, 0, > > + X86_FEATURE_USE_IBRS_FW); > > BTW., there's a detail that only occurred to me today, this enabling/disabling > sequence is not NMI safe, and it might be called from NMI context: Wait, we're doing firmware from NMI? That sounds like a _REALLY_ bad idea.