From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbcFYTaJ (ORCPT ); Sat, 25 Jun 2016 15:30:09 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52043 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658AbcFYTaH (ORCPT ); Sat, 25 Jun 2016 15:30:07 -0400 Date: Sat, 25 Jun 2016 21:29:58 +0200 From: Peter Zijlstra To: panxinhui Cc: Boqun Feng , Pan Xinhui , linux-kernel@vger.kernel.org, mingo@redhat.com, dave@stgolabs.net, will.deacon@arm.com, Waiman.Long@hpe.com, benh@kernel.crashing.org Subject: Re: [PATCH] locking/osq: Drop the overload of osq lock Message-ID: <20160625192958.GA30927@twins.programming.kicks-ass.net> References: <1466876523-33437-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160625142447.GK30154@twins.programming.kicks-ass.net> <20160625152130.GA2452@insomnia> <20160625161540.GM30154@twins.programming.kicks-ass.net> <20160625164527.GD2384@insomnia> <20160625192025.GP30154@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160625192025.GP30154@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 25, 2016 at 09:20:25PM +0200, Peter Zijlstra wrote: > 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. Xen seems to have vcpu_runstate_info::state where any !0 state means its not running, so that too allows implementing that variant.