All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Sparc memcpy question
@ 2011-07-28 13:08 Julian Calaby
  2011-07-28 13:23 ` David Miller
  2011-07-31  8:23 ` Roland Vossen
  0 siblings, 2 replies; 3+ messages in thread
From: Julian Calaby @ 2011-07-28 13:08 UTC (permalink / raw)
  To: sparclinux

Hi Roland,

First things first, you're asking the wrong person. =)

This sounds like a sparc specific question, so it should really be
addressed to the sparclinux mailing list as that's where the sparc
people hang out. I've CC'd that list in this mail.

On Thu, Jul 28, 2011 at 20:40, Roland Vossen <rvossen@broadcom.com> wrote:
> Hello Julian,
>
> I am testing our brcm80211 driver on a sparc64 machine. When executing a
> memcpy, I encountered an exception:
>
> memcpy(fffff8001cf3f46c, fffff8001cf3f57e, 4); results in:
>
> Kernel unaligned access at TPC[10489624] brcms_c_ioctl+0x64/0x740 [brcmsmac]
>
> I was under the impression that there are no alignment requirements for the
> pointers to memcpy, but perhaps I am wrong.

There are, they just happen to be small enough that you haven't noticed.

As far as I know, every architecture has some alignment requirements.
Sparc's are the most onerous. I don't know the full details, but I
believe that it needs to be aligned to the size of any reads. (so
reading an int - 4 bytes => 4 byte alignment on the addresses)

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sparc memcpy question
  2011-07-28 13:08 Sparc memcpy question Julian Calaby
@ 2011-07-28 13:23 ` David Miller
  2011-07-31  8:23 ` Roland Vossen
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-07-28 13:23 UTC (permalink / raw)
  To: sparclinux

From: Julian Calaby <julian.calaby@gmail.com>
Date: Thu, 28 Jul 2011 23:08:02 +1000

> On Thu, Jul 28, 2011 at 20:40, Roland Vossen <rvossen@broadcom.com> wrote:
>> I am testing our brcm80211 driver on a sparc64 machine. When executing a
>> memcpy, I encountered an exception:
>>
>> memcpy(fffff8001cf3f46c, fffff8001cf3f57e, 4); results in:
>>
>> Kernel unaligned access at TPC[10489624] brcms_c_ioctl+0x64/0x740 [brcmsmac]
>>
>> I was under the impression that there are no alignment requirements for the
>> pointers to memcpy, but perhaps I am wrong.
> 
> There are, they just happen to be small enough that you haven't noticed.
> 
> As far as I know, every architecture has some alignment requirements.
> Sparc's are the most onerous. I don't know the full details, but I
> believe that it needs to be aligned to the size of any reads. (so
> reading an int - 4 bytes => 4 byte alignment on the addresses)

GCC is inlineing the memcpy, and when doing so it can legally use load
and store instructions based upon the alignment of the types passed
into the memcpy() call.

memcpy() is defined such that compilers are allowed to optimize the
call based upon the typing information of the pointers passed into
the call.  That is exactly what it is doing here.

What the brcm80211 driver is doing needs to be fixed.  It needs
to align objects to their correct alignment.

This is not a Sparc problem, please therefore take it up with the
driver maintainer.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sparc memcpy question
  2011-07-28 13:08 Sparc memcpy question Julian Calaby
  2011-07-28 13:23 ` David Miller
@ 2011-07-31  8:23 ` Roland Vossen
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Vossen @ 2011-07-31  8:23 UTC (permalink / raw)
  To: sparclinux


> This is not a Sparc problem, please therefore take it up with the
> driver maintainer.

All clear to me. Thanks guys. Btw, one of the (brcm80211) driver 
maintainers would be me :-)

Thanks, Roland.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-31  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 13:08 Sparc memcpy question Julian Calaby
2011-07-28 13:23 ` David Miller
2011-07-31  8:23 ` Roland Vossen

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.