Subject: Re: testing bus barriers
To: David Young <dyoung@pobox.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 02/09/2004 11:05:24
David Young <dyoung@pobox.com> writes:
> As long as we have to change to explicit barriers globally, I don't see
> NetBSD getting it done. Would it be possible or useful to switch off
> the implicit bus barriers on a per-driver basis?
This has bothered me as well.
For those architectures that implement bus_space operations by way of
a table of function pointers, it seems like it would be reasonably
straightforward for each bus_space_tag_t to have a parallel
no-implicit-barriers version whose function pointers pointed to
non-barrier versions. Perhaps something like:
bus_space_tag_t bus_space_remove_barriers(bus_space_tag_t space);
which returns a no-barrier space for the given tag if any exist. It
should probably return the passed-in space otherwise, either when a
no-barrier version hasn't been implemented or the hardware has
implicit strong memory ordering.
I haven't surveyed the state of bus_space implementations lately; for
those that are defined just by macros, it seems like a #define
BUS_SPACE_NO_IMPLICIT_BARRIERS would do the trick. A driver that is
sure about its proper use of barriers can both define the symbol and
call the function to ensure that it is only getting explicit barriers
on all platforms.
- Nathan