Commit 25139409 authored by Michael Ellerman's avatar Michael Ellerman Committed by Ingo Molnar

locking/selftest: Fix output since KERN_CONT changes

Since the KERN_CONT changes the locking-selftest output is messed up, eg:

  ----------------------------------------------------------------------------
                                   | spin |wlock |rlock |mutex | wsem | rsem |
    --------------------------------------------------------------------------
                       A-A deadlock:
    ok  |
    ok  |
    ok  |
    ok  |
    ok  |
    ok  |

Use pr_cont() to get it looking normal again:

  ----------------------------------------------------------------------------
                                   | spin |wlock |rlock |mutex | wsem | rsem |
    --------------------------------------------------------------------------
                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
Reported-by: default avatarChristian Kujau <lists@nerdbynature.de>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linuxppc-dev@ozlabs.org
Link: http://lkml.kernel.org/r/1480027528-934-1-git-send-email-mpe@ellerman.id.auSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 10b9dd56
...@@ -980,23 +980,23 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask) ...@@ -980,23 +980,23 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask)
#ifndef CONFIG_PROVE_LOCKING #ifndef CONFIG_PROVE_LOCKING
if (expected == FAILURE && debug_locks) { if (expected == FAILURE && debug_locks) {
expected_testcase_failures++; expected_testcase_failures++;
printk("failed|"); pr_cont("failed|");
} }
else else
#endif #endif
if (debug_locks != expected) { if (debug_locks != expected) {
unexpected_testcase_failures++; unexpected_testcase_failures++;
printk("FAILED|"); pr_cont("FAILED|");
dump_stack(); dump_stack();
} else { } else {
testcase_successes++; testcase_successes++;
printk(" ok |"); pr_cont(" ok |");
} }
testcase_total++; testcase_total++;
if (debug_locks_verbose) if (debug_locks_verbose)
printk(" lockclass mask: %x, debug_locks: %d, expected: %d\n", pr_cont(" lockclass mask: %x, debug_locks: %d, expected: %d\n",
lockclass_mask, debug_locks, expected); lockclass_mask, debug_locks, expected);
/* /*
* Some tests (e.g. double-unlock) might corrupt the preemption * Some tests (e.g. double-unlock) might corrupt the preemption
...@@ -1021,26 +1021,26 @@ static inline void print_testname(const char *testname) ...@@ -1021,26 +1021,26 @@ static inline void print_testname(const char *testname)
#define DO_TESTCASE_1(desc, name, nr) \ #define DO_TESTCASE_1(desc, name, nr) \
print_testname(desc"/"#nr); \ print_testname(desc"/"#nr); \
dotest(name##_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ dotest(name##_##nr, SUCCESS, LOCKTYPE_RWLOCK); \
printk("\n"); pr_cont("\n");
#define DO_TESTCASE_1B(desc, name, nr) \ #define DO_TESTCASE_1B(desc, name, nr) \
print_testname(desc"/"#nr); \ print_testname(desc"/"#nr); \
dotest(name##_##nr, FAILURE, LOCKTYPE_RWLOCK); \ dotest(name##_##nr, FAILURE, LOCKTYPE_RWLOCK); \
printk("\n"); pr_cont("\n");
#define DO_TESTCASE_3(desc, name, nr) \ #define DO_TESTCASE_3(desc, name, nr) \
print_testname(desc"/"#nr); \ print_testname(desc"/"#nr); \
dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN); \ dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN); \
dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \
dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \
printk("\n"); pr_cont("\n");
#define DO_TESTCASE_3RW(desc, name, nr) \ #define DO_TESTCASE_3RW(desc, name, nr) \
print_testname(desc"/"#nr); \ print_testname(desc"/"#nr); \
dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN|LOCKTYPE_RWLOCK);\ dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN|LOCKTYPE_RWLOCK);\
dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \
dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \
printk("\n"); pr_cont("\n");
#define DO_TESTCASE_6(desc, name) \ #define DO_TESTCASE_6(desc, name) \
print_testname(desc); \ print_testname(desc); \
...@@ -1050,7 +1050,7 @@ static inline void print_testname(const char *testname) ...@@ -1050,7 +1050,7 @@ static inline void print_testname(const char *testname)
dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \ dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \
dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \ dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \
dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \ dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \
printk("\n"); pr_cont("\n");
#define DO_TESTCASE_6_SUCCESS(desc, name) \ #define DO_TESTCASE_6_SUCCESS(desc, name) \
print_testname(desc); \ print_testname(desc); \
...@@ -1060,7 +1060,7 @@ static inline void print_testname(const char *testname) ...@@ -1060,7 +1060,7 @@ static inline void print_testname(const char *testname)
dotest(name##_mutex, SUCCESS, LOCKTYPE_MUTEX); \ dotest(name##_mutex, SUCCESS, LOCKTYPE_MUTEX); \
dotest(name##_wsem, SUCCESS, LOCKTYPE_RWSEM); \ dotest(name##_wsem, SUCCESS, LOCKTYPE_RWSEM); \
dotest(name##_rsem, SUCCESS, LOCKTYPE_RWSEM); \ dotest(name##_rsem, SUCCESS, LOCKTYPE_RWSEM); \
printk("\n"); pr_cont("\n");
/* /*
* 'read' variant: rlocks must not trigger. * 'read' variant: rlocks must not trigger.
...@@ -1073,7 +1073,7 @@ static inline void print_testname(const char *testname) ...@@ -1073,7 +1073,7 @@ static inline void print_testname(const char *testname)
dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \ dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \
dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \ dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \
dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \ dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \
printk("\n"); pr_cont("\n");
#define DO_TESTCASE_2I(desc, name, nr) \ #define DO_TESTCASE_2I(desc, name, nr) \
DO_TESTCASE_1("hard-"desc, name##_hard, nr); \ DO_TESTCASE_1("hard-"desc, name##_hard, nr); \
...@@ -1726,25 +1726,25 @@ static void ww_tests(void) ...@@ -1726,25 +1726,25 @@ static void ww_tests(void)
dotest(ww_test_fail_acquire, SUCCESS, LOCKTYPE_WW); dotest(ww_test_fail_acquire, SUCCESS, LOCKTYPE_WW);
dotest(ww_test_normal, SUCCESS, LOCKTYPE_WW); dotest(ww_test_normal, SUCCESS, LOCKTYPE_WW);
dotest(ww_test_unneeded_slow, FAILURE, LOCKTYPE_WW); dotest(ww_test_unneeded_slow, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("ww contexts mixing"); print_testname("ww contexts mixing");
dotest(ww_test_two_contexts, FAILURE, LOCKTYPE_WW); dotest(ww_test_two_contexts, FAILURE, LOCKTYPE_WW);
dotest(ww_test_diff_class, FAILURE, LOCKTYPE_WW); dotest(ww_test_diff_class, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("finishing ww context"); print_testname("finishing ww context");
dotest(ww_test_context_done_twice, FAILURE, LOCKTYPE_WW); dotest(ww_test_context_done_twice, FAILURE, LOCKTYPE_WW);
dotest(ww_test_context_unlock_twice, FAILURE, LOCKTYPE_WW); dotest(ww_test_context_unlock_twice, FAILURE, LOCKTYPE_WW);
dotest(ww_test_context_fini_early, FAILURE, LOCKTYPE_WW); dotest(ww_test_context_fini_early, FAILURE, LOCKTYPE_WW);
dotest(ww_test_context_lock_after_done, FAILURE, LOCKTYPE_WW); dotest(ww_test_context_lock_after_done, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("locking mismatches"); print_testname("locking mismatches");
dotest(ww_test_object_unlock_twice, FAILURE, LOCKTYPE_WW); dotest(ww_test_object_unlock_twice, FAILURE, LOCKTYPE_WW);
dotest(ww_test_object_lock_unbalanced, FAILURE, LOCKTYPE_WW); dotest(ww_test_object_lock_unbalanced, FAILURE, LOCKTYPE_WW);
dotest(ww_test_object_lock_stale_context, FAILURE, LOCKTYPE_WW); dotest(ww_test_object_lock_stale_context, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("EDEADLK handling"); print_testname("EDEADLK handling");
dotest(ww_test_edeadlk_normal, SUCCESS, LOCKTYPE_WW); dotest(ww_test_edeadlk_normal, SUCCESS, LOCKTYPE_WW);
...@@ -1757,11 +1757,11 @@ static void ww_tests(void) ...@@ -1757,11 +1757,11 @@ static void ww_tests(void)
dotest(ww_test_edeadlk_acquire_more_edeadlk_slow, FAILURE, LOCKTYPE_WW); dotest(ww_test_edeadlk_acquire_more_edeadlk_slow, FAILURE, LOCKTYPE_WW);
dotest(ww_test_edeadlk_acquire_wrong, FAILURE, LOCKTYPE_WW); dotest(ww_test_edeadlk_acquire_wrong, FAILURE, LOCKTYPE_WW);
dotest(ww_test_edeadlk_acquire_wrong_slow, FAILURE, LOCKTYPE_WW); dotest(ww_test_edeadlk_acquire_wrong_slow, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("spinlock nest unlocked"); print_testname("spinlock nest unlocked");
dotest(ww_test_spin_nest_unlocked, FAILURE, LOCKTYPE_WW); dotest(ww_test_spin_nest_unlocked, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
printk(" -----------------------------------------------------\n"); printk(" -----------------------------------------------------\n");
printk(" |block | try |context|\n"); printk(" |block | try |context|\n");
...@@ -1771,25 +1771,25 @@ static void ww_tests(void) ...@@ -1771,25 +1771,25 @@ static void ww_tests(void)
dotest(ww_test_context_block, FAILURE, LOCKTYPE_WW); dotest(ww_test_context_block, FAILURE, LOCKTYPE_WW);
dotest(ww_test_context_try, SUCCESS, LOCKTYPE_WW); dotest(ww_test_context_try, SUCCESS, LOCKTYPE_WW);
dotest(ww_test_context_context, SUCCESS, LOCKTYPE_WW); dotest(ww_test_context_context, SUCCESS, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("try"); print_testname("try");
dotest(ww_test_try_block, FAILURE, LOCKTYPE_WW); dotest(ww_test_try_block, FAILURE, LOCKTYPE_WW);
dotest(ww_test_try_try, SUCCESS, LOCKTYPE_WW); dotest(ww_test_try_try, SUCCESS, LOCKTYPE_WW);
dotest(ww_test_try_context, FAILURE, LOCKTYPE_WW); dotest(ww_test_try_context, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("block"); print_testname("block");
dotest(ww_test_block_block, FAILURE, LOCKTYPE_WW); dotest(ww_test_block_block, FAILURE, LOCKTYPE_WW);
dotest(ww_test_block_try, SUCCESS, LOCKTYPE_WW); dotest(ww_test_block_try, SUCCESS, LOCKTYPE_WW);
dotest(ww_test_block_context, FAILURE, LOCKTYPE_WW); dotest(ww_test_block_context, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
print_testname("spinlock"); print_testname("spinlock");
dotest(ww_test_spin_block, FAILURE, LOCKTYPE_WW); dotest(ww_test_spin_block, FAILURE, LOCKTYPE_WW);
dotest(ww_test_spin_try, SUCCESS, LOCKTYPE_WW); dotest(ww_test_spin_try, SUCCESS, LOCKTYPE_WW);
dotest(ww_test_spin_context, FAILURE, LOCKTYPE_WW); dotest(ww_test_spin_context, FAILURE, LOCKTYPE_WW);
printk("\n"); pr_cont("\n");
} }
void locking_selftest(void) void locking_selftest(void)
...@@ -1829,32 +1829,32 @@ void locking_selftest(void) ...@@ -1829,32 +1829,32 @@ void locking_selftest(void)
printk(" --------------------------------------------------------------------------\n"); printk(" --------------------------------------------------------------------------\n");
print_testname("recursive read-lock"); print_testname("recursive read-lock");
printk(" |"); pr_cont(" |");
dotest(rlock_AA1, SUCCESS, LOCKTYPE_RWLOCK); dotest(rlock_AA1, SUCCESS, LOCKTYPE_RWLOCK);
printk(" |"); pr_cont(" |");
dotest(rsem_AA1, FAILURE, LOCKTYPE_RWSEM); dotest(rsem_AA1, FAILURE, LOCKTYPE_RWSEM);
printk("\n"); pr_cont("\n");
print_testname("recursive read-lock #2"); print_testname("recursive read-lock #2");
printk(" |"); pr_cont(" |");
dotest(rlock_AA1B, SUCCESS, LOCKTYPE_RWLOCK); dotest(rlock_AA1B, SUCCESS, LOCKTYPE_RWLOCK);
printk(" |"); pr_cont(" |");
dotest(rsem_AA1B, FAILURE, LOCKTYPE_RWSEM); dotest(rsem_AA1B, FAILURE, LOCKTYPE_RWSEM);
printk("\n"); pr_cont("\n");
print_testname("mixed read-write-lock"); print_testname("mixed read-write-lock");
printk(" |"); pr_cont(" |");
dotest(rlock_AA2, FAILURE, LOCKTYPE_RWLOCK); dotest(rlock_AA2, FAILURE, LOCKTYPE_RWLOCK);
printk(" |"); pr_cont(" |");
dotest(rsem_AA2, FAILURE, LOCKTYPE_RWSEM); dotest(rsem_AA2, FAILURE, LOCKTYPE_RWSEM);
printk("\n"); pr_cont("\n");
print_testname("mixed write-read-lock"); print_testname("mixed write-read-lock");
printk(" |"); pr_cont(" |");
dotest(rlock_AA3, FAILURE, LOCKTYPE_RWLOCK); dotest(rlock_AA3, FAILURE, LOCKTYPE_RWLOCK);
printk(" |"); pr_cont(" |");
dotest(rsem_AA3, FAILURE, LOCKTYPE_RWSEM); dotest(rsem_AA3, FAILURE, LOCKTYPE_RWSEM);
printk("\n"); pr_cont("\n");
printk(" --------------------------------------------------------------------------\n"); printk(" --------------------------------------------------------------------------\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment