Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754536AbcDANee (ORCPT ); Fri, 1 Apr 2016 09:34:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38393 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761AbcDANed (ORCPT ); Fri, 1 Apr 2016 09:34:33 -0400 Reply-To: xlpang@redhat.com Subject: Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks References: <1459508418-25577-1-git-send-email-xlpang@redhat.com> <20160401113827.GQ3430@twins.programming.kicks-ass.net> <56FE685E.6080001@redhat.com> <19912883-8AB1-4DFD-A0E1-F23057785243@infradead.org> To: Peter Zijlstra , xlpang@redhat.com Cc: linux-kernel@vger.kernel.org, Juri Lelli , Ingo Molnar , Steven Rostedt From: Xunlei Pang Message-ID: <56FE78E0.5060504@redhat.com> Date: Fri, 1 Apr 2016 21:34:24 +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: <19912883-8AB1-4DFD-A0E1-F23057785243@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1084 Lines: 31 On 2016/04/01 at 21:12, Peter Zijlstra wrote: > > On 1 April 2016 14:23:58 CEST, Xunlei Pang wrote: > >>>> We need this iff lock owner has the deadline priority. >>> How is this deadline specific, those functions you modify are >>> deadline/rt agnostic. >> I checked the code, currently only deadline accesses the >> pi_waiters/pi_waiters_leftmost >> without pi_lock held via rt_mutex_get_top_task(), other cases all have >> pi_lock held. >> >> So adding the condition. > How does that not suggest fixing the deadline code? I did tried that at first, but found it very hard when processing pull_dl_task(push_dl_task can crash as well) like: double_lock_balance(this_rq, src_rq); p = pick_earliest_pushable_dl_task(src_rq, this_cpu); /* and for each @p, we must hold its pi_lock, doing this once rq is locked will cause deadlock. */ Ditto for enqueue_task_dl()->rt_mutex_get_top_task(), as rq is locked. If we unlock rq first and then lock pi_lock, this may cause other problems due to unlocking rq. Any better ideas is welcome. Regards, Xunlei