Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp909925imb; Fri, 1 Mar 2019 18:54:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwSFRM/Ii9CYRnPtxBK0c1aVO9gEIvBJaC8EBaMWtb8e/Swqmc8xWBKOCqfO0bHOa7CGSUH X-Received: by 2002:a17:902:7d8c:: with SMTP id a12mr8869974plm.255.1551495287736; Fri, 01 Mar 2019 18:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551495287; cv=none; d=google.com; s=arc-20160816; b=VKG4+zeTpCK5ojQkn9hfIVSruLme1XATpNakTQmJ/wzOFE4uPQHalUrUceyu3gMzxB GvNBSiyiQt5J5fnG18iCtBe5hUbvo83PEt6ke8yv5s85jLKbHY9u9mbUmwrwHWKR8Il3 kuVgzjmj4mvRTC32l/06V8WxUpltDc+2jruJlFaCAxYc9NoS1ed9ezjWrTnS2piw5oV9 Qk4/AKkxU4aiXt4oEWL3RTuCR/AVcUGx0vkGP1kFHEEqylVAbjiHZ+T3EonijKxZkieO WRoMHKRv9udYdSIWW5CXZWGRpyyAC5h0SdbvmsWG7T9eKfv4X6Pd6t8nHmBAN1ywDTPa 9GKQ== 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=7TUWOa+XtProax+Qry2s7SisMSkMGCdRy1Zds//sRZI=; b=p9e7nyXEtfpnSwI3ww473gfcEQC7bafBsCUeRHHiKvi5H/qlqtbdp4kgL6qLhN8lr2 fiIbNzjUfniMZ9om+WTYRxLxgI/52wj59LfyFaYAHcNiTJliq4ODD3VbwEZqX0dkjyRP UEor4he9O87wPoyNAy8aq2B2GyolSJprgyW5O8GDPTMAHwZLOpNHMiOzKtek+Kkdx8a/ oHIHfY7lXd1nPMS9ozT01CMp5fpL44clMQ8Po/orAo+W+SNGAU0ckWEUes2RzUyp0K5k f9maZvv6q+31THDMJ0g0R/1DPtsIGGyerXlQwgInyIIoynxZmIhfWJFphQT6chk/IW71 Ux1g== 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 n81si12457966pfh.272.2019.03.01.18.54.32; Fri, 01 Mar 2019 18:54:47 -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 S1727841AbfCBCwb (ORCPT + 99 others); Fri, 1 Mar 2019 21:52:31 -0500 Received: from mga09.intel.com ([134.134.136.24]:61568 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727337AbfCBCwa (ORCPT ); Fri, 1 Mar 2019 21:52:30 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2019 18:52:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,430,1544515200"; d="scan'208";a="148572589" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga004.fm.intel.com with ESMTP; 01 Mar 2019 18:52:27 -0800 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H Peter Anvin" , "Paolo Bonzini" , "Dave Hansen" , "Ashok Raj" , "Peter Zijlstra" , "Ravi V Shankar" , "Xiaoyao Li " Cc: "linux-kernel" , "x86" , kvm@vger.kernel.org, Fenghua Yu Subject: [PATCH v4 01/17] x86/common: Align cpu_caps_cleared and cpu_caps_set to unsigned long Date: Fri, 1 Mar 2019 18:44:55 -0800 Message-Id: <1551494711-213533-2-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1551494711-213533-1-git-send-email-fenghua.yu@intel.com> References: <1551494711-213533-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 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) are simpler fixes. 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..51ab37ba5f64 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]; +/* Unsigned long alignment 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.7.4