* [PATCH 1/2] lockdep: Markup callers of might_lock() as potential sleepers
@ 2016-12-11 17:52 Chris Wilson
  2016-12-11 17:52 ` [PATCH 2/2] kref: Annotate kref_put_mutex() with might_lock() Chris Wilson
  2016-12-11 18:21 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] lockdep: Markup callers of might_lock() as potential sleepers Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2016-12-11 17:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peter Zijlstra, intel-gfx, Ingo Molnar
If might_lock() is called on a mutex, it may also potentially sleep.
Call might_sleep() in this case so that the caller is checked for both.
This is similar to the might_sleep() that is checked by the real
mutex_lock().
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
---
 include/linux/lockdep.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index c1458fede1f9..0341e4246d00 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -549,9 +549,13 @@ static inline void print_irqtrace_events(struct task_struct *curr)
 #define lock_map_acquire_tryread(l)		lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_)
 #define lock_map_release(l)			lock_release(l, 1, _THIS_IP_)
 
+#define lock_is_mutex(lock) \
+	__builtin_types_compatible_p(typeof(*lock), struct mutex)
+
 #ifdef CONFIG_PROVE_LOCKING
 # define might_lock(lock) 						\
 do {									\
+	might_sleep_if(lock_is_mutex(lock));				\
 	typecheck(struct lockdep_map *, &(lock)->dep_map);		\
 	lock_acquire(&(lock)->dep_map, 0, 0, 0, 1, NULL, _THIS_IP_);	\
 	lock_release(&(lock)->dep_map, 0, _THIS_IP_);			\
@@ -563,7 +567,9 @@ do {									\
 	lock_release(&(lock)->dep_map, 0, _THIS_IP_);			\
 } while (0)
 #else
-# define might_lock(lock) do { } while (0)
+# define might_lock(lock) do {						\
+	might_sleep_if(lock_is_mutex(lock));				\
+} while (0)
 # define might_lock_read(lock) do { } while (0)
 #endif
 
-- 
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH 2/2] kref: Annotate kref_put_mutex() with might_lock()
  2016-12-11 17:52 [PATCH 1/2] lockdep: Markup callers of might_lock() as potential sleepers Chris Wilson
@ 2016-12-11 17:52 ` Chris Wilson
  2016-12-11 18:21 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] lockdep: Markup callers of might_lock() as potential sleepers Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2016-12-11 17:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peter Zijlstra, intel-gfx
As kref_put_mutex() may take the mutex (on the final unreference), mark
it up with might_lock() so that the caller is unconditionally checked by
lockdep.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 include/linux/kref.h | 1 +
 1 file changed, 1 insertion(+)
diff --git a/include/linux/kref.h b/include/linux/kref.h
index e15828fd71f1..f55b73674bfb 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -102,6 +102,7 @@ static inline int kref_put_mutex(struct kref *kref,
 				 void (*release)(struct kref *kref),
 				 struct mutex *lock)
 {
+	might_lock(lock);
 	WARN_ON(release == NULL);
 	if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) {
 		mutex_lock(lock);
-- 
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related	[flat|nested] 3+ messages in thread
* ✗ Fi.CI.BAT: failure for series starting with [1/2] lockdep: Markup callers of might_lock() as potential sleepers
  2016-12-11 17:52 [PATCH 1/2] lockdep: Markup callers of might_lock() as potential sleepers Chris Wilson
  2016-12-11 17:52 ` [PATCH 2/2] kref: Annotate kref_put_mutex() with might_lock() Chris Wilson
@ 2016-12-11 18:21 ` Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2016-12-11 18:21 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] lockdep: Markup callers of might_lock() as potential sleepers
URL   : https://patchwork.freedesktop.org/series/16667/
State : failure
== Summary ==
Series 16667v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/16667/revisions/1/mbox/
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> INCOMPLETE (fi-hsw-4770)
fi-bdw-5557u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:247  pass:208  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-t5700     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-j1900     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:6    pass:5    dwarn:0   dfail:0   fail:0   skip:0  
fi-hsw-4770r     total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-ilk-650       total:247  pass:195  dwarn:0   dfail:0   fail:0   skip:52 
fi-ivb-3520m     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:247  pass:224  dwarn:3   dfail:0   fail:0   skip:20 
fi-skl-6770hq    total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2600      total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 
f6a248e2507f98d7eb1f4fec8cfcbf685a33d289 drm-tip: 2016y-12m-10d-21h-47m-23s UTC integration manifest
d7d747e kref: Annotate kref_put_mutex() with might_lock()
f8c9434 lockdep: Markup callers of might_lock() as potential sleepers
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3263/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply	[flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-11 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-11 17:52 [PATCH 1/2] lockdep: Markup callers of might_lock() as potential sleepers Chris Wilson
2016-12-11 17:52 ` [PATCH 2/2] kref: Annotate kref_put_mutex() with might_lock() Chris Wilson
2016-12-11 18:21 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] lockdep: Markup callers of might_lock() as potential sleepers Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).