All of lore.kernel.org
 help / color / mirror / Atom feed
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: arm: Remaining issue with alignment of __log_buf in printk.c
Date: Sun, 27 May 2012 10:03:20 -0600	[thread overview]
Message-ID: <4FC25048.109@wwwdotorg.org> (raw)
In-Reply-To: <4FC22098.3070803@kernel.org>

On 05/27/2012 06:39 AM, Jonathan Cameron wrote:
> Hi All,
> 
> My stargate 2 board refused to start and after bisection I ended
> up at the same patch that Stephen found an alignment issue in.
> Unfortunately Stephen's patch doesn't seem to have fixed the
> issue for me.
> https://lkml.org/lkml/2012/5/10/510 is the thread.  Patch from
> Stephen is : f8450fca6ecdea38b5a882fdf6cd097e3ec8651c
> 
> Increasing the alignement for 32 bit systems to 8 seems to do the
> job but I can't immediately think why...
> 
> System is a pxa27x strong arm.

The first element in the structure type that's actually stored in the
__log_buf array is a u64; see struct log in kernel/printk.c. Depending
on alignment rules, a u64 and a struct containing it might require a
4-byte or 8-byte alignment. The following link implies this might have
changed over time:

http://wiki.debian.org/ArmEabiPort#Struct_packing_and_alignment

(see "64-bit data type alignment" a little below that anchor). I'm not
sure what ABI the kernel expects to use internally, or your compiler;
perhaps you need the new EABI 8-byte alignment requirement for a u64 and
hence the struct as a whole, but Tegra (or my toolchain?) is OK with the
older 4-byte alignment for a u64 or struct?

Further, I'm not sure if the following alignment selection logic:

> #if !defined(CONFIG_64BIT) || defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
> #define LOG_ALIGN 4
> #else
> #define LOG_ALIGN 8
> #endif

... uses the CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS for its intended
purpose?

Russell, can you please comment here. Thanks.

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@wwwdotorg.org>
To: Jonathan Cameron <jic23@kernel.org>, Russell King <rmk@arm.linux.org.uk>
Cc: kay.sievers@vrfy.org, LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: arm: Remaining issue with alignment of __log_buf in printk.c
Date: Sun, 27 May 2012 10:03:20 -0600	[thread overview]
Message-ID: <4FC25048.109@wwwdotorg.org> (raw)
In-Reply-To: <4FC22098.3070803@kernel.org>

On 05/27/2012 06:39 AM, Jonathan Cameron wrote:
> Hi All,
> 
> My stargate 2 board refused to start and after bisection I ended
> up at the same patch that Stephen found an alignment issue in.
> Unfortunately Stephen's patch doesn't seem to have fixed the
> issue for me.
> https://lkml.org/lkml/2012/5/10/510 is the thread.  Patch from
> Stephen is : f8450fca6ecdea38b5a882fdf6cd097e3ec8651c
> 
> Increasing the alignement for 32 bit systems to 8 seems to do the
> job but I can't immediately think why...
> 
> System is a pxa27x strong arm.

The first element in the structure type that's actually stored in the
__log_buf array is a u64; see struct log in kernel/printk.c. Depending
on alignment rules, a u64 and a struct containing it might require a
4-byte or 8-byte alignment. The following link implies this might have
changed over time:

http://wiki.debian.org/ArmEabiPort#Struct_packing_and_alignment

(see "64-bit data type alignment" a little below that anchor). I'm not
sure what ABI the kernel expects to use internally, or your compiler;
perhaps you need the new EABI 8-byte alignment requirement for a u64 and
hence the struct as a whole, but Tegra (or my toolchain?) is OK with the
older 4-byte alignment for a u64 or struct?

Further, I'm not sure if the following alignment selection logic:

> #if !defined(CONFIG_64BIT) || defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
> #define LOG_ALIGN 4
> #else
> #define LOG_ALIGN 8
> #endif

... uses the CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS for its intended
purpose?

Russell, can you please comment here. Thanks.

  reply	other threads:[~2012-05-27 16:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 12:39 arm: Remaining issue with alignment of __log_buf in printk.c Jonathan Cameron
2012-05-27 12:39 ` Jonathan Cameron
2012-05-27 16:03 ` Stephen Warren [this message]
2012-05-27 16:03   ` Stephen Warren
2012-05-27 16:14   ` Russell King - ARM Linux
2012-05-27 16:14     ` Russell King - ARM Linux
2012-05-27 17:01     ` Jonathan Cameron
2012-05-27 17:01       ` Jonathan Cameron
2012-05-29 16:14   ` Stephen Warren
2012-05-29 16:14     ` Stephen Warren
2012-05-29 16:32     ` Kay Sievers
2012-05-29 16:32       ` Kay Sievers
2012-05-29 17:13       ` Stephen Warren
2012-05-29 17:13         ` Stephen Warren
  -- strict thread matches above, loose matches on Subject: below --
2012-05-27 12:39 Jonathan Cameron
2012-05-27 12:39 ` Jonathan Cameron

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=4FC25048.109@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.