From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751497AbcFNMae (ORCPT ); Tue, 14 Jun 2016 08:30:34 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:41115 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751029AbcFNMad (ORCPT ); Tue, 14 Jun 2016 08:30:33 -0400 Date: Tue, 14 Jun 2016 14:30:23 +0200 From: Peter Zijlstra To: Juri Lelli Cc: mingo@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, xlpang@redhat.com, linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, bristot@redhat.com, Ingo Molnar Subject: Re: [RFC][PATCH 2/8] sched/rtmutex/deadline: Fix a PI crash for deadline tasks Message-ID: <20160614123023.GG30921@twins.programming.kicks-ass.net> References: <20160607195635.710022345@infradead.org> <20160607200215.719626477@infradead.org> <20160614102109.GF5981@e106622-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160614102109.GF5981@e106622-lin> 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 Tue, Jun 14, 2016 at 11:21:09AM +0100, Juri Lelli wrote: > > [XXX this next section is unparsable] > > Yes, a bit hard to understand. However, am I correct in assuming this > patch and the previous one should fix this problem? Or are there still > other races causing issues? I think so; so there were two related problems, 1) top_waiter was used outside its serialization 2) a race against the top waiter task and sched_setscheduler() changing its state Now, I could not understand a word of that marked paragraph, but from my understanding of the code both are solved. 1) by keeping the top_pi_task cache updated under pi_lock and rq->lock, thereby ensuring that holding either is sufficient to stabilize it. 2) sched_setscheduler() can change the parameters of the top_pi_task, but since it too holds both pi_lock and rq->lock, it cannot happen at the same time that we're looking at the cached top pi waiter pointer thingy. It can however happen that top_pi_waiter is not in fact the top waiter in a narrow window between sched_setscheduler() changing its parameters and rt_mutex_adjust_pi() re-ordering the PI chain - ending in updating the cached top task pointer thingy.