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]
Date:	Mon, 23 Feb 2015 10:29:21 -0800
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Manfred Spraul <manfred@...orfullife.com>
Cc:	Oleg Nesterov <oleg@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Kirill Tkhai <ktkhai@...allels.com>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
	Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 2/2] [PATCH] sched: Add smp_rmb() in task rq locking
 cycles

On Fri, Feb 20, 2015 at 07:26:21PM -0800, Paul E. McKenney wrote:
> On Fri, Feb 20, 2015 at 07:28:16PM +0100, Manfred Spraul wrote:
> > Hi Oleg,
> > 
> > my example was bad, let's continue with your example.
> > 
> > And: If sem_lock() needs another smp_xmb(), then we must add it:
> > Some apps do not have a user space hot path, i.e. it seems that on
> > some setups, we have millions of calls per second.
> > If there is a race, then it will happen.
> > 
> > I've tried to merge your example:
> > >
> > > int X = 0, Y = 0;
> > >
> > > void func(void)
> > > {
> > >     bool ll = rand();
> > >
> > >     if (ll) {
> > >         spin_lock(&local);
> > >         if (!spin_is_locked(&global))
> > >             goto done;
> > >         spin_unlock(&local);
> > >     }
> > >     ll = false;
> > >     spin_lock(&global);
> > >     spin_unlock_wait(&local);
> > > done:
> > >     smp_rmb(); <<<<<<<<<<<<<<<
> > >     BUG_ON(X != Y);
> > >
> > >     ++X; ++Y;
> > >
> > >     if (ll)
> > >         spin_unlock(&local);
> > >     else
> > >         spin_unlock(&global);
> > > }
> > I agree, we need the smp_rmb().
> > I'll write a patch.
> > 
> > >We need the full barrier to serialize STORE's as well, but probably we can
> > >rely on control dependancy and thus we only need rmb().
> > Do we need a full barrier or not?
> > 
> > I don't manage to create a proper line of reasoning.
> 
> This has to be one of the more bizarre forms of Dekker's algorithm
> that I have seen.  ;-)
> 
> I am going to have to put this through one of the tools...

And this was just me getting confused by memories of old versions of
the code.  This will work given current mainline code.  Please accept
my apologies for the noise.

And yes, you do need the smp_rmb() to ensure that the BUG_ON() happens
after the other guy releases his spinlock.

							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