Skip to contentSkip to conversation

lockdep: finer-grained completion key for kthread

PATCH New Daniel Vetter 2 participants 2 messages Nov 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lockdep: finer-grained completion key for kthread

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.

---
 kernel/kthread.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
kernel/kthread.c +13 -0
index cd50e99202b0..ef2956516803 100644
@@ -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;
+	/* these two completions are shared with all kthread, which is bonghist
+	 * imo */
+	lockdep_init_map_crosslock(&self->exited->map,
+			"(kthread completion)->exited",
+			&self->exited_key, 0);
 	init_completion(&self->exited);
+	lockdep_init_map_crosslock(&self->parked->map,
+			"(kthread completion)->parked",
+			&self->parked_key, 0);
 	init_completion(&self->parked);
+
 	current->vfork_done = &self->exited;
 
 	/* OK, tell user we're spawned, wait for stop or wakeup */
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for lockdep: finer-grained completion key for kthread

== Series Details ==

== Series Details ==

Series: lockdep: finer-grained completion key for kthread
URL : https://patchwork.freedesktop.org/series/34547/
State : failure

== Summary ==

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  DESCEND  objtool
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CC      kernel/kthread.o
kernel/kthread.c: In function ‘kthread’:
kernel/kthread.c:230:42: error: invalid type argument of ‘->’ (have ‘struct completion’)
  lockdep_init_map_crosslock(&self->exited->map,
                                          ^~
kernel/kthread.c:234:42: error: invalid type argument of ‘->’ (have ‘struct completion’)
  lockdep_init_map_crosslock(&self->parked->map,
                                          ^~

scripts/Makefile.build:310: recipe for target 'kernel/kthread.o' failed make[1]: *** [kernel/kthread.o] Error 1
Makefile:1012: recipe for target 'kernel' failed
make: *** [kernel] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx