From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752856AbcGOIrk (ORCPT ); Fri, 15 Jul 2016 04:47:40 -0400 Received: from merlin.infradead.org ([205.233.59.134]:47194 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbcGOIrh (ORCPT ); Fri, 15 Jul 2016 04:47:37 -0400 Date: Fri, 15 Jul 2016 10:47:32 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Pan Xinhui , Boqun Feng , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v2 2/5] locking/pvqspinlock: Fix missed PV wakeup problem Message-ID: <20160715084732.GF30921@twins.programming.kicks-ass.net> References: <1464713631-1066-1-git-send-email-Waiman.Long@hpe.com> <1464713631-1066-3-git-send-email-Waiman.Long@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1464713631-1066-3-git-send-email-Waiman.Long@hpe.com> 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 So the reason I never get around to this is because the patch stinks. It simply doesn't make sense... Remember, the harder you make a reviewer work the less likely the review will be done. Present things in clear concise language and draw a picture. On Tue, May 31, 2016 at 12:53:48PM -0400, Waiman Long wrote: > Currently, calling pv_hash() and setting _Q_SLOW_VAL is only > done once for any pv_node. It is either in pv_kick_node() or in > pv_wait_head_or_lock(). So far so good.... > Because of lock stealing, a pv_kick'ed node is > not guaranteed to get the lock before the spinning threshold expires > and has to call pv_wait() again. As a result, the new lock holder > won't see _Q_SLOW_VAL and so won't wake up the sleeping vCPU. *brain melts* what!? pv_kick'ed node reads like pv_kick_node() and that doesn't make any kind of sense. I'm thinking you're trying to say this: CPU0 CPU1 CPU2 __pv_queued_spin_unlock_slowpath() ... smp_store_release(&l->locked, 0); __pv_queued_spin_lock_slowpath() ... pv_queued_spin_steal_lock() cmpxchg(&l->locked, 0, _Q_LOCKED_VAL) == 0 pv_wait_head_or_lock() pv_kick(node->cpu); ----------------------> pv_wait(&l->locked, _Q_SLOW_VAL); __pv_queued_spin_unlock() cmpxchg(&l->locked, _Q_LOCKED_VAL, 0) == _Q_LOCKED_VAL for () { trylock_clear_pending(); cpu_relax(); } pv_wait(&l->locked, _Q_SLOW_VAL); Which is indeed 'bad', but not fatal, note that the later pv_wait() will not in fact go wait, since l->locked will _not_ be _Q_SLOW_VAL. Is this indeed the 3 CPU scenario you tried to describe in a scant 4 lines of text, or is there more to it?