Skip to content

Commit 79c3dcb

Browse files
committed
Merge branch 'sparc-lockdep-small'
Babu Moger says: ==================== Adjust lockdep static allocations for sparc These patches limit the static allocations for lockdep data structures used for debugging locking correctness. For sparc, all the kernel's code, data, and bss, must have locked translations in the TLB so that we don't get TLB misses on kernel code and data. Current sparc chips have 8 TLB entries available that may be locked down, and with a 4mb page size, this gives a maximum of 32MB. With PROVE_LOCKING we could go over this limit and cause system boot-up problems. These patches limit the static allocations so that everything fits in current required size limit. patch 1 : Adds new config parameter CONFIG_PROVE_LOCKING_SMALL Patch 2 : Adjusts the sizes based on the new config parameter v2-> v3: Some more comments from Sam Ravnborg and Peter Zijlstra. Defined PROVE_LOCKING_SMALL as invisible and moved the selection to arch/sparc/Kconfig. v1-> v2: As suggested by Peter Zijlstra, keeping the default as is. Introduced new config variable CONFIG_PROVE_LOCKING_SMALL to handle sparc specific case. v0: Initial revision. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 1a9bbcc + e245d99 commit 79c3dcb

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

arch/sparc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ config SPARC
4343
select ARCH_HAS_SG_CHAIN
4444
select CPU_NO_EFFICIENT_FFS
4545
select HAVE_ARCH_HARDENED_USERCOPY
46+
select PROVE_LOCKING_SMALL if PROVE_LOCKING
4647

4748
config SPARC32
4849
def_bool !64BIT

kernel/locking/lockdep_internals.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ enum {
4545
#define LOCKF_USED_IN_IRQ_READ \
4646
(LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
4747

48+
/*
49+
* CONFIG_PROVE_LOCKING_SMALL is defined for sparc. Sparc requires .text,
50+
* .data and .bss to fit in required 32MB limit for the kernel. With
51+
* PROVE_LOCKING we could go over this limit and cause system boot-up problems.
52+
* So, reduce the static allocations for lockdeps related structures so that
53+
* everything fits in current required size limit.
54+
*/
55+
#ifdef CONFIG_PROVE_LOCKING_SMALL
4856
/*
4957
* MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies
5058
* we track.
@@ -54,18 +62,24 @@ enum {
5462
* table (if it's not there yet), and we check it for lock order
5563
* conflicts and deadlocks.
5664
*/
65+
#define MAX_LOCKDEP_ENTRIES 16384UL
66+
#define MAX_LOCKDEP_CHAINS_BITS 15
67+
#define MAX_STACK_TRACE_ENTRIES 262144UL
68+
#else
5769
#define MAX_LOCKDEP_ENTRIES 32768UL
5870

5971
#define MAX_LOCKDEP_CHAINS_BITS 16
60-
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
61-
62-
#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
6372

6473
/*
6574
* Stack-trace: tightly packed array of stack backtrace
6675
* addresses. Protected by the hash_lock.
6776
*/
6877
#define MAX_STACK_TRACE_ENTRIES 524288UL
78+
#endif
79+
80+
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
81+
82+
#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
6983

7084
extern struct list_head all_lock_classes;
7185
extern struct lock_chain lock_chains[];

lib/Kconfig.debug

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,9 @@ config PROVE_LOCKING
10851085

10861086
For more details, see Documentation/locking/lockdep-design.txt.
10871087

1088+
config PROVE_LOCKING_SMALL
1089+
bool
1090+
10881091
config LOCKDEP
10891092
bool
10901093
depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT

0 commit comments

Comments
 (0)