Skip to content

Commit b19b3c7

Browse files
author
Ingo Molnar
committed
Merge branches 'core/debug', 'core/futexes', 'core/locking', 'core/rcu', 'core/signal', 'core/urgent' and 'core/xen' into core/core
8 parents ed31348 + 6003ab0 + 42569c3 + 7918baa + 29cbda7 + 2b5fe6d + b0788ca + 8dd2337 commit b19b3c7

28 files changed

Lines changed: 315 additions & 267 deletions

‎Documentation/lockstat.txt‎

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,35 +71,50 @@ Look at the current lock statistics:
7171

7272
# less /proc/lock_stat
7373

74-
01 lock_stat version 0.2
74+
01 lock_stat version 0.3
7575
02 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7676
03 class name con-bounces contentions waittime-min waittime-max waittime-total acq-bounces acquisitions holdtime-min holdtime-max holdtime-total
7777
04 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7878
05
79-
06 &inode->i_data.tree_lock-W: 15 21657 0.18 1093295.30 11547131054.85 58 10415 0.16 87.51 6387.60
80-
07 &inode->i_data.tree_lock-R: 0 0 0.00 0.00 0.00 23302 231198 0.25 8.45 98023.38
81-
08 --------------------------
82-
09 &inode->i_data.tree_lock 0 [<ffffffff8027c08f>] add_to_page_cache+0x5f/0x190
83-
10
84-
11 ...............................................................................................................................................................................................
85-
12
86-
13 dcache_lock: 1037 1161 0.38 45.32 774.51 6611 243371 0.15 306.48 77387.24
87-
14 -----------
88-
15 dcache_lock 180 [<ffffffff802c0d7e>] sys_getcwd+0x11e/0x230
89-
16 dcache_lock 165 [<ffffffff802c002a>] d_alloc+0x15a/0x210
90-
17 dcache_lock 33 [<ffffffff8035818d>] _atomic_dec_and_lock+0x4d/0x70
91-
18 dcache_lock 1 [<ffffffff802beef8>] shrink_dcache_parent+0x18/0x130
79+
06 &mm->mmap_sem-W: 233 538 18446744073708 22924.27 607243.51 1342 45806 1.71 8595.89 1180582.34
80+
07 &mm->mmap_sem-R: 205 587 18446744073708 28403.36 731975.00 1940 412426 0.58 187825.45 6307502.88
81+
08 ---------------
82+
09 &mm->mmap_sem 487 [<ffffffff8053491f>] do_page_fault+0x466/0x928
83+
10 &mm->mmap_sem 179 [<ffffffff802a6200>] sys_mprotect+0xcd/0x21d
84+
11 &mm->mmap_sem 279 [<ffffffff80210a57>] sys_mmap+0x75/0xce
85+
12 &mm->mmap_sem 76 [<ffffffff802a490b>] sys_munmap+0x32/0x59
86+
13 ---------------
87+
14 &mm->mmap_sem 270 [<ffffffff80210a57>] sys_mmap+0x75/0xce
88+
15 &mm->mmap_sem 431 [<ffffffff8053491f>] do_page_fault+0x466/0x928
89+
16 &mm->mmap_sem 138 [<ffffffff802a490b>] sys_munmap+0x32/0x59
90+
17 &mm->mmap_sem 145 [<ffffffff802a6200>] sys_mprotect+0xcd/0x21d
91+
18
92+
19 ...............................................................................................................................................................................................
93+
20
94+
21 dcache_lock: 621 623 0.52 118.26 1053.02 6745 91930 0.29 316.29 118423.41
95+
22 -----------
96+
23 dcache_lock 179 [<ffffffff80378274>] _atomic_dec_and_lock+0x34/0x54
97+
24 dcache_lock 113 [<ffffffff802cc17b>] d_alloc+0x19a/0x1eb
98+
25 dcache_lock 99 [<ffffffff802ca0dc>] d_rehash+0x1b/0x44
99+
26 dcache_lock 104 [<ffffffff802cbca0>] d_instantiate+0x36/0x8a
100+
27 -----------
101+
28 dcache_lock 192 [<ffffffff80378274>] _atomic_dec_and_lock+0x34/0x54
102+
29 dcache_lock 98 [<ffffffff802ca0dc>] d_rehash+0x1b/0x44
103+
30 dcache_lock 72 [<ffffffff802cc17b>] d_alloc+0x19a/0x1eb
104+
31 dcache_lock 112 [<ffffffff802cbca0>] d_instantiate+0x36/0x8a
92105

