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:	Thu, 17 Sep 2015 11:08:43 -0400
From:	Waiman Long <waiman.long@....com>
To:	Peter Zijlstra <peterz@...radead.org>
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 v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

On 09/16/2015 11:01 AM, Peter Zijlstra wrote:
> On Tue, Sep 15, 2015 at 11:29:14AM -0400, Waiman Long wrote:
>
>> Only the queue head vCPU will be in pv_wait_head() spinning to acquire the
>> lock.
> But what will guarantee fwd progress for the lock that is the head?
>
> Suppose CPU0 becomes head and enters the /* claim the lock */ loop.
>
> Then CPU1 comes in, steals it in pv_wait_head(). CPU1 releases, CPU1
> re-acquires and _again_ steals in pv_wait_head(), etc..
>
> All the while CPU0 doesn't go anywhere.
>

That can't happen. For a given lock, there can only be 1 queue head 
spinning on the lock at any instance in time. If CPU0 was the head, 
another CPU could not become head until CPU0 got the lock and pass the 
MCS lock bit to the next one in the queue. As I said in earlier mail, 
the only place where lock stealing can happen is in the 
pv_queued_spin_trylock_unfair() function where I purposely inserted a 
cpu_relax() to allow an actively spinning queue head CPU a better chance 
of getting the lock. Once a CPU enters the queue. It won't try to 
acquire the lock until it becomes the head and there is one and only one 
head.

Cheers,
Longman
--
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