Re: [patch] x86_*fence replaced by membar_ops(3)

On Thu, Jan 15, 2009 at 09:00:18AM +0000, Andrew Doran wrote:
> On Wed, Jan 14, 2009 at 07:55:09PM +0100, Jean-Yves Migeon wrote:
>
> > These are the first steps to have MI Xen drivers (hi christoph!), by
> > replacing all the x86_*fence memory ops to their "equivalent" ones from
> > the membar_ops(3) API. See [1].
>
> The x86 fence functions and generic memory barrier operations are not
> equivalent.
>
> membar_foo() are for memory barriers in a multiprocessor system.
>
> The fence functions are used for memory barriers in respect of DMA even on a
> uniprocessor system, or in a system like Xen where the NetBSD kernel is
> uniprocessor but the monitor can be on a different CPU.
right. And we don't have a MI equivalent for the x86 fence functions.
I'm not sure one is needed, because MI code is supposed to use the
bus_space and bus_dma functions, which includes appropriate memory
barrier. Xen is special; using bus_dma here would be overkill and wouldn't
really fix the problem (we'd need to write MD bus_dma backends for the
xenbus "hardware"). The best thing to do, if we want to support non-x86
systems in Xen, is to define xen_fence functions in xen MD headers.
--
Manuel Bouyer, LIP6, Universite Paris VI.
Manuel.Bouyer%lip6.fr@localhost
NetBSD: 26 ans d'experience feront toujours la difference
--