Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1594120imm; Fri, 29 Jun 2018 23:32:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLY8h4sGN4hfq5Dk+tAiuDgpYmvoHz708d2tCG2TL3hzU2J0G3GGie8HDJI0LQEDX9m5pQ4 X-Received: by 2002:a17:902:4101:: with SMTP id e1-v6mr17869998pld.205.1530340336263; Fri, 29 Jun 2018 23:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530340336; cv=none; d=google.com; s=arc-20160816; b=c8Ovxs8NVk11VAbVKm6CnHkHNI+xkemiTogGMUcWpjUFsdJlhTnngZ4tKS7fyGicEB FANS29/6y7wf0llK0ZVooyxeKJCCdxN5ulxlXfIe0cP0NraYdgEkktjJ0s/h0WeFa3fa FyG5xnz0391VsrwFulfoC2fpaR9FWoLqlhHxKFpXgQ3O+nsJho7w0XNW0x9wOcnLHrxx uOaURofFfaRQAQR/5W56KovZnoCWuT196tSJP0lYQyKHH91CPh0ZHYr5uW8rzqs0R4c1 j4Cei8f5djSxZwOOI0QHWNnj8rd03kWW5HbgoizvZv7UP3cc393Qw4OnzugSNI3a3I01 n0lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=vCCUw2CxAe2y8Kfcn48bNy36wThGo4l42/YN8H+hBv8=; b=F1WPuSv4+Ma0kC8AvnRQf1tbMlNS3PSBCPCorzmSkaN2I4Dpx8xwdlVN2LhuqWOSmm N9HSRO1x9o0Gg/uokBPTQgAlWJHTwKNGyB7rimum5BhEfmZekJBMdn+6lswiMmCGlNdn 4jlA1ykZ0CKBIHvFP5W5FPwzvtlK2kKpVk+ALh/jJlNEH0VGlgsZ6E146QiZBTwyX9+O KK/cNNCLgwvfqlSD1LRlblw66Bjyyn3T6fVgR79i5gJd313bKs3lEZytyenxaN7gQ8Ya h3SkM11hfJ6baH2bxdRSIWEtiedfRIW88iP1/vMVYXko+CpZsfLYJSSZPoc8rZJqwaZz ifLw== 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 t15-v6si10185046pgs.647.2018.06.29.23.32.02; Fri, 29 Jun 2018 23:32:16 -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 S1754028AbeF3GYc (ORCPT + 99 others); Sat, 30 Jun 2018 02:24:32 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:34096 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752839AbeF3GY3 (ORCPT ); Sat, 30 Jun 2018 02:24:29 -0400 Received: from p4fea482e.dip0.t-ipconnect.de ([79.234.72.46] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fZ9Id-0005KM-PM; Sat, 30 Jun 2018 08:23:59 +0200 Date: Sat, 30 Jun 2018 08:23:59 +0200 (CEST) From: Thomas Gleixner To: Fenghua Yu cc: Dave Hansen , Ingo Molnar , H Peter Anvin , Ashok Raj , Alan Cox , Peter Zijlstra , Rafael Wysocki , Tony Luck , Ravi V Shankar , linux-kernel , x86 Subject: Re: [PATCH v2 2/4] x86/split_lock: Align x86_capability to unsigned long to avoid split locked access In-Reply-To: <20180630001411.GD68178@romley-ivt3.sc.intel.com> Message-ID: References: <1530282807-66555-1-git-send-email-fenghua.yu@intel.com> <1530282807-66555-3-git-send-email-fenghua.yu@intel.com> <20180629190346.GO18979@romley-ivt3.sc.intel.com> <20180629203844.GA68178@romley-ivt3.sc.intel.com> <8fdfb671-f223-163b-12cd-3c97d94f91b4@intel.com> <20180630000051.GC68178@romley-ivt3.sc.intel.com> <20180630001411.GD68178@romley-ivt3.sc.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Jun 2018, Fenghua Yu wrote: > On Fri, Jun 29, 2018 at 05:00:51PM -0700, Fenghua Yu wrote: > diff --git a/arch/x86/boot/cpuflags.h b/arch/x86/boot/cpuflags.h > index 2e20814d3ce3..29de0ff74351 100644 > --- a/arch/x86/boot/cpuflags.h > +++ b/arch/x86/boot/cpuflags.h > @@ -9,7 +9,7 @@ struct cpu_features { > int level; /* Family, or 64 for x86-64 */ > int family; /* Family, always */ > int model; > - u32 flags[NCAPINTS]; > + u32 flags[NCAPINTS] __aligned(sizeof(unsigned long)); Lacks a comment WHY this needs the aligned() as Dave already said. > }; > > extern struct cpu_features cpu; > diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h > index 8c7b3e5a2d01..444a2275c1f8 100644 > --- a/arch/x86/include/asm/mce.h > +++ b/arch/x86/include/asm/mce.h > @@ -133,7 +133,7 @@ struct mce_log_buffer { > char signature[12]; /* "MACHINECHECK" */ > unsigned len; /* = MCE_LOG_LEN */ > unsigned next; > - unsigned flags; > + unsigned flags __aligned(sizeof(unsigned long)); And whats wrong with just making that flags field unsigned long and move it behind recordlen? flags is at offset 20 so forcing alignement puts it at offset 24 creating a 4 byte hole. While reordering it and making it type unsigned long just fills the already existing hole and just works w/o the stray aligned() struct mce_log_buffer { char signature[12]; /* 0 12 */ unsigned int len; /* 12 4 */ unsigned int next; /* 16 4 */ unsigned int flags; /* 20 4 */ unsigned int recordlen; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ struct mce entry[32]; /* 32 3840 */ The point is, that there is no requirement that flags is unsigned int, while the u32 type for the capability array has a reason. So you need to analyse first whether the data type is required or can be changed to unsigned long which is the right thing to do. See? Thanks, tglx