On 2019-05-23 12:37 a.m., Grant Grundler wrote: > > If you can try some experiments, start adding mb() calls after the > > driver adds or removes an IO request from any list or queue. > That's an interesting comment. > > > I was also being very lazy and imprecise. :) > > More specifically, I was thinking the mb() should be placed AFTER adding any IOs to data structure in memory the device will read but BEFORE > the driver tells the device more IO requests. I didn't look if such sequences even exist in the drivers mentioned. If the devices use "mail > boxes", completely different issues around ordering can come up. > > On a UP kernel, mb() is currently just a compiler > memory barrier. On a SMP kernel, mb() generates a "sync" instruction. We also > use "ldcw" as a barrier in spinlocks. > > > Yeah, I'm not sure how strong the mb() needs to be and maybe I'm giving the wrong advice: use dma_wmb() for the case I've described above. > Then use dma_rmb() before reading data structures updated by the device. See examples in the existing code: > https://elixir.bootlin.com/linux/v4.20/ident/dma_wmb > I brought up the issue because PA 2.0 processors do out-of-order execution of loads and stores. This will be visible to I/O processors even on a UP machine. Carlo, are you testing with UP or SMP kernel? Dave -- John David Anglin dave.anglin@xxxxxxxx