public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Gordon Farquharson <gordonfarquharson@gmail.com>,
	linux-kernel@vger.kernel.org, linville@tuxdriver.com,
	stefano.brivio@polimi.it
Subject: Re: [RFC] [PATCH] Fix b43 driver build for arm
Date: Tue, 19 Feb 2008 00:04:47 +0100	[thread overview]
Message-ID: <200802190004.47594.mb@bu3sch.de> (raw)
In-Reply-To: <20080218225354.GE23181@flint.arm.linux.org.uk>

On Monday 18 February 2008 23:53:54 Russell King wrote:
> I get extremely pissed off everytime I have to try to explain random
> alignment issues to people.  "It doesn't work like i386 so it must be
> broken" is a rediculous position to take.

I did _not_ ask for a general description of alignment. I did
_just_ ask why ARM is special and why the compiler didn't handle
it there. I do develop code for MIPS, so I do know what alignment is about.

> > Can you _please_ explain what makes ARM so special here?
> 
> No because I don't really know.
> 
> > Why can't we have an array of this structure on ARM?
> > 
> > struct ssb_device_id {
> >        __u16   vendor;
> 
> 2 bytes
> 
> >        __u16   coreid;
> 
> 2 bytes
> 
> >        __u8    revision;
> 
> 1 byte
> 
> > };
> 
> and therefore sizeof this structure will be 5 bytes, but because of the
> ABI rules (which are _explicitly_ allowed by the C standard), it'll
> become 8 bytes due to padding afterwards.

So that would be fine. I don't see what would be unaligned then.
Even if it would pad only one byte after the "revision" it would all
be aligned in a natural way.

> At a _guess_ and its only a guess, the linker will enforce this rule
> between compilation units, otherwise the implications are disgusting
> (would probably result in all loads having to be individual byte loads
> and instructions to combine the result - since ARM has strict alignment
> requirements.)

Yeah. As I said. The code does work on MIPS, which has strict alignment
requirements as well.

> What I can say is that the ABI will not be changed because someone in the
> kernel decides they don't like it.  So the options are: either fix it so
> it works, or accept that the code is broken and will never work on ARM.

I did never ask to change some ABI, sorry.
Still I can't see why this structure will cause alignment issues, as the
compiler will pad it up to the right boundary automagically, as you said
above. Why doesn't the ARM compiler do this?

-- 
Greetings Michael.

  parent reply	other threads:[~2008-02-18 23:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 22:03 [RFC] [PATCH] Fix b43 driver build for arm Gordon Farquharson
2008-02-18 22:08 ` Michael Buesch
2008-02-18 22:13   ` Russell King
2008-02-18 22:24     ` Michael Buesch
2008-02-18 22:34       ` Russell King
2008-02-18 22:43         ` Michael Buesch
2008-02-18 22:50           ` Harvey Harrison
2008-02-18 22:56             ` Michael Buesch
2008-02-18 22:53           ` Russell King
2008-02-18 23:00             ` Russell King
2008-02-18 23:17               ` Michael Buesch
2008-02-18 23:42                 ` Sam Ravnborg
2008-02-19  0:01                   ` Michael Buesch
2008-02-19  4:59                     ` Gordon Farquharson
2008-02-19 10:41                       ` Michael Buesch
2008-02-20  0:44                         ` Gordon Farquharson
2008-02-20 14:44                           ` Michael Buesch
2008-02-20 19:37                             ` Sam Ravnborg
2008-02-22  4:24                               ` Gordon Farquharson
2008-02-22 12:08                                 ` Gordon Farquharson
2008-02-22 14:07                                 ` Michael Buesch
2008-02-23  4:34                                   ` Gordon Farquharson
2008-02-23  5:51                                     ` Michael Buesch
2008-02-23 10:14                                       ` Gordon Farquharson
2008-02-23 15:58                                         ` Michael Buesch
2008-02-26 14:37                               ` Ben Dooks
2008-02-26 16:12                                 ` Gordon Farquharson
2008-02-19  5:32                     ` Sam Ravnborg
2008-02-22 13:13                       ` Matthieu CASTET
2008-02-18 23:04             ` Michael Buesch [this message]
2008-02-19  8:37               ` Geert Uytterhoeven
2008-02-19 10:34                 ` Michael Buesch

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=200802190004.47594.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=gordonfarquharson@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=stefano.brivio@polimi.it \
    /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