Search Linux Wireless

Re: Linux 2.6.24-rc7

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

 




On Fri, 25 Jan 2008, Johannes Berg wrote:
> 
> Since the only problematic driver is Intel's, they really should be able
> to get their act together for .25 and fix their firmware, if not then
> we'll have to think of something else like making their drivers
> memmove() the packets to the right place.

Well, there *is* a really simple solution:

 - realize that x86 (along with some few other architectures) is sane, and 
   not a crapola architecture that cannot do unaligneds well.

The thing is, not handling unaligned data well (and by "well", I don't 
mean just "without a trap", but "fast") is a problem for _other_ 
architectures, not x86. And quite frankly, x86 is not only the bulk of the 
machines out there, in this area it's also the one that did the right 
thing.

[ Lots of people think that x86 is ugly. The fact is, x86 is a paragon of 
  cleanliness when it comes to all the details that matter. When it comes 
  to ugly, the *really* ugly things is not in some complex ISA decoding, 
  but in all the horrible crap other architectures forces software to do 
  unnecessarily, when hardware can do it so much better! ]

So I would actually suggest that the wireless people realize that 
unaligned accesses aren't necessarily bad, and if there is code that needs 
alignment, maybe it's the *crap* architectures that should pay the price, 
not the good ones?

So I would suggest replacing that WARN_ON_ONCE() (which is gone now, but 
never mind, it marks the spot) with one of:

 - mark the header data structure unaligned, so that gcc will 
   automatically generate the extra instructions to do the accesses 
   automatically.

 - .. or, if there are just a few ones that actually matter, use 
   "get_unaligned()" in those places

 - .. or just make the WARN_ON_ONCE() be dependent on the broken 
   architecture in the first place.

 - .. or, finally, do something that penalizes crap and does

	#ifdef CONFIG_ARCH_NEEDS_ALIGNED
	  #define STRICT_ARCH_MINIMUM_ALIGNMENT alignof(..)
	#else
	  #define STRICT_ARCH_MINIMUM_ALIGNMENT 1
	#endif

	...
	unsigned long unalign;
	..
	unaligned = (unsigned long) ptr & (STRICT_ARCH_MINIMUM_ALIGNMENT-1);
	if (unaligned) {
		void *newptr = ptr;
		WARN_ON_ONCE(1);
		/* This assumes we have padding */
		newptr += STRICT_ARCH_MINIMUM_ALIGNMENT - unaligned;
		memmove(newptr, ptr, size);
	}
	..

because the thing is, we should give Intel credit for doing the right 
thing (in the CPU), rather than complain about the fact that they don't 
care about insane architectures that do the wrong thing and can't even 
work with the wireless driver in the first place!

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

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux