netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: David Miller <davem@davemloft.net>,
	tony.luck@intel.com, netdev@vger.kernel.org
Subject: Re: Seeing new kernel unaligned access messages in linux-next on ia64
Date: Wed, 24 Mar 2010 23:47:24 +0100	[thread overview]
Message-ID: <m2vdcl5ocj.fsf@igel.home> (raw)
In-Reply-To: <alpine.LSU.2.01.1003242059230.4028@obet.zrqbmnf.qr> (Jan Engelhardt's message of "Wed, 24 Mar 2010 22:26:24 +0100 (CET)")

Jan Engelhardt <jengelh@medozas.de> writes:

> Using a temporary and memcpying it off would normally fix this,
> as in the patch below. During testing however, I still get
> unaligned messages even with the patch - and I would not know
> what causes this.

The memcpy will not fix the alignment issue because the copy operation
is fully equivalent to a direct assignment, and the compiler can still
take advantage of the known alignment of the types.  You have to
explicitly tell the compiler about the reduced alignment guarantee.

> In fact, adding a printks magically fixes it. (Bug in gcc-4.4-sparc
> compiler?)
>
>  	memcpy(v, &a, sizeof(a));
> +       printk(KERN_INFO "v=%p a=%p\n", v, &a);

Presumably the extended lifetime of the variables caused the compiler to
use a different expansion for memcpy which is less dependent on
alignment.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2010-03-24 22:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12c511ca1003181112t6098eeafm30e384e755a42185@mail.gmail.com>
     [not found] ` <alpine.LSU.2.01.1003192310450.10055@obet.zrqbmnf.qr>
     [not found]   ` <20100324.102759.107122703.davem@davemloft.net>
2010-03-24 21:26     ` Seeing new kernel unaligned access messages in linux-next on ia64 Jan Engelhardt
2010-03-24 22:47       ` Andreas Schwab [this message]
2010-03-24 23:17         ` Jan Engelhardt
2010-03-24 23:19           ` Luck, Tony
2010-03-25  3:32             ` David Miller
2010-03-25  3:32           ` David Miller
2010-03-27 12:14             ` Jan Engelhardt
2010-03-27 23:37               ` David Miller
2010-03-28  0:11                 ` Jan Engelhardt
2010-03-28  0:17                   ` David Miller

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=m2vdcl5ocj.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=davem@davemloft.net \
    --cc=jengelh@medozas.de \
    --cc=netdev@vger.kernel.org \
    --cc=tony.luck@intel.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).