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:	Sun, 26 Jun 2016 13:21:04 +0800
From:	panxinhui <xinhui@...ux.vnet.ibm.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	panxinhui <xinhui@...ux.vnet.ibm.com>,
	Boqun Feng <boqun.feng@...il.com>,
	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


> 在 2016年6月26日,03:20,Peter Zijlstra <peterz@...radead.org> 写道:
> 
> On Sun, Jun 26, 2016 at 01:27:56AM +0800, panxinhui wrote:
>>>> Would that not have issues where the owner cpu is kept running but the
>>>> spinner (ie. _this_ vcpu) gets preempted? I would think that in that
>>>> case we too want to stop spinning.
>>>> 
>>> 
>> do  you mean that the spinner detect itself had yield out during the
>> big spin loop?
>> 
>> It is very possible to happen.  BUT if spinner(on this vcpu) yield
>> out, the next spinner would break the spin loop.  AND if spinner
>> detect itself yield out once, it’s very possible to get the osq lock
>> soon as long as the ower vcpu is running.
>> 
>> SO I think we need just check the owner vcpu’s yield_count.
> 
> I had a quick look at KVM and it looks like it only has
> kvm_cpu::preempted, which would suggest the interface boqun proposed.
> 
> We'll have to look at many of the other virt platforms as well to see
> what they can do.
> 
> We could also provide _both_ interfaces and a platform can implement
> whichever variant (or both) it can.
> 
the kvm code on ppc has implemented  yield_count.
It let me feel a little relaxed. :)

looks like we could  introduce the interface like below.

bool vcpu_is_preempted(int cpu)
{
	return arch_vcpu_is_preempted(cpu);
}

#ifdef arch_vcpu_has_yield_count 
bool vcpu_has_preemtped_once(int cpu, unsigned int yield_count)
 {
	return arch_get_vcpu_yield_count() != yield_count;
}

#else
bool vcpu_has_preemtped_once(int cpu, unsigned int yield_count)
{
	/*just let called know it is preepmpted*/
	return vcpu_is_preempted(cpu);
}
#endif


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