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
| ||
|
Date: Tue, 13 Oct 2015 20:23:38 +0200 From: Peter Zijlstra <peterz@...radead.org> To: Waiman Long <Waiman.Long@....com> Cc: Ingo Molnar <mingo@...hat.com>, Thomas Gleixner <tglx@...utronix.de>, "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org, linux-kernel@...r.kernel.org, Scott J Norton <scott.norton@....com>, Douglas Hatch <doug.hatch@....com>, Davidlohr Bueso <dave@...olabs.net> Subject: Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: > for (;; waitcnt++) { > + loop = SPIN_THRESHOLD; > + while (loop) { > + /* > + * Spin until the lock is free > + */ > + for (; loop && READ_ONCE(l->locked); loop--) > + cpu_relax(); > + /* > + * Seeing the lock is free, this queue head vCPU is > + * the rightful next owner of the lock. However, the > + * lock may have just been stolen by another task which > + * has entered the slowpath. So we need to use atomic > + * operation to make sure that we really get the lock. > + * Otherwise, we have to wait again. > + */ > + if (cmpxchg(&l->locked, 0, _Q_LOCKED_VAL) == 0) > + goto gotlock; > } for (loop = SPIN_THRESHOLD; loop; --loop) { if (!READ_ONCE(l->locked) && cmpxchg(&l->locked, 0, _Q_LOCKED_VA) == 0) goto gotlock; cpu_relax(); } -- 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