[PATCH 6/6] [POWERPC] make struct property's value a void *
segher at kernel.crashing.org
Fri Apr 6 04:12:20 EST 2007
> On PowerPC misaligned data doesn't generate exceptions, the chip works
> it out transparently.
That's not true. _Most_ chips will in _most_ cases
handle unaligned accesses, unless you have disabled
that. You cannot depend on it working without taking
> On sparc everything is aligned. I know, I've been accessing OFW data
> structures for more than 10 years and I haven't gotten one unaligned
> trap on sparc yet.
It tends to work in practice, sure. Nothing gives you
any guarantee it will, though.
>> So just do an of_decode_int() and its cousins -- platforms
>> that are trying to guarantee alignment, or that can handle
>> unaligned memory accesses, can just define these as direct
>> accesses; everyone else should use the read-by-byte sequences.
> No, that's just stupid. Peppering simple accesses to properties
> with these wrappers is just going to make the code uglier for
> no tangible gain whatsoever.
It would remove the millions of casts (and the need for the GCC
-fstrict-aliasing flag for this code).
> And besides what Stephen is doing is just extending existing
> practice, he isn't changing how any of this stuff is already
> used. So this discussion should not get in the way of his
> patches getting installed.
I agree. However when making this code more generally useful,
it would be good to make it more correct at the same time, since
it will only get harder to do so later on.
More information about the Linuxppc-dev