Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4867318yba; Wed, 10 Apr 2019 06:38:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnrO6SnkEIbL4zAHyQF2bl7OZ0fL2JJ0etHXLcj4tjnVVu3u+vpIP+TUe8Hxbtz8x1lY3m X-Received: by 2002:a65:5c42:: with SMTP id v2mr25821412pgr.360.1554903495446; Wed, 10 Apr 2019 06:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554903495; cv=none; d=google.com; s=arc-20160816; b=LzazFCk9rAvgU03AfeuJ4zRNFRebYBk4aE5cw/n7zltLB4anBWy4r8nlzWonmyaJsI xYTaujEdJEc1tO9/Bh/2Us42MAD0sjkr/JKayQriCOnI6e4gOGI3WFGdYz5VgtBl3e3s dDGk8JthcOuD6RnHI62E2QUPwgwHdZAWCviE26fFLSDepotTD3KImu5Tc+fNvZ+EhlAU pQGvOjYPO6ayklipDRj2N+Se3TwnyutUwHg/PnS44F8oNG5gnKDhzhQk2RJ8jiSmF2vg tbZlmsBkdHwyNwVYmc8NlCouPkQ+4H/8kAfBR0T5wJjN8J9GaQfBlff8192iaLx1OhSW qC5g== 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=xZYSsd1/4RdkTAkfLTlZ/H5n7PqGu//Tho1uekaCCss=; b=xKT+cPSMG0SsKhC2VRaQ+IDAV94nfyaUyaD4NhHGi42DJujWZHgIGbil4dSlibswex mxNTzRowawiDCEJi9pznqs5fIMTbfGGFULmObfvtKb+yWIQo0521l2+rmn99UUzftTBs LRsqQ2tZXvO1q7je/XlyMD6RrbOf4Y8BNTFiO8mg8DwmprMVz+mg3L/Hpm7dQfDmNhw5 rBRhHdrYzjaGyf22luq8WD3OZYUimpXPCz6IJi3vlaot70O/bcF0d25AyVJOVr7oJUoO RGCZtjMvHZ4qWaJIFh3vTxzyYZjqLGfszFMs5C7QOHuEvYERYv+6qdNtwVoksbiM6QoR OpzQ== 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 h66si8338990pgc.418.2019.04.10.06.37.59; Wed, 10 Apr 2019 06:38:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732067AbfDJMnf (ORCPT + 99 others); Wed, 10 Apr 2019 08:43:35 -0400 Received: from mga07.intel.com ([134.134.136.100]:64825 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730084AbfDJMnf (ORCPT ); Wed, 10 Apr 2019 08:43:35 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 05:43:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="141619105" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga007.fm.intel.com with ESMTP; 10 Apr 2019 05:43:33 -0700 Date: Wed, 10 Apr 2019 05:35:46 -0700 From: Fenghua Yu To: Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , H Peter Anvin , Dave Hansen , Paolo Bonzini , Ashok Raj , Peter Zijlstra , Kalle Valo , Xiaoyao Li , Michael Chan , Ravi V Shankar , linux-kernel , x86 , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v6 13/20] x86/split_lock: Enable split lock detection by default Message-ID: <20190410123546.GA214455@romley-ivt3.sc.intel.com> References: <1554326526-172295-1-git-send-email-fenghua.yu@intel.com> <1554326526-172295-14-git-send-email-fenghua.yu@intel.com> <20190410000229.GA209676@romley-ivt3.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Apr 10, 2019 at 08:31:31AM +0200, Thomas Gleixner wrote: > On Tue, 9 Apr 2019, Fenghua Yu wrote: > > On Thu, Apr 04, 2019 at 08:07:57PM +0200, Thomas Gleixner wrote: > > > On Wed, 3 Apr 2019, Fenghua Yu wrote: > > > > static void early_init_intel(struct cpuinfo_x86 *c) > > > > { > > > > u64 misc_enable; > > > > > > > > + init_split_lock_detect(c); > > > > > > so we have in early boot: > > > > > > early_cpu_init() > > > early_identify_cpu() > > > this_cpu->c_early_init(c) > > > early_init_intel() { > > > init_split_lock_detect(); > > > } > > > .... > > > cpu_set_core_cap_bits(c) > > > set(FEATURE_SPLIT_LOCK) > > > > > > I don't have to understand how init_split_lock_detect() will magically see > > > the feature bit which gets set afterwards, right? > > > > early_init_intel() is called twice on the boot CPU. Besides it's called > > in earl_cpu_init(), it's also called in: > > identify_boot_cpu() > > identify_cpu() > > init_intel() > > early_init_intel() > > init_split_lock_detect(); > > > > It's true that init_split_lock_detect() doesn't see the feature bit when > > it's called for the first time in early_cpu_init(). But it sees the feature > > bit when it's called for the second time in identify_boot_cpu(). > > That's hideous, really. > > > So is init_split_lock_detect() in the right place? > > You're not seriously asking that? > > It's obviously not the right place. We are not placing calls at random > points just because they happen to work by chance. Is it OK to put init_split_lock_detect(c) after early_init_intel() in init_intel()? X86_FEATURE_SPLIT_LOCK_DETECT is available now and init_split_lock_detec() is called only once on each CPU. @@ -746,6 +749,8 @@ static void init_intel(struct cpuinfo_x86 *c) { early_init_intel(c); + init_split_lock_detect(c); + intel_workarounds(c); Thanks. -Fenghua