Skip to content

Commit 0ff0edb

Browse files
committed
Merge tag 'locking-core-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: - rtmutex cleanup & spring cleaning pass that removes ~400 lines of code - Futex simplifications & cleanups - Add debugging to the CSD code, to help track down a tenacious race (or hw problem) - Add lockdep_assert_not_held(), to allow code to require a lock to not be held, and propagate this into the ath10k driver - Misc LKMM documentation updates - Misc KCSAN updates: cleanups & documentation updates - Misc fixes and cleanups - Fix locktorture bugs with ww_mutexes * tag 'locking-core-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (44 commits) kcsan: Fix printk format string static_call: Relax static_call_update() function argument type static_call: Fix unused variable warn w/o MODULE locking/rtmutex: Clean up signal handling in __rt_mutex_slowlock() locking/rtmutex: Restrict the trylock WARN_ON() to debug locking/rtmutex: Fix misleading comment in rt_mutex_postunlock() locking/rtmutex: Consolidate the fast/slowpath invocation locking/rtmutex: Make text section and inlining consistent locking/rtmutex: Move debug functions as inlines into common header locking/rtmutex: Decrapify __rt_mutex_init() locking/rtmutex: Remove pointless CONFIG_RT_MUTEXES=n stubs locking/rtmutex: Inline chainwalk depth check locking/rtmutex: Move rt_mutex_debug_task_free() to rtmutex.c locking/rtmutex: Remove empty and unused debug stubs locking/rtmutex: Consolidate rt_mutex_init() locking/rtmutex: Remove output from deadlock detector locking/rtmutex: Remove rtmutex deadlock tester leftovers locking/rtmutex: Remove rt_mutex_timed_lock() MAINTAINERS: Add myself as futex reviewer locking/mutex: Remove repeated declaration ...
2 parents 9a45da9 + f4abe99 commit 0ff0edb

44 files changed

Lines changed: 1246 additions & 827 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,16 @@
782782
cs89x0_media= [HW,NET]
783783
Format: { rj45 | aui | bnc }
784784

785+
csdlock_debug= [KNL] Enable debug add-ons of cross-CPU function call
786+
handling. When switched on, additional debug data is
787+
printed to the console in case a hanging CPU is
788+
detected, and that CPU is pinged again in order to try
789+
to resolve the hang situation.
790+
0: disable csdlock debugging (default)
791+
1: enable basic csdlock debugging (minor impact)
792+
ext: enable extended csdlock debugging (more impact,
793+
but more data)
794+
785795
dasd= [HW,NET]
786796
See header of drivers/s390/block/dasd_devmap.c.
787797

Documentation/dev-tools/kcsan.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
.. Copyright (C) 2019, Google LLC.
3+
14
The Kernel Concurrency Sanitizer (KCSAN)
25
========================================
36

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7452,6 +7452,7 @@ M: Thomas Gleixner <tglx@linutronix.de>
74527452
M: Ingo Molnar <mingo@redhat.com>
74537453
R: Peter Zijlstra <peterz@infradead.org>
74547454
R: Darren Hart <dvhart@infradead.org>
7455+
R: Davidlohr Bueso <dave@stgolabs.net>
74557456
L: linux-kernel@vger.kernel.org
74567457
S: Maintained
74577458
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core

arch/arm/include/asm/spinlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* assembler to insert a extra (16-bit) IT instruction, depending on the
2323
* presence or absence of neighbouring conditional instructions.
2424
*
25-
* To avoid this unpredictableness, an approprite IT is inserted explicitly:
25+
* To avoid this unpredictability, an appropriate IT is inserted explicitly:
2626
* the assembler won't change IT instructions which are explicitly present
2727
* in the input.
2828
*/

arch/x86/include/asm/jump_label.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <linux/stringify.h>
1515
#include <linux/types.h>
1616

