tech-kern archive

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

Re: Why NetBSD x86's bus_space_barrier does not use [sml]fence?



On Fri, Nov 29, 2019 at 10:39:09PM +0900, Shoichi Yamaguchi wrote:

> FreeBSD and OpenBSD use memory fences(mfence, sfence, lfence) to
> implement bus_space_barrier().
> On the other hand, NetBSD does not use them.
> 
> Do you know the background about current implementation?
> 
> I found an issue caused by this implementation difference while porting
> ixl(4).

Are you using BUS_SPACE_MAP_PREFETCHABLE?

If yes, I think there might be the possibility of reordering.  There should
probably be a fence.

It no, the CALL instruction that calls bus_space_barrier() produces a write
to the stack when storing the return address.  On x86, stores are totally
ordered, and loads are never reordered around stores.  No further barrier
is needed.  This is the idea anyway, sometimes reality does not match..

Andrew


Home | Main Index | Thread Index | Old Index