From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753332AbdHKOmE (ORCPT ); Fri, 11 Aug 2017 10:42:04 -0400 Received: from merlin.infradead.org ([205.233.59.134]:50874 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752984AbdHKOmB (ORCPT ); Fri, 11 Aug 2017 10:42:01 -0400 Date: Fri, 11 Aug 2017 16:41:50 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Stephen Rothwell , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Linux-Next Mailing List , Linux Kernel Mailing List Subject: Re: linux-next: build failure after merge of the rcu tree Message-ID: <20170811144150.26gowhxte7ri5fpk@hirez.programming.kicks-ass.net> References: <20170811144352.585085e2@canb.auug.org.au> <20170811045453.GB3730@linux.vnet.ibm.com> <20170811091434.h6mkuuw3zcgkzg26@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170811091434.h6mkuuw3zcgkzg26@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 11, 2017 at 11:14:34AM +0200, Peter Zijlstra wrote: > On Thu, Aug 10, 2017 at 09:54:53PM -0700, Paul E. McKenney wrote: > > On Fri, Aug 11, 2017 at 02:43:52PM +1000, Stephen Rothwell wrote: > > > > Looks like I need to rebase my patch on top of a9668cd6ee28, and > > than put an smp_mb__after_spinlock() between the lock and the unlock. > > > > Peter, any objections to that approach? Other suggestions? > > Hurm.. I'll have to try and understand that comment there again it > seems. OK, so per commit b5740f4b2cb3 ("sched: Fix ancient race in do_exit()") the race is with try_to_wake_up(): down_read() p->state = TASK_UNINTERRUPTIBLE; try_to_wake_up(p) spin_lock(p->pi_lock); /* sees TASK_UNINTERRUPTIBLE */ ttwu_remote() /* check stuff, no need to schedule() */ p->state = TASK_RUNNING p->state = TASK_DEAD p->state = TASK_RUNNING /* whoops! */ spin_unlock(p->pi_lock); __schedule(false); BUG(); So given that, I think that: spin_lock(¤t->pi_lock); spin_unlock(¤t->pi_lock); current->state = TASK_DEAD; is sufficient. I don't see a need for an additional smp_mb here. Either the concurrent ttwu is finished and we must observe its RUNNING store, or it will observe our RUNNING store.