Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2676862imb; Mon, 4 Mar 2019 11:07:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzsdMiss8tR4xGcneTZ+apSBdM1iBBJk9ZpYUUREb8yRO9lHy4iHQLFBmNYsX86aeiPVv+2 X-Received: by 2002:a65:6383:: with SMTP id h3mr19540831pgv.11.1551726436839; Mon, 04 Mar 2019 11:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551726436; cv=none; d=google.com; s=arc-20160816; b=vWpB9v38Bon8ET4MRVSAIe5RHv9F5o4/X11drP3MS+zIvzU92IZ6UrmIZyGkZipQ0c XVXvDleP2SLevHTisBjpqUmwvMLsBOr9jZD9iTu+LqlOzX2d9hxtaRKrC2V+Ow7aUKWN uIuVkE6WAYclPmLCthr4eNxPq6ZgY4RZi7NeBcLoUN+PA5EnyC8WdqmUQjwvZaBfYUKW djkn/tTbkKL4Dlw3A2K9VmvqWedsQSntin9YrnHG+9SbsJH19G/amq1e19seSlkHJrPE yy1VOInScsxPQQroT2HuNzULTW6RnXzoBubdg5wGC9g4usn+BAuFw1pAYy2caxamI3Kx Btzw== 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; bh=sbe0f3o1Eyos9PvZDnSYkK84NYGLZ7SJoFMr0rVdPoI=; b=LYQfmxuKAOt2rJWjXSn6nDzdeA4I+ZFHKLsHBYeJni1atBJ7fBBej0Rn8vS1XxC3Iq vdAdVRbZQw9IBu+2uf1u68iNKHf/36+xr+zZSI9dLTQyGuxl5Ra6Edlr0mu1eT/DP0qe jyn4Co/SLPYeCKRTi1326+3quFoU06D1R1xHTYNxm7idvsLp3oW3Rx8tkDumDM1BT0Wx tq9NJRsz44mO2aiGiwKum9fzBbdgzaZsMNJpL+LTPnx6SnWJPIaVD0urHwY0MzHJuqTY wvD7nd0u7p4xRKOtkZxn7W2e7DhdiOMFhZlgqXzPsM9PLiIHHXGIl17znYjCS/HcrjDK 8egA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si5745453pgq.72.2019.03.04.11.07.01; Mon, 04 Mar 2019 11:07:16 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727278AbfCDTGR (ORCPT + 99 others); Mon, 4 Mar 2019 14:06:17 -0500 Received: from mga14.intel.com ([192.55.52.115]:37323 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbfCDTGR (ORCPT ); Mon, 4 Mar 2019 14:06:17 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2019 11:06:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,441,1544515200"; d="scan'208";a="304310397" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga005.jf.intel.com with ESMTP; 04 Mar 2019 11:06:16 -0800 Date: Mon, 4 Mar 2019 10:59:22 -0800 From: Fenghua Yu To: Dave Hansen Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Paolo Bonzini , Ashok Raj , Peter Zijlstra , Ravi V Shankar , Xiaoyao Li , linux-kernel , x86 , kvm@vger.kernel.org Subject: Re: [PATCH v4 07/17] x86/split_lock: Enumerate #AC for split lock by MSR IA32_CORE_CAPABILITY Message-ID: <20190304185922.GA231946@romley-ivt3.sc.intel.com> References: <1551494711-213533-1-git-send-email-fenghua.yu@intel.com> <1551494711-213533-8-git-send-email-fenghua.yu@intel.com> <8b810f50-e4ed-7020-c0df-203cf98c3ce8@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b810f50-e4ed-7020-c0df-203cf98c3ce8@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 04, 2019 at 10:58:01AM -0800, Dave Hansen wrote: > > * Clear/Set all flags overridden by options, after probe. > > diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c > > index 2c0bd38a44ab..5ba11ce99f92 100644 > > --- a/arch/x86/kernel/cpu/cpuid-deps.c > > +++ b/arch/x86/kernel/cpu/cpuid-deps.c > > @@ -59,6 +59,7 @@ static const struct cpuid_dep cpuid_deps[] = { > > { X86_FEATURE_AVX512_4VNNIW, X86_FEATURE_AVX512F }, > > { X86_FEATURE_AVX512_4FMAPS, X86_FEATURE_AVX512F }, > > { X86_FEATURE_AVX512_VPOPCNTDQ, X86_FEATURE_AVX512F }, > > + { X86_FEATURE_SPLIT_LOCK_DETECT, X86_FEATURE_CORE_CAPABILITY}, > > {} > > }; > > Please reindent the rest of the structure whenever you break the record > for name length. Ok. Will do it. > > > diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c > > index fc3c07fe7df5..0c44c49f6005 100644 > > --- a/arch/x86/kernel/cpu/intel.c > > +++ b/arch/x86/kernel/cpu/intel.c > > @@ -1029,3 +1029,24 @@ static const struct cpu_dev intel_cpu_dev = { > > > > cpu_dev_register(intel_cpu_dev); > > > > +/** > > + * init_core_capability - enumerate features supported in IA32_CORE_CAPABILITY > > + * @c: pointer to cpuinfo_x86 > > + * > > + * Return: void > > + */ > > +void init_core_capability(struct cpuinfo_x86 *c) > > +{ > > + /* > > + * If MSR_IA32_CORE_CAPABILITY exists, enumerate features that are > > + * reported in the MSR. > > + */ > > + if (c == &boot_cpu_data && cpu_has(c, X86_FEATURE_CORE_CAPABILITY)) { > > First of all, please endeavor to leave the main flow of the function at > the first indent. > > *If* you were to do this, it would look like: > > > if (c != &boot_cpu_data) > return; > if (!cpu_has(c, X86_FEATURE_CORE_CAPABILITY)) > return; > > rdmsrl(...); Ok. Will do it. > > But, it goes unmentioned why you do the boot-cpu-only restriction here. > It doesn't match the behavior of the two functions called before > init_core_capability(): > > init_scattered_cpuid_features(c); > init_speculation_control(c); > > So why is this new function special? The function sets the split_lock_detect feature which needs to be applied before BSP calls apply_enforced_caps() in get_cpu_cap(). And I want to enable split lock detection in earlier phase to detect split lock earlier. Thanks. -Fenghua