lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100107183946.GL6764@linux.vnet.ibm.com>
Date:	Thu, 7 Jan 2010 10:39:46 -0800
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	akpm@...ux-foundation.org, josh@...htriplett.org,
	tglx@...utronix.de, rostedt@...dmis.org, Valdis.Kletnieks@...edu,
	dhowells@...hat.com, laijs@...fujitsu.com, dipankar@...ibm.com
Subject: Re: [RFC PATCH] introduce sys_membarrier(): process-wide memory
	barrier

On Thu, Jan 07, 2010 at 07:30:10PM +0100, Oleg Nesterov wrote:
> On 01/07, Peter Zijlstra wrote:
> >
> > On Wed, 2010-01-06 at 23:40 -0500, Mathieu Desnoyers wrote:
> >
> > http://marc.info/?t=126283939400002
> >
> > > Index: linux-2.6-lttng/kernel/sched.c
> > > ===================================================================
> > > --- linux-2.6-lttng.orig/kernel/sched.c	2010-01-06 22:11:32.000000000 -0500
> > > +++ linux-2.6-lttng/kernel/sched.c	2010-01-06 23:20:42.000000000 -0500
> > > @@ -10822,6 +10822,36 @@ struct cgroup_subsys cpuacct_subsys = {
> > >  };
> > >  #endif	/* CONFIG_CGROUP_CPUACCT */
> > >
> > > +/*
> > > + * Execute a memory barrier on all CPUs on SMP systems.
> > > + * Do not rely on implicit barriers in smp_call_function(), just in case they
> > > + * are ever relaxed in the future.
> > > + */
> > > +static void membarrier_ipi(void *unused)
> > > +{
> > > +	smp_mb();
> > > +}
> > > +
> >
> > Also, there was some talk a while ago about IPIs implying memory
> > barriers. Which I of course forgot all details about,.. at least sending
> > one implies a wmb and receiving one an rmb, but it could be stronger,
> > Oleg?
> 
> IIRC, it was decided that IPIs must imply mb(), but I am not sure
> this is true on any arch/
> 
> 
> 
> However, even if IPI didn't imply mb(), I don't understand why it
> is needed... After the quick reading of the original changelog in
> http://marc.info/?l=linux-kernel&m=126283923115068
> 
> 	Thread A                    Thread B
> 	prev mem accesses           prev mem accesses
> 	sys_membarrier()            barrier()
> 	follow mem accesses         follow mem accesses
> 
> sys_membarrier() should "insert" mb() on behalf of B "instead"
> of barrier(), right? But, if we send IPI, B enters kernel mode
> and returns to user-mode. Should this imply mb() in any case?

Hello, Oleg,

The issue is with some suggested optimizations that would avoid sending
the IPI to CPUs that are not running threads in the same process as the
thread executing the sys_membarrier().  Some forms of these optimizations
sample ->mm without locking, and the question is whether this is safe.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