[lkml]   [2008]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC patch 08/18] cnt32_to_63 should use smp_rmb()

On Fri, 7 Nov 2008, David Howells wrote:

> Steven Rostedt <> wrote:
> > > I use smp_rmb() to do this on SMP systems (hrm, actually, a rmb() could
> > > be required so it works also on UP systems safely wrt interrupts).
> >
> > smp_rmb turns into a compiler barrier on UP and should prevent the below
> > description.
> Note that that does not guarantee that the two reads will be done in the order
> you want. The compiler barrier _only_ affects the compiler. It does not stop
> the CPU from doing the reads in any order it wants. You need something
> stronger than smp_rmb() if you need the reads to be so ordered.

For reading hardware devices that can indeed be correct. But for normal
memory access on a uniprocessor, if the CPU were to reorder the reads that
would effect the actual algorithm then that CPU is broken.

read a
<--- interrupt - should see read a here before read b is done.
read b

Now the fact that one of the reads is a hardware clock, then this
statement might not be too strong. But the fact that it is a clock, and
not some memory mapped device register, I still think smp_rmb is

-- Steve

 \ /
  Last update: 2008-11-08 01:57    [W:0.082 / U:4.060 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site