mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: ajwade@cpe001346162bf9-cm0011ae8cd564.cpe.net.cable.rogers.com,
	vatsa@in.ibm.com, Oleg Nesterov <oleg@tv-sign.ru>,
	linux-kernel@vger.kernel.org,
	Dipankar Sarma <dipankar@in.ibm.com>,
	"Paul E. McKenney" <paulmck@us.ibm.com>,
	Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ]
Date: Mon, 12 Dec 2005 11:49:07 +1100	[thread overview]
Message-ID: <18382.1134348547@ocs3.ocs.com.au> (raw)
In-Reply-To: Your message of "Mon, 12 Dec 2005 10:45:16 +1100." <1134344716.5937.11.camel@localhost.localdomain>

On Mon, 12 Dec 2005 10:45:16 +1100, 
Rusty Russell <rusty@rustcorp.com.au> wrote:
>On Sun, 2005-12-11 at 16:21 -0500, Andrew James Wade wrote:
>> On Sunday 11 December 2005 12:41, Srivatsa Vaddagiri wrote:
>> > We seem to be having some confusion over the exact semantics of smp_mb().
>> > 
>> > Specifically, are all stores preceding smp_mb() guaranteed to have finished
>> > (committed to memory/corresponding cache-lines on other CPUs invalidated) 
>> > *before* successive loads are issued?
>> 
>> I doubt it. That's definitely not true of smp_wmb(), which boils down to
>> __asm__ __volatile__ ("": : :"memory") on SMP i386 (which the constrains
>> how the compiler orders write instructions, but is otherwise a nop. i386
>> has in-order writes.).
>> 
>> And it makes sense that wmb() wouldn't wait for writes: RCU needs
>> constraints on the order in which writes become visible, but has very week
>> constraints on when they do. Waiting for writes to flush would hurt
>> performance.
>
>On the contrary.  I did some digging and asking and thinking about this
>for the Unreliable Guide to Kernel Locking, years ago:
>
>wmb() means all writes preceeding will complete before any writes
>following are started.
>rmb() means all reads preceeding will complete before any reads
>following are started.
>mb() means all reads and writes preceeding will complete before any
>reads and writes following are started.

FWIW, wmb() on IA64 does not require that preceding stores are flushed
to main memory.  It only requires that they be "made visible to other
processors in the coherence domain".  "visible" means that the updated
value must reach (at least) an externally snooped cache.  There is no
requirement that the preceding stores be flushed all the way to main
memory, the updates only have to get as far as a cache level that other
cpus can see.  The cache snooping takes care of flushing to main memory
when necessary.

IA64 does have a memory fence that stalls the cpu until the data is
"accepted by the external platform".  That format is expensive and is
only used for memory mapped I/O, where the data really does have to
read the memory before the cpu can perform its next operation.  For
example, in the mmiowb() case.


  reply	other threads:[~2005-12-12  0:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 19:31 [PATCH] Fix RCU race in access of nohz_cpu_mask Oleg Nesterov
2005-12-09  2:46 ` Srivatsa Vaddagiri
2005-12-09 19:17   ` Oleg Nesterov
2005-12-10 15:19     ` Srivatsa Vaddagiri
2005-12-10 18:55       ` Oleg Nesterov
2005-12-11 17:41         ` Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ] Srivatsa Vaddagiri
2005-12-11 21:21           ` Andrew James Wade
2005-12-11 23:45             ` Rusty Russell
2005-12-12  0:49               ` Keith Owens [this message]
2005-12-12  8:41                 ` Srivatsa Vaddagiri
2005-12-12 19:33                   ` Oleg Nesterov
2005-12-13  5:20                     ` Paul E. McKenney
2005-12-13  5:07               ` Andrew James Wade
2005-12-13  5:43                 ` Paul E. McKenney
2005-12-13 11:20                 ` Andi Kleen
2005-12-13 16:20                   ` Paul E. McKenney
2005-12-13 22:27                     ` Keith Owens
2005-12-13 22:50                       ` Paul E. McKenney
2005-12-14  1:12                         ` Andi Kleen
2005-12-14  1:46                           ` Paul E. McKenney
2005-12-15 21:15                       ` Semantics of smp_mb() Roland Dreier
2005-12-16  7:46                       ` Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ] Jeremy Higdon
2006-03-13 18:39                         ` Paul E. McKenney
2006-03-31  4:56                           ` Jeremy Higdon
2006-03-31  6:18                             ` Paul E. McKenney
2006-03-31 23:38                             ` Jesse Barnes
2005-12-12  3:10         ` [PATCH] Fix RCU race in access of nohz_cpu_mask Paul E. McKenney
2005-12-12  4:32           ` Andrew Morton
2005-12-12  4:38             ` David S. Miller
2005-12-12  4:47               ` Nick Piggin
2005-12-12  4:49             ` Paul Mackerras
2005-12-12  6:27             ` Keith Owens
2005-12-09  2:56 ` Srivatsa Vaddagiri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18382.1134348547@ocs3.ocs.com.au \
    --to=kaos@ocs.com.au \
    --cc=ajwade@cpe001346162bf9-cm0011ae8cd564.cpe.net.cable.rogers.com \
    --cc=akpm@osdl.org \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=paulmck@us.ibm.com \
    --cc=rusty@rustcorp.com.au \
    --cc=vatsa@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®