diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-07 14:27:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-07 14:27:33 -0500 |
commit | 5b43f97f3f21c42ba738df2797930e32e05d5a25 (patch) | |
tree | 8d2b757f710c5bc19e6ddcecfc99f6b6706e9976 /lib | |
parent | 407cf05d46fe59e2becfad3a55387d172f6fd0d0 (diff) | |
parent | f943fe0faf27991d256e10b5a85f175385c64cdc (diff) |
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Ingo Molnar:
"Two rtmutex race fixes (which miraculously never triggered, that we
know of), plus two lockdep printk formatting regression fixes"
* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
lockdep: Fix report formatting
locking/rtmutex: Use READ_ONCE() in rt_mutex_owner()
locking/rtmutex: Prevent dequeue vs. unlock race
locking/selftest: Fix output since KERN_CONT changes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locking-selftest.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index 872a15a2a637..f3a217ea0388 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c | |||
@@ -980,23 +980,23 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask) | |||
980 | #ifndef CONFIG_PROVE_LOCKING | 980 | #ifndef CONFIG_PROVE_LOCKING |
981 | if (expected == FAILURE && debug_locks) { | 981 | if (expected == FAILURE && debug_locks) { |
982 | expected_testcase_failures++; | 982 | expected_testcase_failures++; |
983 | printk("failed|"); | 983 | pr_cont("failed|"); |
984 | } | 984 | } |
985 | else | 985 | else |
986 | #endif | 986 | #endif |
987 | if (debug_locks != expected) { | 987 | if (debug_locks != expected) { |
988 | unexpected_testcase_failures++; | 988 | unexpected_testcase_failures++; |
989 | printk("FAILED|"); | 989 | pr_cont("FAILED|"); |
990 | 990 | ||
991 | dump_stack(); | 991 | dump_stack(); |
992 | } else { | 992 | } else { |
993 | testcase_successes++; | 993 | testcase_successes++; |
994 | printk(" ok |"); | 994 | pr_cont(" ok |"); |
995 | } | 995 | } |
996 | testcase_total++; | 996 | testcase_total++; |
997 | 997 | ||
998 | if (debug_locks_verbose) | 998 | if (debug_locks_verbose) |
999 | printk(" lockclass mask: %x, debug_locks: %d, expected: %d\n", | 999 | pr_cont(" lockclass mask: %x, debug_locks: %d, expected: %d\n", |
1000 | lockclass_mask, debug_locks, expected); | 1000 | lockclass_mask, debug_locks, expected); |
1001 | /* | 1001 | /* |
1002 | * Some tests (e.g. double-unlock) might corrupt the preemption | 1002 | * Some tests (e.g. double-unlock) might corrupt the preemption |
@@ -1021,26 +1021,26 @@ static inline void print_testname(const char *testname) | |||
1021 | #define DO_TESTCASE_1(desc, name, nr) \ | 1021 | #define DO_TESTCASE_1(desc, name, nr) \ |
1022 | print_testname(desc"/"#nr); \ | 1022 | print_testname(desc"/"#nr); \ |
1023 | dotest(name##_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ | 1023 | dotest(name##_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ |
1024 | printk("\n"); | 1024 | pr_cont("\n"); |
1025 | 1025 | ||
1026 | #define DO_TESTCASE_1B(desc, name, nr) \ | 1026 | #define DO_TESTCASE_1B(desc, name, nr) \ |
1027 | print_testname(desc"/"#nr); \ | 1027 | print_testname(desc"/"#nr); \ |
1028 | dotest(name##_##nr, FAILURE, LOCKTYPE_RWLOCK); \ | 1028 | dotest(name##_##nr, FAILURE, LOCKTYPE_RWLOCK); \ |
1029 | printk("\n"); | 1029 | pr_cont("\n"); |
1030 | 1030 | ||
1031 | #define DO_TESTCASE_3(desc, name, nr) \ | 1031 | #define DO_TESTCASE_3(desc, name, nr) \ |
1032 | print_testname(desc"/"#nr); \ | 1032 | print_testname(desc"/"#nr); \ |
1033 | dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN); \ | 1033 | dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN); \ |
1034 | dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ | 1034 | dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ |
1035 | dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ | 1035 | dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ |
1036 | printk("\n"); | 1036 | pr_cont("\n"); |
1037 | 1037 | ||
1038 | #define DO_TESTCASE_3RW(desc, name, nr) \ | 1038 | #define DO_TESTCASE_3RW(desc, name, nr) \ |
1039 | print_testname(desc"/"#nr); \ | 1039 | print_testname(desc"/"#nr); \ |
1040 | dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN|LOCKTYPE_RWLOCK);\ | 1040 | dotest(name##_spin_##nr, FAILURE, LOCKTYPE_SPIN|LOCKTYPE_RWLOCK);\ |
1041 | dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ | 1041 | dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ |
1042 | dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ | 1042 | dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ |
1043 | printk("\n"); | 1043 | pr_cont("\n"); |
1044 | 1044 | ||
1045 | #define DO_TESTCASE_6(desc, name) \ | 1045 | #define DO_TESTCASE_6(desc, name) \ |
1046 | print_testname(desc); \ | 1046 | print_testname(desc); \ |
@@ -1050,7 +1050,7 @@ static inline void print_testname(const char *testname) | |||
1050 | dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \ | 1050 | dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \ |
1051 | dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \ | 1051 | dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \ |
1052 | dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \ | 1052 | dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \ |
1053 | printk("\n"); | 1053 | pr_cont("\n"); |
1054 | 1054 | ||
1055 | #define DO_TESTCASE_6_SUCCESS(desc, name) \ | 1055 | #define DO_TESTCASE_6_SUCCESS(desc, name) \ |
1056 | print_testname(desc); \ | 1056 | print_testname(desc); \ |
@@ -1060,7 +1060,7 @@ static inline void print_testname(const char *testname) | |||
1060 | dotest(name##_mutex, SUCCESS, LOCKTYPE_MUTEX); \ | 1060 | dotest(name##_mutex, SUCCESS, LOCKTYPE_MUTEX); \ |
1061 | dotest(name##_wsem, SUCCESS, LOCKTYPE_RWSEM); \ | 1061 | dotest(name##_wsem, SUCCESS, LOCKTYPE_RWSEM); \ |
1062 | dotest(name##_rsem, SUCCESS, LOCKTYPE_RWSEM); \ | 1062 | dotest(name##_rsem, SUCCESS, LOCKTYPE_RWSEM); \ |
1063 | printk("\n"); | 1063 | pr_cont("\n"); |
1064 | 1064 | ||
1065 | /* | 1065 | /* |
1066 | * 'read' variant: rlocks must not trigger. | 1066 | * 'read' variant: rlocks must not trigger. |
@@ -1073,7 +1073,7 @@ static inline void print_testname(const char *testname) | |||
1073 | dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \ | 1073 | dotest(name##_mutex, FAILURE, LOCKTYPE_MUTEX); \ |
1074 | dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \ | 1074 | dotest(name##_wsem, FAILURE, LOCKTYPE_RWSEM); \ |
1075 | dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \ | 1075 | dotest(name##_rsem, FAILURE, LOCKTYPE_RWSEM); \ |
1076 | printk("\n"); | 1076 | pr_cont("\n"); |
1077 | 1077 | ||
1078 | #define DO_TESTCASE_2I(desc, name, nr) \ | 1078 | #define DO_TESTCASE_2I(desc, name, nr) \ |
1079 | DO_TESTCASE_1("hard-"desc, name##_hard, nr); \ | 1079 | DO_TESTCASE_1("hard-"desc, name##_hard, nr); \ |
@@ -1726,25 +1726,25 @@ static void ww_tests(void) | |||
1726 | dotest(ww_test_fail_acquire, SUCCESS, LOCKTYPE_WW); | 1726 | dotest(ww_test_fail_acquire, SUCCESS, LOCKTYPE_WW); |
1727 | dotest(ww_test_normal, SUCCESS, LOCKTYPE_WW); | 1727 | dotest(ww_test_normal, SUCCESS, LOCKTYPE_WW); |
1728 | dotest(ww_test_unneeded_slow, FAILURE, LOCKTYPE_WW); | 1728 | dotest(ww_test_unneeded_slow, FAILURE, LOCKTYPE_WW); |
1729 | printk("\n"); | 1729 | pr_cont("\n"); |
1730 | 1730 | ||
1731 | print_testname("ww contexts mixing"); | 1731 | print_testname("ww contexts mixing"); |
1732 | dotest(ww_test_two_contexts, FAILURE, LOCKTYPE_WW); | 1732 | dotest(ww_test_two_contexts, FAILURE, LOCKTYPE_WW); |
1733 | dotest(ww_test_diff_class, FAILURE, LOCKTYPE_WW); | 1733 | dotest(ww_test_diff_class, FAILURE, LOCKTYPE_WW); |
1734 | printk("\n"); | 1734 | pr_cont("\n"); |
1735 | 1735 | ||
1736 | print_testname("finishing ww context"); | 1736 | print_testname("finishing ww context"); |
1737 | dotest(ww_test_context_done_twice, FAILURE, LOCKTYPE_WW); | 1737 | dotest(ww_test_context_done_twice, FAILURE, LOCKTYPE_WW); |
1738 | dotest(ww_test_context_unlock_twice, FAILURE, LOCKTYPE_WW); | 1738 | dotest(ww_test_context_unlock_twice, FAILURE, LOCKTYPE_WW); |
1739 | dotest(ww_test_context_fini_early, FAILURE, LOCKTYPE_WW); | 1739 | dotest(ww_test_context_fini_early, FAILURE, LOCKTYPE_WW); |
1740 | dotest(ww_test_context_lock_after_done, FAILURE, LOCKTYPE_WW); | 1740 | dotest(ww_test_context_lock_after_done, FAILURE, LOCKTYPE_WW); |
1741 | printk("\n"); | 1741 | pr_cont("\n"); |
1742 | 1742 | ||
1743 | print_testname("locking mismatches"); | 1743 | print_testname("locking mismatches"); |
1744 | dotest(ww_test_object_unlock_twice, FAILURE, LOCKTYPE_WW); | 1744 | dotest(ww_test_object_unlock_twice, FAILURE, LOCKTYPE_WW); |
1745 | dotest(ww_test_object_lock_unbalanced, FAILURE, LOCKTYPE_WW); | 1745 | dotest(ww_test_object_lock_unbalanced, FAILURE, LOCKTYPE_WW); |
1746 | dotest(ww_test_object_lock_stale_context, FAILURE, LOCKTYPE_WW); | 1746 | dotest(ww_test_object_lock_stale_context, FAILURE, LOCKTYPE_WW); |
1747 | printk("\n"); | 1747 | pr_cont("\n"); |
1748 | 1748 | ||
1749 | print_testname("EDEADLK handling"); | 1749 | print_testname("EDEADLK handling"); |
1750 | dotest(ww_test_edeadlk_normal, SUCCESS, LOCKTYPE_WW); | 1750 | dotest(ww_test_edeadlk_normal, SUCCESS, LOCKTYPE_WW); |
@@ -1757,11 +1757,11 @@ static void ww_tests(void) | |||
1757 | dotest(ww_test_edeadlk_acquire_more_edeadlk_slow, FAILURE, LOCKTYPE_WW); | 1757 | dotest(ww_test_edeadlk_acquire_more_edeadlk_slow, FAILURE, LOCKTYPE_WW); |
1758 | dotest(ww_test_edeadlk_acquire_wrong, FAILURE, LOCKTYPE_WW); | 1758 | dotest(ww_test_edeadlk_acquire_wrong, FAILURE, LOCKTYPE_WW); |
1759 | dotest(ww_test_edeadlk_acquire_wrong_slow, FAILURE, LOCKTYPE_WW); | 1759 | dotest(ww_test_edeadlk_acquire_wrong_slow, FAILURE, LOCKTYPE_WW); |
1760 | printk("\n"); | 1760 | pr_cont("\n"); |
1761 | 1761 | ||
1762 | print_testname("spinlock nest unlocked"); | 1762 | print_testname("spinlock nest unlocked"); |
1763 | dotest(ww_test_spin_nest_unlocked, FAILURE, LOCKTYPE_WW); | 1763 | dotest(ww_test_spin_nest_unlocked, FAILURE, LOCKTYPE_WW); |
1764 | printk("\n"); | 1764 | pr_cont("\n"); |
1765 | 1765 | ||
1766 | printk(" -----------------------------------------------------\n"); | 1766 | printk(" -----------------------------------------------------\n"); |
1767 | printk(" |block | try |context|\n"); | 1767 | printk(" |block | try |context|\n"); |
@@ -1771,25 +1771,25 @@ static void ww_tests(void) | |||
1771 | dotest(ww_test_context_block, FAILURE, LOCKTYPE_WW); | 1771 | dotest(ww_test_context_block, FAILURE, LOCKTYPE_WW); |
1772 | dotest(ww_test_context_try, SUCCESS, LOCKTYPE_WW); | 1772 | dotest(ww_test_context_try, SUCCESS, LOCKTYPE_WW); |
1773 | dotest(ww_test_context_context, SUCCESS, LOCKTYPE_WW); | 1773 | dotest(ww_test_context_context, SUCCESS, LOCKTYPE_WW); |
1774 | printk("\n"); | 1774 | pr_cont("\n"); |
1775 | 1775 | ||
1776 | print_testname("try"); | 1776 | print_testname("try"); |
1777 | dotest(ww_test_try_block, FAILURE, LOCKTYPE_WW); | 1777 | dotest(ww_test_try_block, FAILURE, LOCKTYPE_WW); |
1778 | dotest(ww_test_try_try, SUCCESS, LOCKTYPE_WW); | 1778 | dotest(ww_test_try_try, SUCCESS, LOCKTYPE_WW); |
1779 | dotest(ww_test_try_context, FAILURE, LOCKTYPE_WW); | 1779 | dotest(ww_test_try_context, FAILURE, LOCKTYPE_WW); |
1780 | printk("\n"); | 1780 | pr_cont("\n"); |
1781 | 1781 | ||
1782 | print_testname("block"); | 1782 | print_testname("block"); |
1783 | dotest(ww_test_block_block, FAILURE, LOCKTYPE_WW); | 1783 | dotest(ww_test_block_block, FAILURE, LOCKTYPE_WW); |
1784 | dotest(ww_test_block_try, SUCCESS, LOCKTYPE_WW); | 1784 | dotest(ww_test_block_try, SUCCESS, LOCKTYPE_WW); |
1785 | dotest(ww_test_block_context, FAILURE, LOCKTYPE_WW); | 1785 | dotest(ww_test_block_context, FAILURE, LOCKTYPE_WW); |
1786 | printk("\n"); | 1786 | pr_cont("\n"); |
1787 | 1787 | ||
1788 | print_testname("spinlock"); | 1788 | print_testname("spinlock"); |
1789 | dotest(ww_test_spin_block, FAILURE, LOCKTYPE_WW); | 1789 | dotest(ww_test_spin_block, FAILURE, LOCKTYPE_WW); |
1790 | dotest(ww_test_spin_try, SUCCESS, LOCKTYPE_WW); | 1790 | dotest(ww_test_spin_try, SUCCESS, LOCKTYPE_WW); |
1791 | dotest(ww_test_spin_context, FAILURE, LOCKTYPE_WW); | 1791 | dotest(ww_test_spin_context, FAILURE, LOCKTYPE_WW); |
1792 | printk("\n"); | 1792 | pr_cont("\n"); |
1793 | } | 1793 | } |
1794 | 1794 | ||
1795 | void locking_selftest(void) | 1795 | void locking_selftest(void) |
@@ -1829,32 +1829,32 @@ void locking_selftest(void) | |||
1829 | 1829 | ||
1830 | printk(" --------------------------------------------------------------------------\n"); | 1830 | printk(" --------------------------------------------------------------------------\n"); |
1831 | print_testname("recursive read-lock"); | 1831 | print_testname("recursive read-lock"); |
1832 | printk(" |"); | 1832 | pr_cont(" |"); |
1833 | dotest(rlock_AA1, SUCCESS, LOCKTYPE_RWLOCK); | 1833 | dotest(rlock_AA1, SUCCESS, LOCKTYPE_RWLOCK); |
1834 | printk(" |"); | 1834 | pr_cont(" |"); |
1835 | dotest(rsem_AA1, FAILURE, LOCKTYPE_RWSEM); | 1835 | dotest(rsem_AA1, FAILURE, LOCKTYPE_RWSEM); |
1836 | printk("\n"); | 1836 | pr_cont("\n"); |
1837 | 1837 | ||
1838 | print_testname("recursive read-lock #2"); | 1838 | print_testname("recursive read-lock #2"); |
1839 | printk(" |"); | 1839 | pr_cont(" |"); |
1840 | dotest(rlock_AA1B, SUCCESS, LOCKTYPE_RWLOCK); | 1840 | dotest(rlock_AA1B, SUCCESS, LOCKTYPE_RWLOCK); |
1841 | printk(" |"); | 1841 | pr_cont(" |"); |
1842 | dotest(rsem_AA1B, FAILURE, LOCKTYPE_RWSEM); | 1842 | dotest(rsem_AA1B, FAILURE, LOCKTYPE_RWSEM); |
1843 | printk("\n"); | 1843 | pr_cont("\n"); |
1844 | 1844 | ||
1845 | print_testname("mixed read-write-lock"); | 1845 | print_testname("mixed read-write-lock"); |
1846 | printk(" |"); | 1846 | pr_cont(" |"); |
1847 | dotest(rlock_AA2, FAILURE, LOCKTYPE_RWLOCK); | 1847 | dotest(rlock_AA2, FAILURE, LOCKTYPE_RWLOCK); |
1848 | printk(" |"); | 1848 | pr_cont(" |"); |
1849 | dotest(rsem_AA2, FAILURE, LOCKTYPE_RWSEM); | 1849 | dotest(rsem_AA2, FAILURE, LOCKTYPE_RWSEM); |
1850 | printk("\n"); | 1850 | pr_cont("\n"); |
1851 | 1851 | ||
1852 | print_testname("mixed write-read-lock"); | 1852 | print_testname("mixed write-read-lock"); |
1853 | printk(" |"); | 1853 | pr_cont(" |"); |
1854 | dotest(rlock_AA3, FAILURE, LOCKTYPE_RWLOCK); | 1854 | dotest(rlock_AA3, FAILURE, LOCKTYPE_RWLOCK); |
1855 | printk(" |"); | 1855 | pr_cont(" |"); |
1856 | dotest(rsem_AA3, FAILURE, LOCKTYPE_RWSEM); | 1856 | dotest(rsem_AA3, FAILURE, LOCKTYPE_RWSEM); |
1857 | printk("\n"); | 1857 | pr_cont("\n"); |
1858 | 1858 | ||
1859 | printk(" --------------------------------------------------------------------------\n"); | 1859 | printk(" --------------------------------------------------------------------------\n"); |
1860 | 1860 | ||