lkml.org 
[lkml]   [2018]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 25/27] locking/lockdep: Add support for dynamic keys
    On Wed, Nov 28, 2018 at 03:43:23PM -0800, Bart Van Assche wrote:
    > +/* hash_entry is used to keep track of dynamically allocated keys. */
    > struct lock_class_key {
    > + struct hlist_node hash_entry;
    > struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
    > };

    One consideration; and maybe we should have a BUILD_BUG for that, is
    that this object should be no larger than the smallest lock primitive.

    That typically is raw_spinlock_t, which normally is 4 bytes, but with
    lockdep on that at least also includes struct lockdep_map.

    So what we want is:

    sizeof(lock_class_key) <= sizeof(raw_spinlock_t)

    Otherwise, two consecutive spinlocks could end up with key overlap in
    their subclass range.

    Now, I think that is still valid after this patch, but it is something
    that gave me pause.

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