Subject: Re: Busspace sanity ...
To: None <grefen@hprc.tandem.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-i386
Date: 06/09/1998 10:49:02
On Tue, 09 Jun 1998 16:27:08 +0200 
 Stefan Grefen <grefen@hprc.tandem.com> wrote:

 > My serial console showed me that there is a new check in 
 > bus_space_write_XXX to catch unaligned busspace accesses.
 > If this happens in the ethernet driver of a diskless machine, this 
 > gets your attention :-))

That was the point :-)

 > I think it is a little to aggressive.
 > Forcing alignment to access-size may help getting more drivers real MI it
 > is annoying for people that check already for propper alignment for
 > the actual architecture.

I don't think so, because those checks are enabled w/ DEBUG, which is
"more expensive kernel consistency checks, and possibly noisy output".

The truth of the matter is that drivers that do unaligned access are
broken, even on platforms which do not require strict alignment.  Those
drivers should be fixed.

 > Eg. a check with ALIGNED_POINTER(p,unit) should be sufficient to avoid
 > the reminder from bus_space_XXXX.

Exactly... the reminder from bus_space_*() is designed to point out
drivers which DO NOT do alignment fixups!  Once the drivers are fixed,
the messages go away.

 > There could be an option like BUSSPACE_DEBUG_ALIGNMENT with 
 > stricter rules for MI-testing, but for the normal kernel (with DEBUG)
 > the __BUS_SPACE_ALIGNED_ADDRESS macro should be equal to ALIGNED_POINTER.

No...  that is not what the checks were designed to do.  The checks are
specifically designed to enfore _MI_ alignment requirements, as documented
in the bus_space(9) manual page.

Can you collect the messages and submit a bug report against the device
driver in question?  Then it will get fixed, and you won't have to see
the messages anymore :-)

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 428 6939