From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161431AbcIZP0v (ORCPT ); Mon, 26 Sep 2016 11:26:51 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:54066 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934308AbcIZP0s (ORCPT ); Mon, 26 Sep 2016 11:26:48 -0400 Date: Mon, 26 Sep 2016 17:26:39 +0200 From: Peter Zijlstra To: Steven Rostedt Cc: mingo@kernel.org, tglx@linutronix.de, juri.lelli@arm.com, xlpang@redhat.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, bristot@redhat.com, Ingo Molnar Subject: Re: [PATCH -v2 2/9] sched/rtmutex/deadline: Fix a PI crash for deadline tasks Message-ID: <20160926152639.GF5016@twins.programming.kicks-ass.net> References: <20160926123213.851818224@infradead.org> <20160926124127.932737914@infradead.org> <20160926112058.5cfbb348@grimm.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160926112058.5cfbb348@grimm.local.home> 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 Mon, Sep 26, 2016 at 11:20:58AM -0400, Steven Rostedt wrote: > > --- a/kernel/locking/rtmutex.c > > +++ b/kernel/locking/rtmutex.c > > @@ -256,6 +256,16 @@ rt_mutex_dequeue_pi(struct task_struct * > > RB_CLEAR_NODE(&waiter->pi_tree_entry); > > } > > > > Shouldn't we add a comment about what locks are expected to be held > when calling this? Especially if it can be called outside this file. Comments are somewhat useless.. I would like to do the below, except I cannot. > > +void rt_mutex_update_top_task(struct task_struct *p) > > +{ lockdep_assert_held(&p->pi_lock); lockdep_assert_held(&task_rq(p)->lock); // except that we cannot access rq :/ > > + if (!task_has_pi_waiters(p)) { > > + p->pi_top_task = NULL; > > + return; > > + } > > + > > + p->pi_top_task = task_top_pi_waiter(p)->task; > > +} > > + > > /* > > * Calculate task priority from the waiter tree priority > > * > > @@ -273,10 +283,7 @@ int rt_mutex_getprio(struct task_struct > > > > Any specific locks that must be held when calling this? #ifdef CONFIG_LOCKDEP WARN_ON_ONCE(debug_locks && !lock_is_held(&p->pi_lock) && !lock_is_held(&task_rq(p)->lock)); // again, cannot do this :/ #endif > > struct task_struct *rt_mutex_get_top_task(struct task_struct *task) > > { > > - if (likely(!task_has_pi_waiters(task))) > > - return NULL; > > - > > - return task_top_pi_waiter(task)->task; > > + return task->pi_top_task; > > } > > -- Steve >