linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: David Laight <David.Laight@ACULAB.COM>,
	'Mark Rutland' <mark.rutland@arm.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"greg@kroah.com" <greg@kroah.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>
Subject: Re: [PATCH v3] devres: Explicitly align datai[] to 64-bit
Date: Mon, 9 Jul 2018 13:28:08 -0700	[thread overview]
Message-ID: <dda3e81c-cd16-5ebd-8c88-3fddd03108c4@synopsys.com> (raw)
In-Reply-To: <b42f7223e0e54a5589f75fc21039f348@AcuMS.aculab.com>

On 07/09/2018 09:10 AM, David Laight wrote:
> From: Mark Rutland
>> Sent: 09 July 2018 16:49
>>
>> On Mon, Jul 09, 2018 at 05:45:21PM +0200, Peter Zijlstra wrote:
>>> On Mon, Jul 09, 2018 at 05:34:27PM +0200, Peter Zijlstra wrote:
>>>> On Mon, Jul 09, 2018 at 04:29:58PM +0100, Mark Rutland wrote:
>>>>> Shouldn't that be 8? AFAICT, __alignof__(unsigned long long) is 8 on
>>>>> x86_32:
>>>>
>>>> Curious, I wonder why we put that align in atomic64_32 then.
>>>
>>> Shiny, look at this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54188
>>>
>>
>> Ouch.
> 
> Indeed.
> 
> changing the definition to:
> struct ull {
>         unsigned long long v __attribute__((aligned(__alignof__(long long))));
> };
> 
> prints 8 for the structure alignment.

So this will help force alignment of outer structures triggered by inner members,
but only for globals and perhaps those on stack. I'm not sure how this helps
aligning such  a struct allocated dynamically - we are not passing this extra
alignment info the the allocator API here. Surely the size will increase and we
end up with extra padding in the end as intended originally and pointed to by
Mark, but how does it help with alignment ? What am I missing ?

> 
> Time to audit uses of __alignof__().
> 
> #define actual_alignof(type) __alignof__(struct { type jsdjdhjdjh; })

  parent reply	other threads:[~2018-07-09 20:28 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 13:45 [PATCH v3] devres: Explicitly align datai[] to 64-bit Alexey Brodkin
2018-07-09 13:45 ` Alexey Brodkin
2018-07-09 13:54 ` Peter Zijlstra
2018-07-09 13:54   ` Peter Zijlstra
2018-07-09 14:04   ` Mark Rutland
2018-07-09 14:04     ` Mark Rutland
2018-07-09 14:10     ` Geert Uytterhoeven
2018-07-09 14:10       ` Geert Uytterhoeven
2018-07-09 14:07   ` Alexey Brodkin
2018-07-09 14:07     ` Alexey Brodkin
2018-07-09 14:07 ` Peter Zijlstra
2018-07-09 14:07   ` Peter Zijlstra
2018-07-09 14:10   ` Peter Zijlstra
2018-07-09 14:10     ` Peter Zijlstra
2018-07-09 14:33     ` Alexey Brodkin
2018-07-09 14:33       ` Alexey Brodkin
2018-07-09 14:49       ` Peter Zijlstra
2018-07-09 14:49         ` Peter Zijlstra
2018-07-09 14:53         ` Alexey Brodkin
2018-07-09 14:53           ` Alexey Brodkin
2018-10-04 16:19           ` Alexey Brodkin
2018-10-04 16:19             ` Alexey Brodkin
2018-07-09 15:02         ` David Laight
2018-07-09 15:02           ` David Laight
2018-07-09 15:14           ` Peter Zijlstra
2018-07-09 15:14             ` Peter Zijlstra
2018-07-09 15:29         ` Mark Rutland
2018-07-09 15:29           ` Mark Rutland
2018-07-09 15:34           ` Peter Zijlstra
2018-07-09 15:34             ` Peter Zijlstra
2018-07-09 15:45             ` Peter Zijlstra
2018-07-09 15:45               ` Peter Zijlstra
2018-07-09 15:48               ` Mark Rutland
2018-07-09 15:48                 ` Mark Rutland
2018-07-09 16:10                 ` David Laight
2018-07-09 16:10                   ` David Laight
2018-07-09 20:28                   ` Vineet Gupta [this message]
2018-07-09 20:28                     ` Vineet Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dda3e81c-cd16-5ebd-8c88-3fddd03108c4@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=geert@linux-m68k.org \
    --cc=greg@kroah.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).