17-
static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
17+
static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch)
1818
{
1919
asm_volatile_goto("1:"
2020
".byte " __stringify(BYTES_NOP5) "\n\t"
@@ -30,7 +30,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
3030
return true;
3131
}
3232

33-
static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
33+
static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch)
3434
{
3535
asm_volatile_goto("1:"
3636
".byte 0xe9\n\t .long %l[l_yes] - 2f\n\t"

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4727,6 +4727,8 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw,
47274727
/* Must not be called with conf_mutex held as workers can use that also. */
47284728
void ath10k_drain_tx(struct ath10k *ar)
47294729
{
4730+
lockdep_assert_not_held(&ar->conf_mutex);
4731+
47304732
/* make sure rcu-protected mac80211 tx path itself is drained */
47314733
synchronize_net();
47324734

include/linux/kcsan-checks.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* KCSAN access checks and modifiers. These can be used to explicitly check
4+
* uninstrumented accesses, or change KCSAN checking behaviour of accesses.
5+
*
6+
* Copyright (C) 2019, Google LLC.
7+
*/
28

39
#ifndef _LINUX_KCSAN_CHECKS_H
410
#define _LINUX_KCSAN_CHECKS_H

include/linux/kcsan.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* The Kernel Concurrency Sanitizer (KCSAN) infrastructure. Public interface and
4+
* data structures to set up runtime. See kcsan-checks.h for explicit checks and
5+
* modifiers. For more info please see Documentation/dev-tools/kcsan.rst.
6+
*
7+
* Copyright (C) 2019, Google LLC.
8+
*/
29

310
#ifndef _LINUX_KCSAN_H
411
#define _LINUX_KCSAN_H

include/linux/lockdep.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ extern void lockdep_set_selftest_task(struct task_struct *task);
155155
extern void lockdep_init_task(struct task_struct *task);
156156

157157
/*
158-
* Split the recrursion counter in two to readily detect 'off' vs recursion.
158+
* Split the recursion counter in two to readily detect 'off' vs recursion.
159159
*/
160160
#define LOCKDEP_RECURSION_BITS 16
161161
#define LOCKDEP_OFF (1U << LOCKDEP_RECURSION_BITS)
@@ -268,6 +268,11 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
268268

269269
extern void lock_release(struct lockdep_map *lock, unsigned long ip);
270270

271+
/* lock_is_held_type() returns */
272+
#define LOCK_STATE_UNKNOWN -1
273+
#define LOCK_STATE_NOT_HELD 0
274+
#define LOCK_STATE_HELD 1
275+
271276
/*
272277
* Same "read" as for lock_acquire(), except -1 means any.
273278
*/
@@ -301,8 +306,14 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie);
301306

302307
#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
303308

304-
#define lockdep_assert_held(l) do { \
305-
WARN_ON(debug_locks && !lockdep_is_held(l)); \
309+
#define lockdep_assert_held(l) do { \
310+
WARN_ON(debug_locks && \
311+
lockdep_is_held(l) == LOCK_STATE_NOT_HELD); \
312+
} while (0)
313+
314+
#define lockdep_assert_not_held(l) do { \
315+
WARN_ON(debug_locks && \
316+
lockdep_is_held(l) == LOCK_STATE_HELD); \
306317
} while (0)
307318

308319
#define lockdep_assert_held_write(l) do { \
@@ -397,7 +408,8 @@ extern int lockdep_is_held(const void *);
397408
#define lockdep_is_held_type(l, r) (1)
398409

399410
#define lockdep_assert_held(l) do { (void)(l); } while (0)
400-
#define lockdep_assert_held_write(l) do { (void)(l); } while (0)
411+
#define lockdep_assert_not_held(l) do { (void)(l); } while (0)
412+
#define lockdep_assert_held_write(l) do { (void)(l); } while (0)
401413
#define lockdep_assert_held_read(l) do { (void)(l); } while (0)
402414
#define lockdep_assert_held_once(l) do { (void)(l); } while (0)
403415
#define lockdep_assert_none_held_once() do { } while (0)

include/linux/mutex.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/osq_lock.h>
2121
#include <linux/debug_locks.h>
2222

23+
struct ww_class;
2324
struct ww_acquire_ctx;
2425

2526
/*
@@ -65,9 +66,6 @@ struct mutex {
6566
#endif
6667
};
6768

68-
struct ww_class;
69-
struct ww_acquire_ctx;
70-
7169
struct ww_mutex {
7270
struct mutex base;
7371
struct ww_acquire_ctx *ctx;

0 commit comments

Comments
 (0)