Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4726353imm; Mon, 14 May 2018 11:56:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr76ogBa7bsynF9utfZ7uOig/1Dft3AYe5oNNvUfGIQQKpwWpWASux8A4E6KDEF61HG97mu X-Received: by 2002:a62:da17:: with SMTP id c23-v6mr11770253pfh.128.1526324189465; Mon, 14 May 2018 11:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526324189; cv=none; d=google.com; s=arc-20160816; b=tXicZbv3oS0AkRuUt3+D/mHjLKmVNqzz9Ed5IkGgRqgk/ivqEV0pqQ6hIUqr/ciY5I kbCeU6QA+P1f/SfRldreN2PxN7IOsEIAy07l0K0IvM3RoClWF+yu/F0K4I1al9G3oZBD 51ppjcFTjjscK0UkCgwopMQOD6/t0cxyTZdhtkbjMlFksKyrcB3xGPOsIwyPKisirkzK HcJILURlcDrL+8/kfCBYupSMtFZeI/GYvTmJww2PGVBAF4WS2XH8DclcuUXsSke5tbZg uevWOitdfGJozolJQeIbt4OeUDHFWUYhH5+DOpoix/ipUAbvLWMO9Ee9BTV+XLNeXVry SPeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HUho2zv215nQ0wnSIBrBl2OJ6tO4wJ+OJNoSZ78hbEg=; b=ZO0G5VLjW9NOWCpzEZLE6S2nOqln1bU7oWEQF3CMD1zSFOWsvfmZQ9CsdGFkiIncWX sXYDY+mh/P3dPm/pticyhea2VbvFNy4nS/IDq4RTVrCbfPMBlHDDD1Mb9ByPeVukzd/H 3moOhMeaTImu6yWE7byeRL5JoW05CSMAM7fYnkX3z9NqlozlnYXyqydkHwKLY19Cv9aP cYC56WFnJqTRECaK5cuLv9Bx9eG3Zug+wIrJCAxGhcsuvyZc0hTgXeiiMTNHFgQ07okz Ob07IwjbLH0JR9a2tXA8onUW43UiGhG+Mao8PoMUI9ne3wsA8zExFnc/qd2N3eebZfCl M7Kg== 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 g2-v6si9149799plm.181.2018.05.14.11.56.15; Mon, 14 May 2018 11:56:29 -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 S1752377AbeENSyT (ORCPT + 99 others); Mon, 14 May 2018 14:54:19 -0400 Received: from mga06.intel.com ([134.134.136.31]:55033 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752019AbeENSwa (ORCPT ); Mon, 14 May 2018 14:52:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2018 11:52:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,401,1520924400"; d="scan'208";a="39244631" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga007.fm.intel.com with ESMTP; 14 May 2018 11:52:27 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "H. Peter Anvin" , "Ashok Raj" , "Ravi V Shankar" , "Tony Luck" , "Dave Hansen" , "Rafael Wysocki" , "Arjan van de Ven" , "Alan Cox" Cc: "x86" , "linux-kernel" , Fenghua Yu Subject: [PATCH 04/15] x86/split_lock: Use non locked bit set instruction in set_cpu_cap Date: Mon, 14 May 2018 11:52:14 -0700 Message-Id: <1526323945-211107-5-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1526323945-211107-1-git-send-email-fenghua.yu@intel.com> References: <1526323945-211107-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org set_bit() called by set_cpu_cap() is a locked bit set instruction for atomic operation. Since the c->x86_capability is not aligned to cache line depending on compiler, the locked bit set instruction falls into split lock situation which causes #AC exception when #AC exception is enabled by split locked accesses. But set_cpu_cap() is only called in early init phase on a CPU and therefore there is no contention for set_cpu_cap(). So it's unnecessary to be atomic operation. Using __set_bit(), which is not a locked instruction, can fix the kernel split lock issue and is faster than locked instruction. Signed-off-by: Fenghua Yu Acked-by: Dave Hansen --- arch/x86/include/asm/cpufeature.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index b27da9602a6d..604f4c514efa 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -128,7 +128,8 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit) -#define set_cpu_cap(c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability)) +#define set_cpu_cap(c, bit) \ + __set_bit(bit, (unsigned long *)((c)->x86_capability)) extern void setup_clear_cpu_cap(unsigned int bit); extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit); -- 2.5.0