93106
This excerpt shows the first two lock class statistics. Line 01 shows the
94107
output version - each time the format changes this will be updated. Line 02-04
95-
show the header with column descriptions. Lines 05-10 and 13-18 show the actual
108+
show the header with column descriptions. Lines 05-18 and 20-31 show the actual
96109
statistics. These statistics come in two parts; the actual stats separated by a
97-
short separator (line 08, 14) from the contention points.
110+
short separator (line 08, 13) from the contention points.
98111

99-
The first lock (05-10) is a read/write lock, and shows two lines above the
112+
The first lock (05-18) is a read/write lock, and shows two lines above the
100113
short separator. The contention points don't match the column descriptors,
101-
they have two: contentions and [<IP>] symbol.
114+
they have two: contentions and [<IP>] symbol. The second set of contention
115+
points are the points we're contending with.
102116

117+
The integer part of the time values is in us.
103118

104119
View the top contending locks:
105120

‎arch/um/include/asm/system.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ extern int get_signals(void);
1111
extern void block_signals(void);
1212
extern void unblock_signals(void);
1313

14-
#define local_save_flags(flags) do { typecheck(unsigned long, flags); \
14+
#define raw_local_save_flags(flags) do { typecheck(unsigned long, flags); \
1515
(flags) = get_signals(); } while(0)
16-
#define local_irq_restore(flags) do { typecheck(unsigned long, flags); \
16+
#define raw_local_irq_restore(flags) do { typecheck(unsigned long, flags); \
1717
set_signals(flags); } while(0)
1818

19-
#define local_irq_save(flags) do { local_save_flags(flags); \
20-
local_irq_disable(); } while(0)
19+
#define raw_local_irq_save(flags) do { raw_local_save_flags(flags); \
20+
raw_local_irq_disable(); } while(0)
2121

22-
#define local_irq_enable() unblock_signals()
23-
#define local_irq_disable() block_signals()
22+
#define raw_local_irq_enable() unblock_signals()
23+
#define raw_local_irq_disable() block_signals()
2424

2525
#define irqs_disabled() \
2626
({ \
2727
unsigned long flags; \
28-
local_save_flags(flags); \
28+
raw_local_save_flags(flags); \
2929
(flags == 0); \
3030
})
3131

