Re: + kernel-add-common-infrastructure-for-unaligned-access.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-04-15 at 17:12 +0100, David Woodhouse wrote:
> On Tue, 2008-04-15 at 08:07 -0700, Harvey Harrison wrote:
> > The reason I kept the byte-shifting versions around was that for
> > arches that need special handling of unaligned access,
> 
> Are there any? GCC should emit appropriate code for the packed-structure
> version on all architectures, shouldn't it?
> 
> > they could do the byteshifting manually and get the unaligned access
> > 'for free' as it were. 
> 
> GCC really ought to be able to sort that out for itself. Let the dog see
> the rabbit.

Sorry, I didn't explain that very well, let me try again.  There is also
some new API along with this patch, for a reason:

This type of pattern, repeat for various byteorder/widths:
le32_to_cpu(get_unaligned((__le32 *)p))

For which the following has been added:
get_unaligned_le32(p)

Which allows BE arches that require special alignment handling to do
the endianness swapping as they do the unaligned accesses.  Similarly
for LE arches and the get_unaligned_be*

I realy think gcc will have a hard time seeing that it can fold the
accesses in this way.  If you grep for get/put_unaligned you'll
see the majority of the current users actually are wrapping it in
some kind of byteorder access as well...which prompted me to add
this api.

But _if_ gcc is smart enough to fold that together on arches with
special alignment requirements, I'm happy to move to a wrapper
approach.

HPA made the suggestion to look into this method, maybe he can 
explain it better than I.

Anyways, I hope I made myself a little clearer this time.

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux