Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752415AbcDJIWW (ORCPT ); Sun, 10 Apr 2016 04:22:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42790 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750810AbcDJIWU (ORCPT ); Sun, 10 Apr 2016 04:22:20 -0400 Reply-To: xlpang@redhat.com Subject: Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks 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> <20160409132935.GU3448@twins.programming.kicks-ass.net> To: Peter Zijlstra Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Juri Lelli , Ingo Molnar , Thomas Gleixner From: Xunlei Pang Message-ID: <570A0D37.8080400@redhat.com> Date: Sun, 10 Apr 2016 16:22:15 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20160409132935.GU3448@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 10 Apr 2016 08:22:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1445 Lines: 30 On 2016/04/09 at 21:29, Peter Zijlstra wrote: > 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. Does that really matters? the pointer is accessed on behalf of current, and current will call rt_mutex_adjust_prio() very soon to update the right pointer. Also the pointer is used to update current's deadline/runtime, we can restore these params in rt_mutex_setprio() for deboost cases. I just checked current code, it did nothing to restore current's deadline/runtime when deboosting, maybe we can leave this job to future deadline bandwidth inheritance? Regards, Xunlei