[PATCH 4/5] ww-mutex-nested

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 24 11:15:52 UTC 2020


---
 include/linux/ww_mutex.h | 6 ++++++
 kernel/locking/mutex.c   | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
index d7554252404c..5ef97c5284da 100644
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -331,6 +331,12 @@ ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
 	return ww_mutex_lock_interruptible(lock, ctx);
 }
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+void ww_mutex_lock_nested(struct ww_mutex *lock, int subclass);
+#else
+# define ww_mutex_lock_nested(lock, subclass) ww_mutex_lock(lock, NULL)
+#endif
+
 extern void ww_mutex_unlock(struct ww_mutex *lock);
 
 /**
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 5352ce50a97e..cfb060cca3ca 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -1197,6 +1197,15 @@ ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
 }
 EXPORT_SYMBOL_GPL(ww_mutex_lock);
 
+void __sched
+ww_mutex_lock_nested(struct ww_mutex *lock, int subclass)
+{
+	might_sleep();
+	__ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE,
+			subclass, NULL, _RET_IP_, NULL);
+}
+EXPORT_SYMBOL_GPL(ww_mutex_lock_nested);
+
 int __sched
 ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
 {
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list