[POWERPC] Make mmiowb's io_sync preempt safe
authorHugh Dickins <hugh@veritas.com>
Tue, 31 Oct 2006 18:41:51 +0000 (18:41 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 1 Nov 2006 03:52:49 +0000 (14:52 +1100)
commit292f86f005e3867277b2126c2399eea3e773a4fc
tree12a7040e81b80f87f4c0899b94dd8bd29c1df391
parent96268889ee369b36203b7a06e8aabb197270216e
[POWERPC] Make mmiowb's io_sync preempt safe

If mmiowb() is always used prior to releasing spinlock as Doc suggests,
then it's safe against preemption; but I'm not convinced that's always
the case.  If preemption occurs between sync and get_paca()->io_sync = 0,
I believe there's no problem.  But in the unlikely event that gcc does
the store relative to another register than r13 (as it did with current),
then there's a small danger of setting another cpu's io_sync to 0, after
it had just set it to 1.  Rewrite ppc64 mmiowb to prevent that.

The remaining io_sync assignments in io.h all get_paca()->io_sync = 1,
which is harmless even if preempted to the wrong cpu (the context switch
itself syncs); and those in spinlock.h are while preemption is disabled.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
include/asm-powerpc/io.h