Re: memory barriers and dma_sync_single_for_*
From: Alan Cox
Date: Sun Jul 09 2006 - 11:26:57 EST
Ar Sul, 2006-07-09 am 16:53 +0200, ysgrifennodd Stefan Richter:
> My question: Do I need wmb() within the following code?
>
> dma_sync_single_for_cpu(..., DMA_TO_DEVICE);
> area->a = new_val_a;
> wmb(); /* necessary? */
> area->b = new_val_b;
Yes. Otherwise on some processors the I/O may be re-ordered
> dma_sync_single_for_device(..., DMA_TO_DEVICE);
>
> Or are all changes to the area hidden from the device between
> dma_sync_single_for_cpu and _for_device, thereby making the write order
> a non-issue? Thanks,
Depends on the processor and setup. On x86-32 for example dma_sync_.. is
generally a NOP. In other environments nothing will be visible until the
sync.
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/