[PATCH] asm-generic: allow generic unaligned access if the arch supports it

Ard Biesheuvel ard.biesheuvel at linaro.org
Mon Mar 31 14:51:54 EDT 2014


On 31 March 2014 20:36, Russell King - ARM Linux <linux at arm.linux.org.uk> wrote:
> On Mon, Mar 31, 2014 at 08:22:43PM +0200, Ard Biesheuvel wrote:
>> On 31 March 2014 19:24, Catalin Marinas <catalin.marinas at arm.com> wrote:
>> > It actually affects arch/arm as well which selects
>> > HAVE_EFFICIENT_UNALIGNED_ACCESS for v6/v7 and uses the generic
>> > unaligned.h
>> >
>>
>> Oops, my bad. I did a quick 'find -name unaligned.h' but misread 'arc'
>> for 'arm'.
>>
>> @Russell: ARM is a user of asm-generic/unaligned.h, and I proposed a
>> patch to asm-generic that switches to unaligned accesses if
>> HAVE_EFFICIENT_UNALIGNED_ACCESS is set by the arch. This should affect
>> a fair amount of code living under net/ and drivers/ that don't test
>> for the Kconfig symbol but expect get_unaligned_xx/put_unaligned_xx to
>> turn into something suitable depending on the arch. Any objections?
>
> I'm not sure what you're talking about here, or what change you're
> proposing.  Without any kind of frame of reference, I can't comment.
> Sorry.
>

My apologies. I assumed the mail thread including a link to the patch
would be clear enough.

Currently, asm-generic's version of unaligned.h (defining stuff like
get_unaligned() and put_unaligned()) unconditionally defaults to the
most cautious method of performing unaligned memory accesses, even if
the Kconfig symbol HAVE_EFFICIENT_UNALIGNED_ACCESS is defined.
However, in that case, it makes sense to use a definition for
get_unaligned()/put_unaligned() that lets the hardware perform the
unaligned accesses instead.

So that is what I proposed here

http://marc.info/?l=linux-arch&m=139594237116121&w=2

and in the mail exchange that followed, I stated that arm64 should be
the only arch affected by this change. However, I didn't look
carefully enough and, as Catalin pointed out, ARM will also be
affected by it.

So that is why I redirected this thread to you: would you object to
changing asm-generic/unaligned.h so that calls to
get_aligned()/put_aligned() on ARM v6/v7 will let the CPU perform the
unaligned access?

Regards,
Ard.



More information about the linux-arm-kernel mailing list