All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] lockdep: finer-grained completion key for kthread
@ 2017-11-28 17:07 Daniel Vetter
  2017-11-28 17:07 ` [PATCH 2/2] lockdep: Up MAX_LOCKDEP_CHAINS Daniel Vetter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel Vetter @ 2017-11-28 17:07 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

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@intel.com>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=103950
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-29  8:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 17:07 [PATCH 1/2] lockdep: finer-grained completion key for kthread Daniel Vetter
2017-11-28 17:07 ` [PATCH 2/2] lockdep: Up MAX_LOCKDEP_CHAINS Daniel Vetter
2017-11-28 17:22   ` Chris Wilson
2017-11-29  8:02     ` Daniel Vetter
2017-11-28 18:24 ` ✓ Fi.CI.BAT: success for series starting with [1/2] lockdep: finer-grained completion key for kthread Patchwork
2017-11-29  8:15 ` ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.