Ideally we'd create the key through a macro at the real callers and pass it all the way down. This would give us better coverage for cases where a bunch of kthreads are created for the same thing. But this gets the job done meanwhile and unblocks our CI. Refining later on is always possible. v2: - make it compile - use the right map (Tvrtko) Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Cc: Marta Lofstedt <marta.lofstedt@xxxxxxxxx> References: https://bugs.freedesktop.org/show_bug.cgi?id=103950 Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx> --- kernel/kthread.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/kernel/kthread.c b/kernel/kthread.c index cd50e99202b0..8df5fedb9529 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -44,6 +44,10 @@ struct kthread { unsigned long flags; unsigned int cpu; void *data; +#ifdef CONFIG_LOCKDEP_COMPLETIONS + struct lock_class_key parked_key; + struct lock_class_key exited_key; +#endif struct completion parked; struct completion exited; #ifdef CONFIG_BLK_CGROUP @@ -221,8 +225,17 @@ static int kthread(void *_create) } self->data = data; - init_completion(&self->exited); - init_completion(&self->parked); + /* these two completions are shared with all kthread, which is bonghist + * imo */ + lockdep_init_map_crosslock(&self->exited.map.map, + "(kthread completion)->exited", + &self->exited_key, 0); + init_completion_map(&self->exited, &self->exited.map.map); + lockdep_init_map_crosslock(&self->parked.map.map, + "(kthread completion)->parked", + &self->parked_key, 0); + init_completion_map(&self->parked, &self->exited.map.map); + current->vfork_done = &self->exited; /* OK, tell user we're spawned, wait for stop or wakeup */ -- 2.15.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx