Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1663116

Re: [PATCH] rt_mutex: correctly initialize lockdep in rt_mutex_init_proxy_locked

From "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Newsgroups linux.kernel
Subject Re: [PATCH] rt_mutex: correctly initialize lockdep in rt_mutex_init_proxy_locked
Date 2017-06-11 17:00 +0200
Message-ID <tRcvn-6jH-5@gated-at.bofh.it> (permalink)
References <tQEDo-1i6-3@gated-at.bofh.it> <tQPfr-84G-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Jun 10, 2017 at 04:02:12PM +0200, Peter Zijlstra wrote:
> On Sat, Jun 10, 2017 at 02:48:04AM +0000, Levin, Alexander (Sasha Levin) wrote:
> > lockdep can't deal with NULL name or key, and doesn't do anything
> > with the lock when that happens.
> 
> Not doing anything is 'right', the proxy stuff won't be lockdep tracked
> anyway. But yeah, the first thing is a wee bit of a problem, for it will
> trigger DEBUG_LOCKS_WARN_ON() and fully kill lockdep.

But don't we want pi_state->pi_mutex tracked by lockdep?

> Yeah, no need to do that; all we really need here is something like:
> 
> ---
>  kernel/locking/rtmutex-debug.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/rtmutex-debug.c b/kernel/locking/rtmutex-debug.c
> index ac35e648b0e5..8dc647dc4b4b 100644
> --- a/kernel/locking/rtmutex-debug.c
> +++ b/kernel/locking/rtmutex-debug.c
> @@ -175,7 +175,8 @@ void debug_rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_cl
>  	lock->name = name;
>  
>  #ifdef CONFIG_DEBUG_LOCK_ALLOC
> -	lockdep_init_map(&lock->dep_map, name, key, 0);
> +	if (name && key)
> +		lockdep_init_map(&lock->dep_map, name, key, 0);
>  #endif
>  }

I didn't want to do that because in later calls on that mutex we
will end up going into lockdep code, and I didn't think that doing
that without calling lockdep_init_map() initially was safe.

-- 

Thanks,
Sasha

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] rt_mutex: correctly initialize lockdep in  rt_mutex_init_proxy_locked "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-06-10 04:50 +0200
  Re: [PATCH] rt_mutex: correctly initialize lockdep in  rt_mutex_init_proxy_locked Peter Zijlstra <peterz@infradead.org> - 2017-06-10 16:10 +0200
    Re: [PATCH] rt_mutex: correctly initialize lockdep in  rt_mutex_init_proxy_locked "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-06-11 17:00 +0200
      Re: [PATCH] rt_mutex: correctly initialize lockdep in  rt_mutex_init_proxy_locked Peter Zijlstra <peterz@infradead.org> - 2017-06-12 14:40 +0200

csiph-web