Commit 630a9370 authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

Merge tag 'lockdep-for-tip.20241220' of...

Merge tag 'lockdep-for-tip.20241220' of git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux into locking/core

Lockdep changes for v6.14:

- Use swap() macro in the ww_mutex test.
- Minor fixes and documentation for lockdep configs on internal data structure sizes.
- Some "-Wunused-function" warning fixes for Clang.

Rust locking changes for v6.14:

- Add Rust locking files into LOCKING PRIMITIVES maintainer entry.
- Add `Lock<(), ..>::from_raw()` function to support abstraction on low level locking.
- Expose `Guard::new()` for public usage and add type alias for spinlock and mutex guards.
- Add lockdep checking when creating a new lock `Guard`.
parents abfdccd6 fbd7a5a0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -13425,8 +13425,8 @@ LOCKING PRIMITIVES
M:	Peter Zijlstra <peterz@infradead.org>
M:	Ingo Molnar <mingo@redhat.com>
M:	Will Deacon <will@kernel.org>
M:	Boqun Feng <boqun.feng@gmail.com> (LOCKDEP & RUST)
R:	Waiman Long <longman@redhat.com>
R:	Boqun Feng <boqun.feng@gmail.com> (LOCKDEP)
L:	linux-kernel@vger.kernel.org
S:	Maintained
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
@@ -13440,6 +13440,11 @@ F: include/linux/seqlock.h
F:	include/linux/spinlock*.h
F:	kernel/locking/
F:	lib/locking*.[ch]
F:	rust/helpers/mutex.c
F:	rust/helpers/spinlock.c
F:	rust/kernel/sync/lock.rs
F:	rust/kernel/sync/lock/
F:	rust/kernel/sync/locked_by.rs
X:	kernel/locking/locktorture.c
LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks)
+3 −1
Original line number Diff line number Diff line
@@ -157,10 +157,12 @@ static inline void lockdep_unlock(void)
	__this_cpu_dec(lockdep_recursion);
}

#ifdef CONFIG_PROVE_LOCKING
static inline bool lockdep_assert_locked(void)
{
	return DEBUG_LOCKS_WARN_ON(__owner != current);
}
#endif

static struct task_struct *lockdep_selftest_task_struct;

@@ -430,7 +432,7 @@ static inline u16 hlock_id(struct held_lock *hlock)
	return (hlock->class_idx | (hlock->read << MAX_LOCKDEP_KEYS_BITS));
}

static inline unsigned int chain_hlock_class_idx(u16 hlock_id)
static inline __maybe_unused unsigned int chain_hlock_class_idx(u16 hlock_id)
{
	return hlock_id & (MAX_LOCKDEP_KEYS - 1);
}
+2 −1
Original line number Diff line number Diff line
@@ -119,7 +119,8 @@ static const unsigned long LOCKF_USED_IN_IRQ_READ =

#define MAX_LOCKDEP_CHAINS	(1UL << MAX_LOCKDEP_CHAINS_BITS)

#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
#define AVG_LOCKDEP_CHAIN_DEPTH		5
#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS * AVG_LOCKDEP_CHAIN_DEPTH)

extern struct lock_chain lock_chains[];

+3 −6
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@ static inline u32 prandom_u32_below(u32 ceil)
static int *get_random_order(int count)
{
	int *order;
	int n, r, tmp;
	int n, r;

	order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
	if (!order)
@@ -415,11 +415,8 @@ static int *get_random_order(int count)

	for (n = count - 1; n > 1; n--) {
		r = prandom_u32_below(n + 1);
		if (r != n) {
			tmp = order[n];
			order[n] = order[r];
			order[r] = tmp;
		}
		if (r != n)
			swap(order[n], order[r]);
	}

	return order;
+9 −9
Original line number Diff line number Diff line
@@ -1502,15 +1502,15 @@ config LOCKDEP_SMALL
	bool

config LOCKDEP_BITS
	int "Bitsize for MAX_LOCKDEP_ENTRIES"
	int "Size for MAX_LOCKDEP_ENTRIES (as Nth power of 2)"
	depends on LOCKDEP && !LOCKDEP_SMALL
	range 10 30
	range 10 24
	default 15
	help
	  Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message.

config LOCKDEP_CHAINS_BITS
	int "Bitsize for MAX_LOCKDEP_CHAINS"
	int "Size for MAX_LOCKDEP_CHAINS (as Nth power of 2)"
	depends on LOCKDEP && !LOCKDEP_SMALL
	range 10 21
	default 16
@@ -1518,25 +1518,25 @@ config LOCKDEP_CHAINS_BITS
	  Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!" message.

config LOCKDEP_STACK_TRACE_BITS
	int "Bitsize for MAX_STACK_TRACE_ENTRIES"
	int "Size for MAX_STACK_TRACE_ENTRIES (as Nth power of 2)"
	depends on LOCKDEP && !LOCKDEP_SMALL
	range 10 30
	range 10 26
	default 19
	help
	  Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message.

config LOCKDEP_STACK_TRACE_HASH_BITS
	int "Bitsize for STACK_TRACE_HASH_SIZE"
	int "Size for STACK_TRACE_HASH_SIZE (as Nth power of 2)"
	depends on LOCKDEP && !LOCKDEP_SMALL
	range 10 30
	range 10 26
	default 14
	help
	  Try increasing this value if you need large STACK_TRACE_HASH_SIZE.

config LOCKDEP_CIRCULAR_QUEUE_BITS
	int "Bitsize for elements in circular_queue struct"
	int "Size for elements in circular_queue struct (as Nth power of 2)"
	depends on LOCKDEP
	range 10 30
	range 10 26
	default 12
	help
	  Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure.
Loading