‎arch/x86/include/asm/uaccess.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ extern int __get_user_bad(void);
157157
int __ret_gu; \
158158
unsigned long __val_gu; \
159159
__chk_user_ptr(ptr); \
160+
might_fault(); \
160161
switch (sizeof(*(ptr))) { \
161162
case 1: \
162163
__get_user_x(1, __ret_gu, __val_gu, ptr); \
@@ -241,6 +242,7 @@ extern void __put_user_8(void);
241242
int __ret_pu; \
242243
__typeof__(*(ptr)) __pu_val; \
243244
__chk_user_ptr(ptr); \
245+
might_fault(); \
244246
__pu_val = x; \
245247
switch (sizeof(*(ptr))) { \
246248
case 1: \

‎arch/x86/include/asm/uaccess_32.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
8282
static __always_inline unsigned long __must_check
8383
__copy_to_user(void __user *to, const void *from, unsigned long n)
8484
{
85-
might_sleep();
86-
return __copy_to_user_inatomic(to, from, n);
85+
might_fault();
86+
return __copy_to_user_inatomic(to, from, n);
8787
}
8888

8989
static __always_inline unsigned long
@@ -137,7 +137,7 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
137137
static __always_inline unsigned long
138138
__copy_from_user(void *to, const void __user *from, unsigned long n)
139139
{
140-
might_sleep();
140+
might_fault();
141141
if (__builtin_constant_p(n)) {
142142
unsigned long ret;
143143

@@ -159,7 +159,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
159159
static __always_inline unsigned long __copy_from_user_nocache(void *to,
160160
const void __user *from, unsigned long n)
161161
{
162-
might_sleep();
162+
might_fault();
163163
if (__builtin_constant_p(n)) {
164164
unsigned long ret;
165165

‎arch/x86/include/asm/uaccess_64.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ static __always_inline __must_check
2929
int __copy_from_user(void *dst, const void __user *src, unsigned size)
3030
{
3131
int ret = 0;
32+
33+
might_fault();
3234
if (!__builtin_constant_p(size))
3335
return copy_user_generic(dst, (__force void *)src, size);
3436
switch (size) {
@@ -71,6 +73,8 @@ static __always_inline __must_check
7173
int __copy_to_user(void __user *dst, const void *src, unsigned size)
7274
{
7375
int ret = 0;
76+
77+
might_fault();
7478
if (!__builtin_constant_p(size))
7579
return copy_user_generic((__force void *)dst, src, size);
7680
switch (size) {
@@ -113,6 +117,8 @@ static __always_inline __must_check
113117
int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
114118
{
115119
int ret = 0;
120+
121+
might_fault();
116122
if (!__builtin_constant_p(size))
117123
return copy_user_generic((__force void *)dst,
118124
(__force void *)src, size);

‎arch/x86/lib/usercopy_32.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned lon
3939
#define __do_strncpy_from_user(dst, src, count, res) \
4040
do { \
4141
int __d0, __d1, __d2; \
42-
might_sleep(); \
42+
might_fault(); \
4343
__asm__ __volatile__( \
4444
" testl %1,%1\n" \
4545
" jz 2f\n" \
@@ -126,7 +126,7 @@ EXPORT_SYMBOL(strncpy_from_user);
126126
#define __do_clear_user(addr,size) \
127127
do { \
128128
int __d0; \
129-
might_sleep(); \
129+
might_fault(); \
130130
__asm__ __volatile__( \
131131
"0: rep; stosl\n" \
132132
" movl %2,%0\n" \
@@ -155,7 +155,7 @@ do { \
155155
unsigned long
156156
clear_user(void __user *to, unsigned long n)
157157
{
158-
might_sleep();
158+
might_fault();
159159
if (access_ok(VERIFY_WRITE, to, n))
160160
__do_clear_user(to, n);
161161
return n;
@@ -197,7 +197,7 @@ long strnlen_user(const char __user *s, long n)
197197
unsigned long mask = -__addr_ok(s);
198198
unsigned long res, tmp;
199199

200-
might_sleep();
200+
might_fault();
201201

202202
__asm__ __volatile__(
203203
" testl %0, %0\n"

‎arch/x86/lib/usercopy_64.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define __do_strncpy_from_user(dst,src,count,res) \
1616
do { \
1717
long __d0, __d1, __d2; \
18-
might_sleep(); \
18+
might_fault(); \
1919
__asm__ __volatile__( \
2020
" testq %1,%1\n" \
2121
" jz 2f\n" \
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(strncpy_from_user);
6464
unsigned long __clear_user(void __user *addr, unsigned long size)
6565
{
6666
long __d0;
67-
might_sleep();
67+
might_fault();
6868
/* no memory constraint because it doesn't change any memory gcc knows
6969
about */
7070
asm volatile(

‎include/linux/debug_locks.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern int debug_locks_off(void);
1717
({ \
1818
int __ret = 0; \
1919
\
20-
if (unlikely(c)) { \
20+
if (!oops_in_progress && unlikely(c)) { \
2121
if (debug_locks_off() && !debug_locks_silent) \
2222
WARN_ON(1); \
2323
__ret = 1; \

‎include/linux/futex.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ union futex_key {
164164
} both;
165165
};
166166

167+
#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
168+
167169
#ifdef CONFIG_FUTEX
168170
extern void exit_robust_list(struct task_struct *curr);
169171
extern void exit_pi_state_list(struct task_struct *curr);

‎include/linux/kernel.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ extern int _cond_resched(void);
141141
(__x < 0) ? -__x : __x; \
142142
})
143143

144+
#ifdef CONFIG_PROVE_LOCKING
145+
void might_fault(void);
146+
#else
147+
static inline void might_fault(void)
148+
{
149+
might_sleep();
150+
}
151+
#endif
152+
144153
extern struct atomic_notifier_head panic_notifier_list;
145154
extern long (*panic_blink)(long time);
146155
NORET_TYPE void panic(const char * fmt, ...)
@@ -188,6 +197,8 @@ extern unsigned long long memparse(const char *ptr, char **retptr);
188197
extern int core_kernel_text(unsigned long addr);
189198
extern int __kernel_text_address(unsigned long addr);
190199
extern int kernel_text_address(unsigned long addr);
200+
extern int func_ptr_is_kernel_text(void *ptr);
201+
191202
struct pid;
192203
extern struct pid *session_of_pgrp(struct pid *pgrp);
193204

0 commit comments

Comments
 (0)