Merge tag 'for-linus-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw...
[linux-2.6-microblaze.git] / lib / test_lockup.c
index 0f81252..864554e 100644 (file)
@@ -480,6 +480,21 @@ static int __init test_lockup_init(void)
                return -EINVAL;
 
 #ifdef CONFIG_DEBUG_SPINLOCK
+#ifdef CONFIG_PREEMPT_RT
+       if (test_magic(lock_spinlock_ptr,
+                      offsetof(spinlock_t, lock.wait_lock.magic),
+                      SPINLOCK_MAGIC) ||
+           test_magic(lock_rwlock_ptr,
+                      offsetof(rwlock_t, rtmutex.wait_lock.magic),
+                      SPINLOCK_MAGIC) ||
+           test_magic(lock_mutex_ptr,
+                      offsetof(struct mutex, lock.wait_lock.magic),
+                      SPINLOCK_MAGIC) ||
+           test_magic(lock_rwsem_ptr,
+                      offsetof(struct rw_semaphore, rtmutex.wait_lock.magic),
+                      SPINLOCK_MAGIC))
+               return -EINVAL;
+#else
        if (test_magic(lock_spinlock_ptr,
                       offsetof(spinlock_t, rlock.magic),
                       SPINLOCK_MAGIC) ||
@@ -493,6 +508,7 @@ static int __init test_lockup_init(void)
                       offsetof(struct rw_semaphore, wait_lock.magic),
                       SPINLOCK_MAGIC))
                return -EINVAL;
+#endif
 #endif
 
        if ((wait_state != TASK_RUNNING ||
@@ -512,8 +528,8 @@ static int __init test_lockup_init(void)
        if (test_file_path[0]) {
                test_file = filp_open(test_file_path, O_RDONLY, 0);
                if (IS_ERR(test_file)) {
-                       pr_err("cannot find file_path\n");
-                       return -EINVAL;
+                       pr_err("failed to open %s: %ld\n", test_file_path, PTR_ERR(test_file));
+                       return PTR_ERR(test_file);
                }
                test_inode = file_inode(test_file);
        } else if (test_lock_inode ||