Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp564828yba; Wed, 3 Apr 2019 14:33:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyel1NMM9mMVXyHTi+EL1hmtcM2ra9G+ugxCatGvBOtyslLVoWB1cjV1xZ8uajs9X8xrxyS X-Received: by 2002:a63:4e64:: with SMTP id o36mr1996262pgl.213.1554327192803; Wed, 03 Apr 2019 14:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554327192; cv=none; d=google.com; s=arc-20160816; b=cDE0SgIg4Tys+T0u0DWLKXl7NawI5HshJ7fkEz5yYrMder4lWrzyqo102MdODDSmR0 SnxY4gV9AQouQHh1a3TbPLtZqz9WiHSNczypa8GvJuTiKDbct1O+L4JBtzuu1iZZVovm /ZXeOhqVHP8dtAgfPLXejTaNzl0MTKrt3Bdg09NICge2k4xzTLv1Dt/3PWCk3c+hq9AF qLDFF3+26qNQ44/oAJfLMOKOqH7XMIaZEGSX00hZBZW5i5ToWvcizvsQJGKt7V0clp66 V5QD6EbjGZ3l8pc1PnfsM0j8/PcG98VHEJ4k+V+bZHDwNMfFB0hkUWGVxY3H5JNCbhyx 7p8g== 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; bh=1JVIOkYrr8R0Nzco8T1BC5PzpgksQcwwVXuZcubJIBQ=; b=HJRwpIxVyYaEuLWZWScRRYjhANFlJHBsSbaDh9sZ10pN78lY+ziELZwnCWqV6kAv+g oJw9uSKatc3XSuqKG3yPoKPkBI9pxe4uXUjVB8OOLEPbbApU41IA/BYD316OFbZu09gy TZNO0crL9XzKQ4h/kZbPFH88K7vAYZuhYRTvBuSs4CLYOv94X5Z+BHLMoceDp6X6A4s0 +2gScd7HHMdXqd/il0uH8DR59cbWIcdxbCTp31mYuuzltKGhUYi9FtaW9SRkodTkcsbj a8B5SUeg2Qm9gEe4Rvuk2OwNEHZVf1H+kkW17k2fGJHMrNTOwsgq03e0FzWPzGeFGwO7 FeYg== 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 d30si15431563pld.82.2019.04.03.14.32.57; Wed, 03 Apr 2019 14:33:12 -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 S1726184AbfDCVb7 (ORCPT + 99 others); Wed, 3 Apr 2019 17:31:59 -0400 Received: from mga05.intel.com ([192.55.52.43]:37332 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbfDCVaV (ORCPT ); Wed, 3 Apr 2019 17:30:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 14:30:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,306,1549958400"; d="scan'208";a="334754231" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga005.fm.intel.com with ESMTP; 03 Apr 2019 14:30:10 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H Peter Anvin" , "Dave Hansen" , "Paolo Bonzini" , "Ashok Raj" , "Peter Zijlstra" , "Kalle Valo" , "Xiaoyao Li " , "Michael Chan" , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, Fenghua Yu Subject: [PATCH v6 01/20] x86/common: Align cpu_caps_cleared and cpu_caps_set to unsigned long Date: Wed, 3 Apr 2019 14:21:47 -0700 Message-Id: <1554326526-172295-2-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1554326526-172295-1-git-send-email-fenghua.yu@intel.com> References: <1554326526-172295-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 cpu_caps_cleared and cpu_caps_set may not be aligned to unsigned long. Atomic operations (i.e. set_bit and clear_bit) on the bitmaps may access two cache lines (a.k.a. split lock) and lock the bus to block all memory accesses from other processors to ensure atomicity. To avoid the overall performance degradation from the bus locking, align the two variables to unsigned long. Defining the variables as unsigned long may also fix the issue because they are naturally aligned to unsigned long. But that needs additional code changes. Adding __aligned(unsigned long) is a simpler fix. Signed-off-by: Fenghua Yu --- arch/x86/kernel/cpu/common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index cb28e98a0659..3716e2bb028b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -488,8 +488,9 @@ static const char *table_lookup_model(struct cpuinfo_x86 *c) return NULL; /* Not found */ } -__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS]; -__u32 cpu_caps_set[NCAPINTS + NBUGINTS]; +/* Aligned to unsigned long to avoid split lock in atomic bitmap ops */ +__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long)); +__u32 cpu_caps_set[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long)); void load_percpu_segment(int cpu) { -- 2.19.1