All of lore.kernel.org
 help / color / mirror / Atom feed
* SMP barriers semantics
@ 2010-03-02 10:52 Catalin Marinas
  2010-03-03  0:55 ` Paul Mackerras
  0 siblings, 1 reply; 22+ messages in thread
From: Catalin Marinas @ 2010-03-02 10:52 UTC (permalink / raw)
  To: linux-arch; +Cc: Russell King

Hi,

We have an issue with the barriers usage/implementation on ARM and I
would like some clarification.

As a background - latest ARM processors have two kinds of barriers - a
lightweight one (DMB) which basically only ensures the ordering of
accesses to the same memory type (the definition is a bit more
complicated but in the context of Linux this is a safe simplification).
The second kind of barrier is a heavyweight one (DSB) which drains the
write buffers.

Both *mb() and smp_*mb() are currently implemented with the lightweight
version (DMB) but this is not enough for coherent DMA operations where a
DSB is needed to drain the write buffer before writing to the device I/O
memory for starting the transfer. My proposal on the ARM lists was to
change mb()/wmb() to DSB but leave the smp_*mb() as a DMB.

The main question - are the Linux SMP barriers supposed to have an
effect outside of cacheable memory accesses (i.e. ordering wrt I/O
accesses)?

My understanding from other comments in the kernel source is that the
SMP barriers are only meant or cacheable memory but there are drivers
that do something like below (e.g. drivers/net/r8169.c):

		/* We need for force the visibility of tp->intr_mask
		 * for other CPUs, as we can loose an MSI interrupt
		 * and potentially wait for a retransmit timeout if we don't.
		 * The posted write to IntrMask is safe, as it will
		 * eventually make it to the chip and we won't loose anything
		 * until it does.
		 */
		tp->intr_mask = 0xffff;
		smp_wmb();
		RTL_W16(IntrMask, tp->intr_event);

Is this supposed to work given the SMP barriers semantics?

Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-04-26  9:25 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-02 10:52 SMP barriers semantics Catalin Marinas
2010-03-03  0:55 ` Paul Mackerras
2010-03-03 12:03   ` Catalin Marinas
2010-03-12 12:31     ` Ralf Baechle
2010-03-12 20:38       ` Jamie Lokier
2010-03-17  2:25       ` Benjamin Herrenschmidt
2010-03-17 10:31         ` Catalin Marinas
2010-03-17 13:42         ` Jamie Lokier
2010-03-22 12:02           ` Nick Piggin
2010-03-23  3:42             ` Nick Piggin
2010-03-23 10:24             ` Catalin Marinas
2010-04-06 14:20               ` Nick Piggin
2010-04-06 15:43                 ` Jamie Lokier
2010-04-06 16:04                   ` Nick Piggin
2010-04-23 16:23                 ` Catalin Marinas
2010-04-23 16:56                   ` Jamie Lokier
2010-04-23 17:25                     ` Catalin Marinas
2010-04-24  1:45                       ` Jamie Lokier
2010-04-26  9:21                         ` Catalin Marinas
2010-03-04  2:23   ` David Dillow
2010-03-04  9:33     ` Russell King
2010-03-04  9:48       ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.