Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753891AbcDIN3n (ORCPT ); Sat, 9 Apr 2016 09:29:43 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:45404 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753266AbcDIN3m (ORCPT ); Sat, 9 Apr 2016 09:29:42 -0400 Date: Sat, 9 Apr 2016 15:29:35 +0200 From: Peter Zijlstra To: xlpang@redhat.com Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Juri Lelli , Ingo Molnar , Thomas Gleixner Subject: Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks Message-ID: <20160409132935.GU3448@twins.programming.kicks-ass.net> References: <56FE78E0.5060504@redhat.com> <20160401215143.GB2906@worktop> <57037974.1020002@redhat.com> <20160405091954.GI3448@twins.programming.kicks-ass.net> <20160405092954.GC24771@twins.programming.kicks-ass.net> <20160408122510.15978179@gandalf.local.home> <20160408173835.GC1087@worktop> <20160408145055.13c98a75@gandalf.local.home> <20160408185916.GQ3448@twins.programming.kicks-ass.net> <57087633.3020700@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57087633.3020700@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 901 Lines: 20 On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: > > In any case, I just realized we do not in fact provide this guarantee > > (of pointing to a blocked task) that needs a bit more work. > > Current patch calls rt_mutex_adjust_prio() before wake_up_q() the > wakee, at that moment the wakee has been removed by > rt_mutex_slowunlock()->mark_wakeup_next_waiter(), from current's > pi_waiters, rt_mutex_adjust_prio() won't see this wakee, so I think > this should not be problem. No, any wakeup after mark_wakeup_next_waiter() will make the task run. And since we must always consider spurious wakeups, we cannot rely on us (eg. our wake_up_q call) being the one and only. Therefore it is possible and the only thing that stands between us and doom is the fact that the wake_q stuff holds a task reference. But we cannot guarantee that the task we have a pointer to is in fact blocked.