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: <20160625160922.GL30154@twins.programming.kicks-ass.net>
Date:	Sat, 25 Jun 2016 18:09:22 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Boqun Feng <boqun.feng@...il.com>
Cc:	Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org, mingo@...hat.com, dave@...olabs.net,
	will.deacon@....com, Waiman.Long@....com, benh@...nel.crashing.org
Subject: Re: [PATCH] locking/osq: Drop the overload of osq lock

On Sat, Jun 25, 2016 at 11:21:30PM +0800, Boqun Feng wrote:
> > 
> > 	int vpc = vcpu_preempt_count();
> > 
> > 	...
> > 
> > 	for (;;) {
> > 
> > 		/* the big spin loop */
> > 
> > 		if (need_resched() || vpc != vcpu_preempt_count())
> 
> So on PPC, we have lppaca::yield_count to detect when an vcpu is

Which sounds like just the value we want.. And I suspect that on x86 KVM
and Xen have similar numbers stashed away someplace.

> preempted, if the yield_count is even, the vcpu is running, otherwise it
> is preempted(__spin_yield() is a user of this).
> 
> Therefore it makes more sense we
> 
> 		if (need_resched() || vcpu_is_preempted(old))
> 
> here, and implement vcpu_is_preempted() on PPC as
> 
> bool vcpu_is_preempted(int cpu)
> {
> 	return !!(be32_to_cpu(lppaca_of(cpu).yield_count) & 1)
> }
> 
> Thoughts?

That works here, but it would not work for the need_resched() in
mutex_spin_on_owner() and mutex_optimistic_spin() which need equal
treatment.

Because those too we want to limit.

The count thing, while a little more cumbersome, is more widely
applicable than just the one OSQ case where we happen to have a cpu
number.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