lkml.org 
[lkml]   [2017]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH tip/core/rcu 7/9] rcu: Pretend ->boost_mtx acquired legitimately
On Wed, Oct 04, 2017 at 02:29:33PM -0700, Paul E. McKenney wrote:
> RCU priority boosting uses rt_mutex_init_proxy_locked() to initialize an
> rt_mutex structure in locked state held by some other task. When that
> other task releases it, lockdep complains (quite accurately, but a bit
> uselessly) that the other task never acquired it. This complaint can
> suppress other, more helpful, lockdep complaints, and in any case it is
> a false positive.
>
> This commit therefore uses the mutex_acquire() macro to make it look
> like that other process legitimately acquired the lock, thus suppressing
> this lockdep false-positive complaint.
>
> Of course, if lockdep ever learns about rt_mutex_init_proxy_locked(),
> this commit will need to be reverted.
>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

This is a consequence of me doing:

f5694788ad8d ("rt_mutex: Add lockdep annotations")

Right?

> ---
> kernel/rcu/tree_plugin.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index fed95fa941e6..60bfb16c9a1a 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -529,8 +529,11 @@ void rcu_read_unlock_special(struct task_struct *t)
> }
>
> /* Unboost if we were boosted. */
> - if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex)
> + if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex) {
> + /* For lockdep, pretend we acquired lock honestly. */
> + mutex_acquire(&rnp->boost_mtx.dep_map, 0, 0, _RET_IP_);
> rt_mutex_unlock(&rnp->boost_mtx);
> + }

So I'm thinking the problem is that you're mixing rt_mutex and PI-futex
primitives here. As per commit:

5293c2efda37 ("futex,rt_mutex: Provide futex specific rt_mutex API")

these are two separate APIs, that should, ideally, not be mixed.

The 'right' counterpart to rt_mutex_init_proxy_locked() is
rt_mutex_futex_unlock() (which very much does not include lockdep bits).

\
 
 \ /
  Last update: 2017-10-05 11:51    [W:0.095 / U:29.284 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site