Received: by 10.223.176.46 with SMTP id f43csp1901341wra; Thu, 25 Jan 2018 01:44:01 -0800 (PST) X-Google-Smtp-Source: AH8x224hoX3qQhLDLsx0xdg1EcKd6W0jja/6j8H8CwymqGCQqbVtGrVKIcFVTICVu0bG7fw+rPCJ X-Received: by 10.99.61.205 with SMTP id k196mr11261162pga.370.1516873441036; Thu, 25 Jan 2018 01:44:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516873441; cv=none; d=google.com; s=arc-20160816; b=qsgAwcxhTi4PSdrJwX2K1NiaRozIrrOb11KZ30XzADUvcGhOp3B6QjNsJjXDqyp21O oj8rWKnvA0xGuiQlCN5gX7xmsZZLrYeSxxjba5+ZB6JnA2X8xCifqbsf4ij3WiDt8FCA sAvQWSqOFNef2Cez7O/hKeYqUOIOz4y/3OrFc5PHAsDO2tP0WwjKq+ZJZTcJ7q2FjHU7 qt500SZecH11w0UivtRvlrl6DOdXKHdI369K1kTBzpfblEwCaFUfa9krQ3TWYY8IloGI 4zKxqwPe8WfbRJJ429la+T6h8EpXyaY0rTZ32Dc1EY7U3KNMpWMxez42Yl7EJYEmn9Y7 WcEA== 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:arc-authentication-results; bh=UZSgVl7OJmFjSahAiDZ052mrc+SgDV8i2mc+EpXJcwA=; b=GS4pAXRhcMl0llIFsLVnf2Uibi09iY0xQha2zy5wJQaQnzG6yVxFVCpjSm8tOGEARr ZLUMk7RWncrJ/8NtnQk38kqZWSathJoMdzyR1UUAgGI8NsW/SrBwCdGgdk0xOo/xNJJX nOvL+/5XOKP/0m1HTB5aEv+B9iSHcH8p7iNx4NMYSk+2xu4OtNwI8jn/DUQFIwRfRSlt ZwLZK2BiqebaS0G3jpWCuqrMEyZN3YOT5+a+GwH3lsBQsVoujBpNd3/Z+mCwrSaDDaHo aGc9K9HVdz9bkT2lYrEGOGyg5IHoOXPgMhF/3X668l0mY+kDcqt2eBM+T0iRHS5UvrGZ glww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sHZoH47a; 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 w2-v6si1719834plz.168.2018.01.25.01.43.46; Thu, 25 Jan 2018 01:44:01 -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=bombadil.20170209 header.b=sHZoH47a; 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 S1751398AbeAYJnM (ORCPT + 99 others); Thu, 25 Jan 2018 04:43:12 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:47339 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbeAYJnJ (ORCPT ); Thu, 25 Jan 2018 04:43:09 -0500 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=UZSgVl7OJmFjSahAiDZ052mrc+SgDV8i2mc+EpXJcwA=; b=sHZoH47aSFQHDWwxqGNcz8kEz XtOvWM0/ELO2zTFqlvEOxTBwBMJQacEmpQPrDZW5Lqy7XfKDCp8gbjrEGlHiH0UPRfoJi8UzF3KLD uepRjRDsm/pgRhMQe66rd+ibqwLZ5u14RwGVcUYjJyxYbjneS3VwdLqQifjDsxRQJ5fseie6DCVzK WdmKKQY2OWM+3uenxMvRd3ml98e7pTPSsp6wZNotMjkmBHV9BEJ7snJRdy7J9YEKIu0Yp0mnOoe+p 3l5szUKBKEHk49tkDq001RuVumZ3nlxqScLFSB4Pk7i2pZaXxjsJX6WrB+2Q3krnK0Ri+nFq7vR0z H38WJb3mw==; 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 1eee3g-0000g9-5Q; Thu, 25 Jan 2018 09:43:00 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 309502029B0FD; Thu, 25 Jan 2018 10:42:58 +0100 (CET) Date: Thu, 25 Jan 2018 10:42:58 +0100 From: Peter Zijlstra To: David Woodhouse Cc: arjan@linux.intel.com, tglx@linutronix.de, karahmed@amazon.de, x86@kernel.org, linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com, bp@alien8.de, pbonzini@redhat.com, ak@linux.intel.com, torvalds@linux-foundation.org, gregkh@linux-foundation.org, dave.hansen@intel.com, gnomes@lxorguk.ukuu.org.uk, ashok.raj@intel.com, mingo@kernel.org Subject: Re: [PATCH v4 5/7] x86/pti: Do not enable PTI on processors which are not vulnerable to Meltdown Message-ID: <20180125094258.GZ2228@hirez.programming.kicks-ass.net> References: <1516872189-16577-1-git-send-email-dwmw@amazon.co.uk> <1516872189-16577-6-git-send-email-dwmw@amazon.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516872189-16577-6-git-send-email-dwmw@amazon.co.uk> 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 Thu, Jan 25, 2018 at 09:23:07AM +0000, David Woodhouse wrote: > +static bool __init early_cpu_vulnerable_meltdown(struct cpuinfo_x86 *c) > +{ > + u64 ia32_cap = 0; > + > + if (x86_match_cpu(cpu_no_meltdown)) > + return false; > + > + if (cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES)) > + rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap); I think it was suggested a while back to write this like: if (cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES) && !rdmsrl_safe(MSR_IA32_ARCH_CAPABILITIES, ia32_cap)) to deal with funny virt scenarios where they accidentally advertise the CPUID bit but don't in fact provide the MSR. > + > + /* Rogue Data Cache Load? No! */ > + if (ia32_cap & ARCH_CAP_RDCL_NO) > + return false; > + > + return true; > +}