Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp986371imm; Fri, 29 Jun 2018 09:28:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJHtYaBwcyU7OIcfbGSeASK73N3z3mZIMJ1GjgAFeKWqy+47Q/BBa4g3QRlJ0i+mThKkRyS X-Received: by 2002:a17:902:b20d:: with SMTP id t13-v6mr15834187plr.121.1530289691922; Fri, 29 Jun 2018 09:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530289691; cv=none; d=google.com; s=arc-20160816; b=SxfVjb+jJc8BcTB+mzZYeQsX8PbkMnIR9a5xeW0Ly2iv3MrtzTKZ+kMFG39m36qSyZ i40geqSfbmRXLVXOopvCkBlvaE+lCsEm/zFHvvFoLE1vEQo6bNaH5Nr1eI3uSeIy0q3C uszWXlEysG1n5GfcEcSEm2wKHw4hOLf7gaG4NcQ8wD5K6J1DMlDMmCahnV+QvyChpKFp 2pYB4rvSzpdKOt9jNe0jvQEHyxrJC8Q0AN9SKeB2O2iI8Zac7vRQUd0MhLd/NY9c3aFA RCmxHDN1ikPYkDPGhxV+xb+2dTjChdjksf4YC4WokvnvWiHZ2w3QWmgG7P4QuRnePl2u g2HA== 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=I1RQy2M2rGgTNenpI8YcXwa/6W/muJ648wFKIHhaB70=; b=lQu09Gl6bsEvyteJ9927g9mlVZH6+UKhf5ztu+kzjZWEcn6pGrwEpp7U2N1P9tnAeN 6m8ueMWfw/dHQgmBpc23KJDQdp106KUpXM7s0wh+Dq/vMn7NbyJNrXhZ2Oq57xY06yD3 MrIe7rz97z5XQOmamEAbIBceCiokgiFJBGx0s+TLUM2qAuwY4ddKi8KJhMSxPw2HWu8C W/fl3sh6iMooMF4ZDK1RJ4x8SPTIkPB4DAmtHxNefSqXj0jgjcnIvq6LealgLYvcj3ie lRzlq4qW8x3i6j5ju5qXjLr04Ky5JPVfyO1KwD9B8FgAqtUWWcgp8UTW85UBN2dKc7Z0 VePg== 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 k2-v6si1411644pfh.252.2018.06.29.09.27.55; Fri, 29 Jun 2018 09:28:11 -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 S1755425AbeF2OfR (ORCPT + 99 others); Fri, 29 Jun 2018 10:35:17 -0400 Received: from mga17.intel.com ([192.55.52.151]:9673 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755152AbeF2Oeq (ORCPT ); Fri, 29 Jun 2018 10:34:46 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jun 2018 07:34:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,285,1526367600"; d="scan'208";a="51490715" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga008.fm.intel.com with ESMTP; 29 Jun 2018 07:34:45 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "H Peter Anvin" Cc: "Ashok Raj" , "Alan Cox" , "Dave Hansen" , "Peter Zijlstra" , "Rafael Wysocki" , "Tony Luck" , "Ravi V Shankar" , "linux-kernel" , "x86" , Fenghua Yu Subject: [PATCH v2 2/4] x86/split_lock: Align x86_capability to unsigned long to avoid split locked access Date: Fri, 29 Jun 2018 07:33:25 -0700 Message-Id: <1530282807-66555-3-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1530282807-66555-1-git-send-email-fenghua.yu@intel.com> References: <1530282807-66555-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_cpu_cap() calls locked BTS and clear_cpu_cap() calls locked BTR to operate on bitmap defined in x86_capability. Locked BTS/BTR accesses a single unsigned long location. In 64-bit mode, the location is at: base address of x86_capability + (bit offset in x86_capability % 64) * 8 Since base address of x86_capability may not aligned to unsigned long, the single unsigned long location may cross two cache lines and accessing the location by locked BTS/BTR intructions will trigger #AC. To fix the split lock issue, align x86_capability to unsigned long so that the location will be always within one cache line. Signed-off-by: Fenghua Yu --- arch/x86/include/asm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index cfd29ee8c3da..5ad6ba4657a2 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -105,7 +105,8 @@ struct cpuinfo_x86 { __u32 extended_cpuid_level; /* Maximum supported CPUID level, -1=no CPUID: */ int cpuid_level; - __u32 x86_capability[NCAPINTS + NBUGINTS]; + __u32 x86_capability[NCAPINTS + NBUGINTS] + __aligned(sizeof(unsigned long)); char x86_vendor_id[16]; char x86_model_id[64]; /* in KB - valid for CPUS which support this call: */ -- 2.5.0