Re: [RFC PATCH] introduce sys_membarrier(): process-wide memorybarrier

From: Steven Rostedt
Date: Sun Jan 10 2010 - 06:50:26 EST


On Sat, 2010-01-09 at 21:25 -0800, Paul E. McKenney wrote:
> On Sat, Jan 09, 2010 at 09:12:58PM -0500, Steven Rostedt wrote:

> > > < user space >
> > >
> > > < misses that CPU 2 is in rcu section >
> >
> >
> > If the TLB flush misses that CPU 2 has a threaded task, and does not
> > flush CPU 2s TLB, it can also risk the same type of crash.
>
> But isn't the VM's locking helping us out in that case?
>
> > > [CPU 2's ->curr update now visible]
> > >
> > > [CPU 2's rcu_read_lock() store now visible]
> > >
> > > free(obj);
> > >
> > > use_object(obj); <=== crash!
> > >
> >
> > Think about it. If you change a process mmap, say you updated a mmap of
> > a file by flushing out one page and replacing it with another. If the
> > above missed sending to CPU 2, then CPU 2 may still be accessing the old
> > page of the file, and not the new one.
> >
> > I think this may be the safe bet.
>
> You might well be correct that we can access that bitmap locklessly,
> but there are additional things (like the loading of the arch-specific
> page-table register) that are likely to be helping in the VM case, but
> not necessarily helping in this case.


Then perhaps the sys_membarrier() should just do a flush_tlb()? That
should guarantee the synchronization, right?

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/