Received: by 10.223.176.46 with SMTP id f43csp685068wra; Wed, 24 Jan 2018 04:29:57 -0800 (PST) X-Google-Smtp-Source: AH8x2244bLhN2DEBXQ38wntUyk65NHZSkC5ZWAFKhSiU29+LAO7HuiTN49oHCYRbuJ0CfoKIWkgJ X-Received: by 2002:a17:902:b70e:: with SMTP id d14-v6mr8249288pls.224.1516796997584; Wed, 24 Jan 2018 04:29:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516796997; cv=none; d=google.com; s=arc-20160816; b=IFPa+Um/Dcbbnm8w068BWz/dgFRRyG61eTcU4AjrfkHoQIIrdiDLTMQvN+aFx0y5zi tRKu15ss6K/Cq7eO4IpuFHYuNPI6V7FSxP/zjhkB6/+Sxen4KazX+VsuGLVto9tEuMij WPj9jHyliaN6++6st9Mr8rA8G0GqVg1soBh68jEYak+OKDsxYYXxXgGD8bYljXYR2eUf Lhi/CWgs7+KOsAqDVYrYPpyIsp6ryFphXPfb5jwNZWVK4ruf8ytts5pYvojYfLLaXhon c4QIOF/TRIJK0eQBg/Y0qzHOFgu6BBkKHZstR47NNiqk6HacZGn0wZ6RDmrFYONpgzH6 +f4A== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=9TSrCmNSiFGuSuZBNArEYP2xm79aLeNNux2kO9GkAaw=; b=c53Mr22ZWLM7oL2y1YJgzqDX6plTpX/oZYSIwQzobg8J5dEf59bBi96rCIOwov2oYe 0tHBnZAAkb0zWegWVO+IroO7KgHVP3Au4RqbF+xLBYoSJfZ4sBUJ9VtJsKMkQ5gmGyxl whUUMF3SwAw5GnZngliM2hgwmvURMi58YEDtwrgxWm3T51F0Zmd/LZP7dxra69tWW0WR LIg189NYZYQuFtn6sqKTmGRrvHLWoFiDk8/cbixcps66ZHd3IT3/a7xRxOAPbbJ+LsE4 DlSWP46ExgV/B+MML8Mf/3RlkifHvcv4DSvP6ck1UcpzOcxJM6sapqhCzDOrrsP69cso 3rNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=B1t/hTKT; 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 r194si2744213pfr.27.2018.01.24.04.29.43; Wed, 24 Jan 2018 04:29:57 -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=B1t/hTKT; 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 S933591AbeAXM3V (ORCPT + 99 others); Wed, 24 Jan 2018 07:29:21 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:43645 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933397AbeAXM3U (ORCPT ); Wed, 24 Jan 2018 07:29:20 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To: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=9TSrCmNSiFGuSuZBNArEYP2xm79aLeNNux2kO9GkAaw=; b=B1t/hTKTrWAE8gmXhQa1j/fiSx BNkV2oYIdhsftyvggCph6+sKbXNg8sFaGRTnZK1FfsDM5dW/ENFa1ynaJ9P4F9Q+CfaBAKIV5B8dP WqD3YD6ckxLnjmCCH8aAeAUKOVoG7i0WGO092ws94OqMRO1UhenqwRAiq/i4O0YIADQxq7NlKJDhn 9rsPylgL70YRISqP6q2VU+JWR6GsT+IGLcG9/NkJOQeH8glx6OfX6VtfuGGHeEjAyeeWzeKnNoSMw ojrdpyHtY/D9TMs7geT9um5gRE59rkEGbWawv1S4iLrCwDMnI7gEl4gZM17y52nJSe0aRmUHOMdic voRmxu6A==; 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 1eeKAw-0006ez-Jd; Wed, 24 Jan 2018 12:29:12 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D04682029B0FB; Wed, 24 Jan 2018 13:29:08 +0100 (CET) Date: Wed, 24 Jan 2018 13:29:08 +0100 From: Peter Zijlstra To: David Woodhouse Cc: Thomas Gleixner , KarimAllah Ahmed , linux-kernel@vger.kernel.org, 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 , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Tim Chen , Tom Lendacky , kvm@vger.kernel.org, x86@kernel.org Subject: Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure Message-ID: <20180124122908.GI2249@hirez.programming.kicks-ass.net> References: <1516476182-5153-1-git-send-email-karahmed@amazon.de> <1516476182-5153-6-git-send-email-karahmed@amazon.de> <1516741116.13558.11.camel@infradead.org> <20180124084735.GM2228@hirez.programming.kicks-ass.net> <1516796091.13558.116.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1516796091.13558.116.camel@infradead.org> 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 Wed, Jan 24, 2018 at 12:14:51PM +0000, David Woodhouse wrote: > On Wed, 2018-01-24 at 09:47 +0100, Peter Zijlstra wrote: > > > > Typically tglx likes to use x86_match_cpu() for these things; see also > > commit: bd9240a18edfb ("x86/apic: Add TSC_DEADLINE quirk due to > > errata"). > > Ewww. > > static u32 hsx_deadline_rev(void) > { > ? ? ? ?switch (boot_cpu_data.x86_mask) { > ? ? ? ?case 0x02: return 0x3a; /* EP */ > ? ? ? ?case 0x04: return 0x0f; /* EX */ > ? ? ? ?} > > ? ? ? ?return ~0U; > } > ... > static const struct x86_cpu_id deadline_match[] = { > ? ? ? ?DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_HASWELL_X,????????hsx_deadline_rev), > ? ? ? ?DEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_BROADWELL_X,??????0x0b000020), > ? ? ? ?DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_BROADWELL_XEON_D, bdx_deadline_rev), > ? ? ? ?DEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_SKYLAKE_X,????????0x02000014), > ... > > ???????/* > ????????* Function pointers will have the MSB set due to address layout, > ????????* immediate revisions will not. > ????????*/ > ???????if ((long)m->driver_data < 0) > ???????????????rev = ((u32 (*)(void))(m->driver_data))(); > ???????else > ???????????????rev = (u32)m->driver_data; > > EWWWW! > Yes :/ We could look at extending x86_cpu_id and x86_match_cpu with a stepping option I suppose, but that might be lots of churn. Thomas?