From: Eric Dumazet <eric.dumazet@gmail.com>
To: Rob Herring <robherring2@gmail.com>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
linux-arm-kernel@lists.infradead.org,
"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
"Jon Masters" <jonathan@jonmasters.org>,
netdev@vger.kernel.org, "Måns Rullgård" <mans@mansr.com>,
"David Laight" <David.Laight@aculab.com>
Subject: Re: alignment faults in 3.6
Date: Thu, 11 Oct 2012 18:15:45 +0200 [thread overview]
Message-ID: <1349972145.21172.9685.camel@edumazet-glaptop> (raw)
In-Reply-To: <5076E472.8030703@gmail.com>
On Thu, 2012-10-11 at 10:23 -0500, Rob Herring wrote:
> On 10/11/2012 08:47 AM, Eric Dumazet wrote:
> > Compiler is asked to perform a 32bit load, it does it.
>
> Not exactly. It is asked to to perform 2 32-bit loads which are combined
> into a single ldm (load multiple) which cannot handle unaligned
> accesses. Here's a simple example that does the same thing:
Thats simply not true. You are severely mistaken.
ldm does a load of seeral 32bit words.
And the compiler would not use it if the alignment was not matching the
prereq (alignment >= 4)
>
> void test(char * buf)
> {
> printf("%d, %d\n", *((unsigned int *)&buf[0]), *((unsigned int *)&buf[4]));
> }
But you completely miss the fact that network doesnt pass a "char *buf"
but a "be32 *buf". Your example is not relevant at all.
So the compiler is absolutely right, and network stack is _right_ too.
The prereq is that IP header are aligned to 4 bytes boundary.
Denying this fact is not going to help you
>
> So I guess the only ABI legal unaligned access is in a packed struct.
>
> > There is no questionable optimization here. Really.
> > Please stop pretending this, this makes no sense.
>
> I'm not the one calling the networking stack bad code.
Once you understand the issues, you can explain us where is the bad
code. But given you say "Bug is in compiler, and/or network stack, but
my driver is fine", its not very wise.
For the moment, the bug is in your driver.
>
> I can fix my h/w, so I'll stop caring about this. Others can all get
> bitten by this new behavior in gcc 4.7.
Again compiler is fine. How should we say that so that you stop your
rants ?
Stop trying to find an excuse, dont try to fool us, this is really
embarrassing. Just fix the driver, there is no shame to fix an error.
next prev parent reply other threads:[~2012-10-11 16:15 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <506E1762.3010601@gmail.com>
[not found] ` <CANLjY-no-L9=LRCvCetC5XCHicOoSWOfRZmUd7itAiUHWBhAyw@mail.gmail.com>
[not found] ` <CAG5Tg6Wuybruc31x1eh6mFafsg=7cOgYLgpZUBuJUo75ap3osQ@mail.gmail.com>
[not found] ` <506E3E58.80703@gmail.com>
[not found] ` <CAG5Tg6V0Vj9HTy3=AU-q+Qa3DuJs6R1Kw+3uOWU_jOGfkgyXzw@mail.gmail.com>
[not found] ` <20121005071216.GD4625@n2100.arm.linux.org.uk>
[not found] ` <CAG5Tg6VciuxJ=k+fatzLugcehF54mGNOLHpUwdMX99oCnAVg8Q@mail.gmail.com>
[not found] ` <20121005082439.GF4625@n2100.arm.linux.org.uk>
[not found] ` <506ED18C.3010009@gmail.com>
[not found] ` <20121005140556.GQ4625@n2100.arm.linux.org.uk>
[not found] ` <506EEFBB.3060705@gmail.com>
[not found] ` <507619FA.6080001@jonmasters.org>
2012-10-11 2:27 ` alignment faults in 3.6 Måns Rullgård
2012-10-11 2:34 ` Jon Masters
2012-10-11 8:21 ` David Laight
2012-10-11 8:53 ` Russell King - ARM Linux
2012-10-11 9:45 ` Måns Rullgård
2012-10-11 10:00 ` Eric Dumazet
2012-10-11 10:20 ` Måns Rullgård
2012-10-11 10:22 ` Eric Dumazet
2012-10-11 10:32 ` Russell King - ARM Linux
2012-10-11 10:49 ` Eric Dumazet
2012-10-11 10:56 ` Maxime Bizon
2012-10-11 11:28 ` Eric Dumazet
2012-10-11 11:47 ` Maxime Bizon
2012-10-11 11:54 ` Eric Dumazet
2012-10-11 12:00 ` Eric Dumazet
2012-10-11 12:51 ` Maxime Bizon
2012-10-11 12:59 ` Eric Dumazet
2012-10-11 12:28 ` Arnd Bergmann
2012-10-11 12:40 ` Eric Dumazet
2012-10-11 13:20 ` Rob Herring
2012-10-11 13:32 ` Måns Rullgård
2012-10-11 13:35 ` Arnd Bergmann
2012-10-11 13:47 ` Eric Dumazet
2012-10-11 15:23 ` Rob Herring
2012-10-11 15:39 ` David Laight
2012-10-11 16:18 ` Måns Rullgård
2012-10-12 8:11 ` Arnd Bergmann
2012-10-12 9:03 ` Russell King - ARM Linux
2012-10-12 10:04 ` Eric Dumazet
2012-10-12 12:24 ` Russell King - ARM Linux
2012-10-12 11:00 ` Måns Rullgård
2012-10-12 11:07 ` Russell King - ARM Linux
2012-10-12 11:18 ` Måns Rullgård
2012-10-12 11:44 ` Russell King - ARM Linux
2012-10-12 12:08 ` Eric Dumazet
2012-10-12 14:22 ` Benjamin LaHaise
2012-10-12 14:36 ` David Laight
2012-10-12 14:48 ` Eric Dumazet
2012-10-12 15:00 ` Benjamin LaHaise
2012-10-12 15:04 ` Ben Hutchings
2012-10-12 15:47 ` David Laight
2012-10-12 16:13 ` Ben Hutchings
2012-10-12 12:16 ` Måns Rullgård
2012-10-12 11:19 ` Russell King - ARM Linux
2012-10-11 16:15 ` Eric Dumazet [this message]
2012-10-11 16:59 ` Catalin Marinas
2012-10-11 10:16 ` David Laight
2012-10-11 10:46 ` Måns Rullgård
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=1349972145.21172.9685.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=David.Laight@aculab.com \
--cc=arnd@arndb.de \
--cc=jonathan@jonmasters.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=mans@mansr.com \
--cc=netdev@vger.kernel.org \
--cc=robherring2@gmail.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