Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1053275imm; Fri, 29 Jun 2018 10:33:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcddy454qrGKF70KnEA/joUAZ4h07cB8pQMQVk3RJ/kL9V76mVJbNtZv3605Nb0d4H6s593 X-Received: by 2002:a62:1f06:: with SMTP id f6-v6mr8304551pff.140.1530293584300; Fri, 29 Jun 2018 10:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530293584; cv=none; d=google.com; s=arc-20160816; b=dLEOXgWC6RzTE7h7MW/v1LSqp9j+o62gfZRfheoH/OjPaus8w5qJ8gt4oJkMCYve9x igDkuAUMeXS/Dc11CpniEgpJXMR0wBCQAZ9G1HwvtD4ugppNCp733d15qb/cvk38GFhC vhwGrkAzaUY7s/7GYOsUwRet1Vjxxgy2PCyYvsNNyG0g9foW5MT+1GJ6bzs98zvM5PNC 7P2ng/3cTx1cnao4ntXUpjKfm6+TLn1xVw/2BVKhVBAnNXfeezO6SorfCVL75w/hgUQB NkKn1HVztsqPlGRcT7J1dLF2NM26Dkv5zzxzNwu5vvicLg1JNbxarNjf1x/Ei5Y7xlpF JAPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=zCtnExfA/Oa45++RnecndfgSH7Z/53YJwLWakseJAss=; b=z8RhsighYR2gg/ImfDli3NFWRUgaAPPXKx6bGCig58BkysBTdeapHQOUZMWB22r/xg 5kphdYj1A3WJ7sxe1fQJqCicpT2LUZgDQ7rjUOGzIc43xnwaU3FkKIcf2BYtYnDEvj2V VfDLNo0L69iav7reyPabKKSPykwPcdMTt0nZxZowym+IPPo+GPexT7dG/B8zsDhoMHVj jjr6H4BAILg3zXRQM+QKnVEcsxwfWuAYWE2RX8esGcTK0OCiX1mZ7DCt2MGmssc55ofN G25sKniSOYgNriyVTO2aBXxeeIPDgb2zEZXBAgpaGkkBUkQxva6BnTI7B+diuwdpJMw0 Gp+Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n59-v6si9458056plb.198.2018.06.29.10.32.49; Fri, 29 Jun 2018 10:33:04 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936913AbeF2QX7 (ORCPT + 99 others); Fri, 29 Jun 2018 12:23:59 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59399 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933566AbeF2QX6 (ORCPT ); Fri, 29 Jun 2018 12:23:58 -0400 Received: from p4fea482e.dip0.t-ipconnect.de ([79.234.72.46] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fYwBM-0002ew-FQ; Fri, 29 Jun 2018 18:23:36 +0200 Date: Fri, 29 Jun 2018 18:23:35 +0200 (CEST) From: Thomas Gleixner To: Dave Hansen cc: Fenghua Yu , Ingo Molnar , H Peter Anvin , Ashok Raj , Alan Cox , Peter Zijlstra , Rafael Wysocki , Tony Luck , Ravi V Shankar , linux-kernel , x86 Subject: Re: [PATCH v2 1/4] x86/split_lock: Enumerate #AC exception for split locked access feature In-Reply-To: Message-ID: References: <1530282807-66555-1-git-send-email-fenghua.yu@intel.com> <1530282807-66555-2-git-send-email-fenghua.yu@intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Jun 2018, Dave Hansen wrote: > On 06/29/2018 07:33 AM, Fenghua Yu wrote: > > +/* Detect feature of #AC for split lock by probing bit 29 in MSR_TEST_CTL. */ > > +void detect_ac_split_lock(void) > > +{ > > + u64 val, orig_val; > > + int ret; > > + > > + /* Attempt to read the MSR. If the MSR doesn't exist, reading fails. */ > > + ret = rdmsrl_safe(MSR_TEST_CTL, &val); > > + if (ret) > > + return; > > This is a bit fast and loose with how the feature is detected, which > might be OK, but can we call out why we are doing this, please? > > Is this MSR not really model-specific? Is it OK to go poking at it on > all x86 variants? Or, do we at _least_ need a check for Intel cpus in here? That definitely needs a vendor check. Also the whole code needs to be compiled out if CONFIG_INTEL=n. Aside of that this wants to be enumerated. CPUID or MISC_FEATURES and not this guess work detection logic. Why do I have to ask for that for every other new feature thingy? And pretty please, can we either stick that stuff into cpu/intel.c or if it really needs a separate file avoid that horrible test_ctl.c file name? Thanks, tglx