Re: I/O write ordering

Benjamin Herrenschmidt
2004-09-23T03:44:08Z

On Thu, 2004-09-23 at 13:01, James Bottomley wrote:

> The ownership model for consistent memory solves this.
>
> Think of it this way: writes to consistent memory are normal memory
> writes (they don't trigger actions in the device), it's the writes to
> the device space that trigger actions. All you want to ensure is that
> all the consistent memory writes are issued before the device is
> triggered into action.
>
> So, in the ownership model you transfer the ownership of the consistent
> memory area to the device (which would be the heavyweight barrier on
> ppc) then write to the device space to trigger it.
>
> synchronisation of consistent memory accesses can be done via normal
> spin locks; synchronisation of device space needs the the iomb() to
> prevent reordering leaks around the spinlock.

Sounds good, though may be a bit tricky to deal with for things where
both the kernel and the device are fiddling at the same time, like
the USB OHCI shared area, or ethernet descriptors... But it makes
sense. Could probably be built on top of the dma_consistent_sync... &
friends actually if driver used the properly (which they don't as
nobody really understand their semantics).

Ben.