On Tue, Mar 27, 2018 at 11:33 AM, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> wrote: > > Well, we need to clarify that once and for all, because as I wrote > earlier, it was decreed by Linus more than a decade ago that writel > would be fully ordered by itself vs. previous memory stores (at least > on UC memory). Yes. So "writel()" needs to be ordered with respect to other writel() uses on the same thread. Anything else *will* break drivers. Obviously, the drivers may then do magic to say "do write combining etc", but that magic will be architecture-specific. The other issue is that "writel()" needs to be ordered wrt other CPU's doing "writel()" if those writel's are in a spinlocked region. So it's not that "writel()" needs to be ordered wrt the spinlock itself, but you *do* need to honor ordering if you have something like this: spin_lock(&somelock); writel(a); writel(b); spin_unlock(&somelock); and if two CPU's run the above code "at the same time", then the *ONLY* acceptable sequence is abab. You cannot, and must not, ever see "aabb" at the device, for example, because of how the writel would basically leak out of the spinlock. That sounds "obvious", but dammit, a lot of architectures got that wrong, afaik. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html