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] [day] [month] [year] [list]
Message-ID: <1425711422.2475.380.camel@j-VirtualBox>
Date:	Fri, 06 Mar 2015 22:57:02 -0800
From:	Jason Low <jason.low2@...com>
To:	Ming Lei <ming.lei@...onical.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	Ingo Molnar <mingo@...nel.org>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	Peter Zijlstra <peterz@...radead.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Dave Jones <davej@...emonkey.org.uk>, jason.low2@...com
Subject: Re: softlockups in multi_cpu_stop

On Sat, 2015-03-07 at 13:54 +0800, Ming Lei wrote:
> On Sat, Mar 7, 2015 at 12:31 PM, Jason Low <jason.low2@...com> wrote:
> > On Fri, 2015-03-06 at 13:12 -0800, Jason Low wrote:
> > Cc: Ming Lei <ming.lei@...onical.com>
> > Cc: Davidlohr Bueso <dave@...olabs.net>
> > Signed-off-by: Jason Low <jason.low2@...com>
> 
> Reported-and-tested-by: Ming Lei <ming.lei@...onical.com>

Thanks!

> >  static noinline
> >  bool rwsem_spin_on_owner(struct rw_semaphore *sem, struct task_struct *owner)
> >  {
> >         long count;
> >
> >         rcu_read_lock();
> > -       while (owner_running(sem, owner)) {
> > -               /* abort spinning when need_resched */
> > -               if (need_resched()) {
> > +       while (sem->owner == owner) {
> > +               /*
> > +                * Ensure we emit the owner->on_cpu, dereference _after_
> > +                * checking sem->owner still matches owner, if that fails,
> > +                * owner might point to free()d memory, if it still matches,
> > +                * the rcu_read_lock() ensures the memory stays valid.
> > +                */
> > +               barrier();
> > +
> > +               /* abort spinning when need_resched or owner is not running */
> > +               if (!owner->on_cpu || need_resched()) {
> 
> BTW, could the need_resched() be handled in loop of
> rwsem_optimistic_spin() directly? Then code may get
> simplified a bit.

We still need the need_resched() check here, since if the thread needs
to reschedule, it should immediately stop spinning for the lock.
Otherwise, it could potentially spin for a long time before it checks
for it needs to reschedule.

--
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