diff --git a/include/evl/thread.h b/include/evl/thread.h index 1c2e4a269ebe39..1164962cdc7223 100644 --- a/include/evl/thread.h +++ b/include/evl/thread.h @@ -63,6 +63,7 @@ struct evl_init_thread_attr { struct evl_thread { hard_spinlock_t lock; + struct lock_class_key lock_key; /* lockdep disambiguation */ /* * Shared thread-specific data, covered by ->lock. diff --git a/kernel/evl/thread.c b/kernel/evl/thread.c index 1c5bfe12d231cb..76d7e8eaad7d79 100644 --- a/kernel/evl/thread.c +++ b/kernel/evl/thread.c @@ -224,7 +224,6 @@ int evl_init_thread(struct evl_thread *thread, INIT_LIST_HEAD(&thread->boosters); INIT_LIST_HEAD(&thread->owned_mutexes); raw_spin_lock_init(&thread->lock); - might_hard_lock(&thread->lock); init_completion(&thread->exited); INIT_LIST_HEAD(&thread->ptsync_next); thread->oob_mm = NULL; @@ -247,6 +246,18 @@ int evl_init_thread(struct evl_thread *thread, if (ret) goto err_out; +#ifdef CONFIG_LOCKDEP + if (state & EVL_T_ROOT) { + lockdep_set_class_and_name(&thread->lock, &rq->root_lock_key, + thread->name); + } else { + lockdep_register_key(&thread->lock_key); + lockdep_set_class_and_name(&thread->lock, &thread->lock_key, + thread->name); + } + might_hard_lock(&thread->lock); +#endif + trace_evl_init_thread(thread, iattr, ret); return 0; @@ -282,6 +293,9 @@ static void uninit_thread(struct evl_thread *thread) evl_forget_thread(thread); evl_put_thread_rq(thread, rq, flags); + if (!(thread->state & EVL_T_ROOT)) + lockdep_unregister_key(&thread->lock_key); + kfree(thread->name); }