public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: swarren@nvidia.com, linux-kernel@vger.kernel.org,
	haojian.zhuang@gmail.com, linux-arm-kernel@lists.infradead.org,
	jic23@cam.ac.uk, kay@vrfy.org
Subject: Re: Follow-up to remaining issue with alignment of __log_buf in printk.c
Date: Thu, 14 Jun 2012 13:29:56 -0600	[thread overview]
Message-ID: <4FDA3BB4.9040607@wwwdotorg.org> (raw)
In-Reply-To: <87aa05vgzg.fsf@free.fr>

On 06/14/2012 01:19 PM, Robert Jarzmik wrote:
> 
> Hi Stephen and others,
> 
> I have a XScale PXA based board with has the alignement issue which makes the
> kernel trap during its early stage.
> 
> I wonder what is the status now, is there a fix available ?
> 
> I have tracked what happens on PXA. The pxa is an ARM v5TE chip. The new printk
> version you submitted is translated to the following assembly on the line :
>         msg->ts_nsec = local_clock();
> Into:
> => 0xc001bbe0 <log_store+496>:	strd	r0, [r4, r5]
> 
> In ARMv5, the "strd" assembly opcode expects the address to be 64bits aligned,
> hence the bug.
> 
> Now the solutions I have seen so far in the mailing lists :
>  - #define LOG_ALIGN (__alignof__(u64))
>    Does always work.
>  - #define LOG_ALIGN (__alignof__(struct log))
>    Doesn't work with my toolchain, as __alignof__(struct log) is 4, not 8

Isn't that a bug in the toolchain; isn't the alignment of a struct
required to be the greatest alignment of any of its members? Otherwise,
this problem could arise with any usage of that struct.

I suppose this could be worked around with something like:

#define LOG_ALIGN max(__alignof__(struct log), __alignof__(u64))

  reply	other threads:[~2012-06-14 19:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 19:19 Follow-up to remaining issue with alignment of __log_buf in printk.c Robert Jarzmik
2012-06-14 19:29 ` Stephen Warren [this message]
2012-06-14 22:22   ` Robert Jarzmik
2012-06-15  0:27     ` Andrew Lunn
  -- strict thread matches above, loose matches on Subject: below --
2012-06-14 19:49 Andrew Lunn

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=4FDA3BB4.9040607@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=jic23@cam.ac.uk \
    --cc=kay@vrfy.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.jarzmik@free.fr \
    --cc=swarren@nvidia.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