lkml.org 
[lkml]   [2018]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 25/27] locking/lockdep: Add support for dynamic keys
From
Date
On Thu, 2018-11-29 at 13:04 +0100, Peter Zijlstra wrote:
> On Wed, Nov 28, 2018 at 03:43:23PM -0800, Bart Van Assche wrote:
> > A shortcoming of the current lockdep implementation is that it requires
> > lock keys to be allocated statically. That forces certain lock objects
> > to share lock keys. Since lock dependency analysis groups lock objects
> > per key sharing lock keys can cause false positive lockdep reports.
> > Make it possible to avoid such false positive reports by allowing lock
> > keys to be allocated dynamically. Require that dynamically allocated
> > lock keys are registered before use by calling lockdep_register_key().
> > Complain about attempts to register the same lock key pointer twice
> > without calling lockdep_unregister_key() between successive
> > registration calls.
> > struct lock_class_key {
> > + struct hlist_node hash_entry;
> > struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
> > };
>
> That hash_entry is purely for that double-register warning, right? I
> wonder if we can do that differently; by always doing
> register_lock_class(), and checking that state.

Hi Peter,

The hash_entry serves two purposes. One purpose is to verify whether the
lockdep_register_key() and lockdep_unregister_key() functions are used
correctly. A second purpose is to avoid that lockdep_init_map() complains
when encountering a dynamically allocated key. I'm not sure how always
doing register_lock_class() would help?

Thanks,

Bart.

\
 
 \ /
  Last update: 2018-11-29 18:00    [W:0.106 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site