From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932289AbcGOHJa (ORCPT ); Fri, 15 Jul 2016 03:09:30 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:40394 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932094AbcGOHJ3 (ORCPT ); Fri, 15 Jul 2016 03:09:29 -0400 Date: Fri, 15 Jul 2016 09:09:25 +0200 From: Peter Zijlstra To: Wanpeng Li Cc: Waiman Long , "linux-kernel@vger.kernel.org" , Wanpeng Li , Ingo Molnar , Davidlohr Bueso Subject: Re: [PATCH v3] locking/pvqspinlock: restore/set vcpu_hashed state after failing adaptive locking spinning Message-ID: <20160715070925.GO30154@twins.programming.kicks-ass.net> References: <1468496357-6400-1-git-send-email-wanpeng.li@hotmail.com> <5787A718.5020901@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Fri, Jul 15, 2016 at 05:26:40AM +0800, Wanpeng Li wrote: > 2016-07-14 22:52 GMT+08:00 Waiman Long : > [...] > > As pv_kick_node() is called immediately after designating the next node as > > the queue head, the chance of this racing is possible, but is not likely > > unless the lock holder vCPU gets preempted for a long time at that right > > moment. This change does not do any harm though, so I am OK with that. > > However, I do want you to add a comment about the possible race in the code > > as it isn't that obvious or likely. > > How about something like: > > /* > * If the lock holder vCPU gets preempted for a long time, pv_kick_node will > * advance its state and hash the lock, restore/set the vcpu_hashed state to > * avoid the race. > */ So I'm not sure. Yes it was a bug, but its fairly 'obvious' it should be vcpu_hashed, we did after all hash the thing. > Btw, do you think patch title should be improved, what do you like? I changed it to: "locking/pvqspinlock: Fix double hash race"