diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-13 06:25:51 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-13 06:25:51 -0500 |
commit | 968ea6d80e395cf11a51143cfa1b9a14ada676df (patch) | |
tree | dc2acec8c9bdced33afe1e273ee5e0b0b93d2703 /include | |
parent | 7be7585393d311866653564fbcd10a3232773c0b (diff) | |
parent | 8299608f140ae321e4eb5d1306184265d2b9511e (diff) |
Merge ../linux-2.6-x86
Conflicts:
arch/x86/kernel/io_apic.c
kernel/sched.c
kernel/sched_stats.h
Diffstat (limited to 'include')
34 files changed, 889 insertions, 279 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 80744606bad1..eba835a2c2cd 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -45,6 +45,22 @@ | |||
45 | #define MCOUNT_REC() | 45 | #define MCOUNT_REC() |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #ifdef CONFIG_TRACE_BRANCH_PROFILING | ||
49 | #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \ | ||
50 | *(_ftrace_annotated_branch) \ | ||
51 | VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .; | ||
52 | #else | ||
53 | #define LIKELY_PROFILE() | ||
54 | #endif | ||
55 | |||
56 | #ifdef CONFIG_PROFILE_ALL_BRANCHES | ||
57 | #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \ | ||
58 | *(_ftrace_branch) \ | ||
59 | VMLINUX_SYMBOL(__stop_branch_profile) = .; | ||
60 | #else | ||
61 | #define BRANCH_PROFILE() | ||
62 | #endif | ||
63 | |||
48 | /* .data section */ | 64 | /* .data section */ |
49 | #define DATA_DATA \ | 65 | #define DATA_DATA \ |
50 | *(.data) \ | 66 | *(.data) \ |
@@ -60,9 +76,12 @@ | |||
60 | VMLINUX_SYMBOL(__start___markers) = .; \ | 76 | VMLINUX_SYMBOL(__start___markers) = .; \ |
61 | *(__markers) \ | 77 | *(__markers) \ |
62 | VMLINUX_SYMBOL(__stop___markers) = .; \ | 78 | VMLINUX_SYMBOL(__stop___markers) = .; \ |
79 | . = ALIGN(32); \ | ||
63 | VMLINUX_SYMBOL(__start___tracepoints) = .; \ | 80 | VMLINUX_SYMBOL(__start___tracepoints) = .; \ |
64 | *(__tracepoints) \ | 81 | *(__tracepoints) \ |
65 | VMLINUX_SYMBOL(__stop___tracepoints) = .; | 82 | VMLINUX_SYMBOL(__stop___tracepoints) = .; \ |
83 | LIKELY_PROFILE() \ | ||
84 | BRANCH_PROFILE() | ||
66 | 85 | ||
67 | #define RO_DATA(align) \ | 86 | #define RO_DATA(align) \ |
68 | . = ALIGN((align)); \ | 87 | . = ALIGN((align)); \ |
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h index 70a57c8c002b..c980f5ba8de7 100644 --- a/include/asm-m32r/system.h +++ b/include/asm-m32r/system.h | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #if defined(CONFIG_FRAME_POINTER) || \ | 25 | #if defined(CONFIG_FRAME_POINTER) || \ |
26 | !defined(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER) | 26 | !defined(CONFIG_SCHED_OMIT_FRAME_POINTER) |
27 | #define M32R_PUSH_FP " push fp\n" | 27 | #define M32R_PUSH_FP " push fp\n" |
28 | #define M32R_POP_FP " pop fp\n" | 28 | #define M32R_POP_FP " pop fp\n" |
29 | #else | 29 | #else |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index e531783e5d78..95ac82340c3b 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -313,6 +313,7 @@ unifdef-y += ptrace.h | |||
313 | unifdef-y += qnx4_fs.h | 313 | unifdef-y += qnx4_fs.h |
314 | unifdef-y += quota.h | 314 | unifdef-y += quota.h |
315 | unifdef-y += random.h | 315 | unifdef-y += random.h |
316 | unifdef-y += irqnr.h | ||
316 | unifdef-y += reboot.h | 317 | unifdef-y += reboot.h |
317 | unifdef-y += reiserfs_fs.h | 318 | unifdef-y += reiserfs_fs.h |
318 | unifdef-y += reiserfs_xattr.h | 319 | unifdef-y += reiserfs_xattr.h |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index bdf505d33e77..1dba3493d520 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -160,7 +160,6 @@ struct blk_trace { | |||
160 | 160 | ||
161 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); | 161 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); |
162 | extern void blk_trace_shutdown(struct request_queue *); | 162 | extern void blk_trace_shutdown(struct request_queue *); |
163 | extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); | ||
164 | extern int do_blk_trace_setup(struct request_queue *q, | 163 | extern int do_blk_trace_setup(struct request_queue *q, |
165 | char *name, dev_t dev, struct blk_user_trace_setup *buts); | 164 | char *name, dev_t dev, struct blk_user_trace_setup *buts); |
166 | extern void __trace_note_message(struct blk_trace *, const char *fmt, ...); | 165 | extern void __trace_note_message(struct blk_trace *, const char *fmt, ...); |
@@ -186,168 +185,8 @@ extern void __trace_note_message(struct blk_trace *, const char *fmt, ...); | |||
186 | } while (0) | 185 | } while (0) |
187 | #define BLK_TN_MAX_MSG 128 | 186 | #define BLK_TN_MAX_MSG 128 |
188 | 187 | ||
189 | /** | 188 | extern void blk_add_driver_data(struct request_queue *q, struct request *rq, |
190 | * blk_add_trace_rq - Add a trace for a request oriented action | 189 | void *data, size_t len); |
191 | * @q: queue the io is for | ||
192 | * @rq: the source request | ||
193 | * @what: the action | ||
194 | * | ||
195 | * Description: | ||
196 | * Records an action against a request. Will log the bio offset + size. | ||
197 | * | ||
198 | **/ | ||
199 | static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq, | ||
200 | u32 what) | ||
201 | { | ||
202 | struct blk_trace *bt = q->blk_trace; | ||
203 | int rw = rq->cmd_flags & 0x03; | ||
204 | |||
205 | if (likely(!bt)) | ||
206 | return; | ||
207 | |||
208 | if (blk_discard_rq(rq)) | ||
209 | rw |= (1 << BIO_RW_DISCARD); | ||
210 | |||
211 | if (blk_pc_request(rq)) { | ||
212 | what |= BLK_TC_ACT(BLK_TC_PC); | ||
213 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); | ||
214 | } else { | ||
215 | what |= BLK_TC_ACT(BLK_TC_FS); | ||
216 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, rw, what, rq->errors, 0, NULL); | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * blk_add_trace_bio - Add a trace for a bio oriented action | ||
222 | * @q: queue the io is for | ||
223 | * @bio: the source bio | ||
224 | * @what: the action | ||
225 | * | ||
226 | * Description: | ||
227 | * Records an action against a bio. Will log the bio offset + size. | ||
228 | * | ||
229 | **/ | ||
230 | static inline void blk_add_trace_bio(struct request_queue *q, struct bio *bio, | ||
231 | u32 what) | ||
232 | { | ||
233 | struct blk_trace *bt = q->blk_trace; | ||
234 | |||
235 | if (likely(!bt)) | ||
236 | return; | ||
237 | |||
238 | __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), 0, NULL); | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * blk_add_trace_generic - Add a trace for a generic action | ||
243 | * @q: queue the io is for | ||
244 | * @bio: the source bio | ||
245 | * @rw: the data direction | ||
246 | * @what: the action | ||
247 | * | ||
248 | * Description: | ||
249 | * Records a simple trace | ||
250 | * | ||
251 | **/ | ||
252 | static inline void blk_add_trace_generic(struct request_queue *q, | ||
253 | struct bio *bio, int rw, u32 what) | ||
254 | { | ||
255 | struct blk_trace *bt = q->blk_trace; | ||
256 | |||
257 | if (likely(!bt)) | ||
258 | return; | ||
259 | |||
260 | if (bio) | ||
261 | blk_add_trace_bio(q, bio, what); | ||
262 | else | ||
263 | __blk_add_trace(bt, 0, 0, rw, what, 0, 0, NULL); | ||
264 | } | ||
265 | |||
266 | /** | ||
267 | * blk_add_trace_pdu_int - Add a trace for a bio with an integer payload | ||
268 | * @q: queue the io is for | ||
269 | * @what: the action | ||
270 | * @bio: the source bio | ||
271 | * @pdu: the integer payload | ||
272 | * | ||
273 | * Description: | ||
274 | * Adds a trace with some integer payload. This might be an unplug | ||
275 | * option given as the action, with the depth at unplug time given | ||
276 | * as the payload | ||
277 | * | ||
278 | **/ | ||
279 | static inline void blk_add_trace_pdu_int(struct request_queue *q, u32 what, | ||
280 | struct bio *bio, unsigned int pdu) | ||
281 | { | ||
282 | struct blk_trace *bt = q->blk_trace; | ||
283 | __be64 rpdu = cpu_to_be64(pdu); | ||
284 | |||
285 | if (likely(!bt)) | ||
286 | return; | ||
287 | |||
288 | if (bio) | ||
289 | __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), sizeof(rpdu), &rpdu); | ||
290 | else | ||
291 | __blk_add_trace(bt, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * blk_add_trace_remap - Add a trace for a remap operation | ||
296 | * @q: queue the io is for | ||
297 | * @bio: the source bio | ||
298 | * @dev: target device | ||
299 | * @from: source sector | ||
300 | * @to: target sector | ||
301 | * | ||
302 | * Description: | ||
303 | * Device mapper or raid target sometimes need to split a bio because | ||
304 | * it spans a stripe (or similar). Add a trace for that action. | ||
305 | * | ||
306 | **/ | ||
307 | static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | ||
308 | dev_t dev, sector_t from, sector_t to) | ||
309 | { | ||
310 | struct blk_trace *bt = q->blk_trace; | ||
311 | struct blk_io_trace_remap r; | ||
312 | |||
313 | if (likely(!bt)) | ||
314 | return; | ||
315 | |||
316 | r.device = cpu_to_be32(dev); | ||
317 | r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev); | ||
318 | r.sector = cpu_to_be64(to); | ||
319 | |||
320 | __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * blk_add_driver_data - Add binary message with driver-specific data | ||
325 | * @q: queue the io is for | ||
326 | * @rq: io request | ||
327 | * @data: driver-specific data | ||
328 | * @len: length of driver-specific data | ||
329 | * | ||
330 | * Description: | ||
331 | * Some drivers might want to write driver-specific data per request. | ||
332 | * | ||
333 | **/ | ||
334 | static inline void blk_add_driver_data(struct request_queue *q, | ||
335 | struct request *rq, | ||
336 | void *data, size_t len) | ||
337 | { | ||
338 | struct blk_trace *bt = q->blk_trace; | ||
339 | |||
340 | if (likely(!bt)) | ||
341 | return; | ||
342 | |||
343 | if (blk_pc_request(rq)) | ||
344 | __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA, | ||
345 | rq->errors, len, data); | ||
346 | else | ||
347 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, | ||
348 | 0, BLK_TA_DRV_DATA, rq->errors, len, data); | ||
349 | } | ||
350 | |||
351 | extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | 190 | extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
352 | char __user *arg); | 191 | char __user *arg); |
353 | extern int blk_trace_startstop(struct request_queue *q, int start); | 192 | extern int blk_trace_startstop(struct request_queue *q, int start); |
@@ -356,13 +195,8 @@ extern int blk_trace_remove(struct request_queue *q); | |||
356 | #else /* !CONFIG_BLK_DEV_IO_TRACE */ | 195 | #else /* !CONFIG_BLK_DEV_IO_TRACE */ |
357 | #define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) | 196 | #define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) |
358 | #define blk_trace_shutdown(q) do { } while (0) | 197 | #define blk_trace_shutdown(q) do { } while (0) |
359 | #define blk_add_trace_rq(q, rq, what) do { } while (0) | ||
360 | #define blk_add_trace_bio(q, rq, what) do { } while (0) | ||
361 | #define blk_add_trace_generic(q, rq, rw, what) do { } while (0) | ||
362 | #define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) | ||
363 | #define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) | ||
364 | #define blk_add_driver_data(q, rq, data, len) do {} while (0) | ||
365 | #define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) | 198 | #define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) |
199 | #define blk_add_driver_data(q, rq, data, len) do {} while (0) | ||
366 | #define blk_trace_setup(q, name, dev, arg) (-ENOTTY) | 200 | #define blk_trace_setup(q, name, dev, arg) (-ENOTTY) |
367 | #define blk_trace_startstop(q, start) (-ENOTTY) | 201 | #define blk_trace_startstop(q, start) (-ENOTTY) |
368 | #define blk_trace_remove(q) (-ENOTTY) | 202 | #define blk_trace_remove(q) (-ENOTTY) |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 98115d9d04da..ea7c6be354b7 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -59,8 +59,88 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
59 | * specific implementations come from the above header files | 59 | * specific implementations come from the above header files |
60 | */ | 60 | */ |
61 | 61 | ||
62 | #define likely(x) __builtin_expect(!!(x), 1) | 62 | struct ftrace_branch_data { |
63 | #define unlikely(x) __builtin_expect(!!(x), 0) | 63 | const char *func; |
64 | const char *file; | ||
65 | unsigned line; | ||
66 | union { | ||
67 | struct { | ||
68 | unsigned long correct; | ||
69 | unsigned long incorrect; | ||
70 | }; | ||
71 | struct { | ||
72 | unsigned long miss; | ||
73 | unsigned long hit; | ||
74 | }; | ||
75 | }; | ||
76 | }; | ||
77 | |||
78 | /* | ||
79 | * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code | ||
80 | * to disable branch tracing on a per file basis. | ||
81 | */ | ||
82 | #if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING) | ||
83 | void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | ||
84 | |||
85 | #define likely_notrace(x) __builtin_expect(!!(x), 1) | ||
86 | #define unlikely_notrace(x) __builtin_expect(!!(x), 0) | ||
87 | |||
88 | #define __branch_check__(x, expect) ({ \ | ||
89 | int ______r; \ | ||
90 | static struct ftrace_branch_data \ | ||
91 | __attribute__((__aligned__(4))) \ | ||
92 | __attribute__((section("_ftrace_annotated_branch"))) \ | ||
93 | ______f = { \ | ||
94 | .func = __func__, \ | ||
95 | .file = __FILE__, \ | ||
96 | .line = __LINE__, \ | ||
97 | }; \ | ||
98 | ______r = likely_notrace(x); \ | ||
99 | ftrace_likely_update(&______f, ______r, expect); \ | ||
100 | ______r; \ | ||
101 | }) | ||
102 | |||
103 | /* | ||
104 | * Using __builtin_constant_p(x) to ignore cases where the return | ||
105 | * value is always the same. This idea is taken from a similar patch | ||
106 | * written by Daniel Walker. | ||
107 | */ | ||
108 | # ifndef likely | ||
109 | # define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1)) | ||
110 | # endif | ||
111 | # ifndef unlikely | ||
112 | # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) | ||
113 | # endif | ||
114 | |||
115 | #ifdef CONFIG_PROFILE_ALL_BRANCHES | ||
116 | /* | ||
117 | * "Define 'is'", Bill Clinton | ||
118 | * "Define 'if'", Steven Rostedt | ||
119 | */ | ||
120 | #define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) : \ | ||
121 | ({ \ | ||
122 | int ______r; \ | ||
123 | static struct ftrace_branch_data \ | ||
124 | __attribute__((__aligned__(4))) \ | ||
125 | __attribute__((section("_ftrace_branch"))) \ | ||
126 | ______f = { \ | ||
127 | .func = __func__, \ | ||
128 | .file = __FILE__, \ | ||
129 | .line = __LINE__, \ | ||
130 | }; \ | ||
131 | ______r = !!(cond); \ | ||
132 | if (______r) \ | ||
133 | ______f.hit++; \ | ||
134 | else \ | ||
135 | ______f.miss++; \ | ||
136 | ______r; \ | ||
137 | })) | ||
138 | #endif /* CONFIG_PROFILE_ALL_BRANCHES */ | ||
139 | |||
140 | #else | ||
141 | # define likely(x) __builtin_expect(!!(x), 1) | ||
142 | # define unlikely(x) __builtin_expect(!!(x), 0) | ||
143 | #endif | ||
64 | 144 | ||
65 | /* Optimization barrier */ | 145 | /* Optimization barrier */ |
66 | #ifndef barrier | 146 | #ifndef barrier |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 4aaa4afb1cb9..096476f1fb35 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
@@ -17,7 +17,7 @@ extern int debug_locks_off(void); | |||
17 | ({ \ | 17 | ({ \ |
18 | int __ret = 0; \ | 18 | int __ret = 0; \ |
19 | \ | 19 | \ |
20 | if (unlikely(c)) { \ | 20 | if (!oops_in_progress && unlikely(c)) { \ |
21 | if (debug_locks_off() && !debug_locks_silent) \ | 21 | if (debug_locks_off() && !debug_locks_silent) \ |
22 | WARN_ON(1); \ | 22 | WARN_ON(1); \ |
23 | __ret = 1; \ | 23 | __ret = 1; \ |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 9c5bc6be2b09..985b28dc2ba9 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/kallsyms.h> | 10 | #include <linux/kallsyms.h> |
11 | #include <linux/bitops.h> | ||
12 | #include <linux/sched.h> | ||
11 | 13 | ||
12 | #ifdef CONFIG_FUNCTION_TRACER | 14 | #ifdef CONFIG_FUNCTION_TRACER |
13 | 15 | ||
@@ -24,6 +26,45 @@ struct ftrace_ops { | |||
24 | struct ftrace_ops *next; | 26 | struct ftrace_ops *next; |
25 | }; | 27 | }; |
26 | 28 | ||
29 | extern int function_trace_stop; | ||
30 | |||
31 | /* | ||
32 | * Type of the current tracing. | ||
33 | */ | ||
34 | enum ftrace_tracing_type_t { | ||
35 | FTRACE_TYPE_ENTER = 0, /* Hook the call of the function */ | ||
36 | FTRACE_TYPE_RETURN, /* Hook the return of the function */ | ||
37 | }; | ||
38 | |||
39 | /* Current tracing type, default is FTRACE_TYPE_ENTER */ | ||
40 | extern enum ftrace_tracing_type_t ftrace_tracing_type; | ||
41 | |||
42 | /** | ||
43 | * ftrace_stop - stop function tracer. | ||
44 | * | ||
45 | * A quick way to stop the function tracer. Note this an on off switch, | ||
46 | * it is not something that is recursive like preempt_disable. | ||
47 | * This does not disable the calling of mcount, it only stops the | ||
48 | * calling of functions from mcount. | ||
49 | */ | ||
50 | static inline void ftrace_stop(void) | ||
51 | { | ||
52 | function_trace_stop = 1; | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * ftrace_start - start the function tracer. | ||
57 | * | ||
58 | * This function is the inverse of ftrace_stop. This does not enable | ||
59 | * the function tracing if the function tracer is disabled. This only | ||
60 | * sets the function tracer flag to continue calling the functions | ||
61 | * from mcount. | ||
62 | */ | ||
63 | static inline void ftrace_start(void) | ||
64 | { | ||
65 | function_trace_stop = 0; | ||
66 | } | ||
67 | |||
27 | /* | 68 | /* |
28 | * The ftrace_ops must be a static and should also | 69 | * The ftrace_ops must be a static and should also |
29 | * be read_mostly. These functions do modify read_mostly variables | 70 | * be read_mostly. These functions do modify read_mostly variables |
@@ -42,9 +83,13 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1); | |||
42 | # define unregister_ftrace_function(ops) do { } while (0) | 83 | # define unregister_ftrace_function(ops) do { } while (0) |
43 | # define clear_ftrace_function(ops) do { } while (0) | 84 | # define clear_ftrace_function(ops) do { } while (0) |
44 | static inline void ftrace_kill(void) { } | 85 | static inline void ftrace_kill(void) { } |
86 | static inline void ftrace_stop(void) { } | ||
87 | static inline void ftrace_start(void) { } | ||
45 | #endif /* CONFIG_FUNCTION_TRACER */ | 88 | #endif /* CONFIG_FUNCTION_TRACER */ |
46 | 89 | ||
47 | #ifdef CONFIG_DYNAMIC_FTRACE | 90 | #ifdef CONFIG_DYNAMIC_FTRACE |
91 | /* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ | ||
92 | #include <asm/ftrace.h> | ||
48 | 93 | ||
49 | enum { | 94 | enum { |
50 | FTRACE_FL_FREE = (1 << 0), | 95 | FTRACE_FL_FREE = (1 << 0), |
@@ -60,6 +105,7 @@ struct dyn_ftrace { | |||
60 | struct list_head list; | 105 | struct list_head list; |
61 | unsigned long ip; /* address of mcount call-site */ | 106 | unsigned long ip; /* address of mcount call-site */ |
62 | unsigned long flags; | 107 | unsigned long flags; |
108 | struct dyn_arch_ftrace arch; | ||
63 | }; | 109 | }; |
64 | 110 | ||
65 | int ftrace_force_update(void); | 111 | int ftrace_force_update(void); |
@@ -67,19 +113,25 @@ void ftrace_set_filter(unsigned char *buf, int len, int reset); | |||
67 | 113 | ||
68 | /* defined in arch */ | 114 | /* defined in arch */ |
69 | extern int ftrace_ip_converted(unsigned long ip); | 115 | extern int ftrace_ip_converted(unsigned long ip); |
70 | extern unsigned char *ftrace_nop_replace(void); | ||
71 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); | ||
72 | extern int ftrace_dyn_arch_init(void *data); | 116 | extern int ftrace_dyn_arch_init(void *data); |
73 | extern int ftrace_update_ftrace_func(ftrace_func_t func); | 117 | extern int ftrace_update_ftrace_func(ftrace_func_t func); |
74 | extern void ftrace_caller(void); | 118 | extern void ftrace_caller(void); |
75 | extern void ftrace_call(void); | 119 | extern void ftrace_call(void); |
76 | extern void mcount_call(void); | 120 | extern void mcount_call(void); |
121 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
122 | extern void ftrace_graph_caller(void); | ||
123 | extern int ftrace_enable_ftrace_graph_caller(void); | ||
124 | extern int ftrace_disable_ftrace_graph_caller(void); | ||
125 | #else | ||
126 | static inline int ftrace_enable_ftrace_graph_caller(void) { return 0; } | ||
127 | static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; } | ||
128 | #endif | ||
77 | 129 | ||
78 | /** | 130 | /** |
79 | * ftrace_modify_code - modify code segment | 131 | * ftrace_make_nop - convert code into top |
80 | * @ip: the address of the code segment | 132 | * @mod: module structure if called by module load initialization |
81 | * @old_code: the contents of what is expected to be there | 133 | * @rec: the mcount call site record |
82 | * @new_code: the code to patch in | 134 | * @addr: the address that the call site should be calling |
83 | * | 135 | * |
84 | * This is a very sensitive operation and great care needs | 136 | * This is a very sensitive operation and great care needs |
85 | * to be taken by the arch. The operation should carefully | 137 | * to be taken by the arch. The operation should carefully |
@@ -87,6 +139,8 @@ extern void mcount_call(void); | |||
87 | * what we expect it to be, and then on success of the compare, | 139 | * what we expect it to be, and then on success of the compare, |
88 | * it should write to the location. | 140 | * it should write to the location. |
89 | * | 141 | * |
142 | * The code segment at @rec->ip should be a caller to @addr | ||
143 | * | ||
90 | * Return must be: | 144 | * Return must be: |
91 | * 0 on success | 145 | * 0 on success |
92 | * -EFAULT on error reading the location | 146 | * -EFAULT on error reading the location |
@@ -94,8 +148,34 @@ extern void mcount_call(void); | |||
94 | * -EPERM on error writing to the location | 148 | * -EPERM on error writing to the location |
95 | * Any other value will be considered a failure. | 149 | * Any other value will be considered a failure. |
96 | */ | 150 | */ |
97 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | 151 | extern int ftrace_make_nop(struct module *mod, |
98 | unsigned char *new_code); | 152 | struct dyn_ftrace *rec, unsigned long addr); |
153 | |||
154 | /** | ||
155 | * ftrace_make_call - convert a nop call site into a call to addr | ||
156 | * @rec: the mcount call site record | ||
157 | * @addr: the address that the call site should call | ||
158 | * | ||
159 | * This is a very sensitive operation and great care needs | ||
160 | * to be taken by the arch. The operation should carefully | ||
161 | * read the location, check to see if what is read is indeed | ||
162 | * what we expect it to be, and then on success of the compare, | ||
163 | * it should write to the location. | ||
164 | * | ||
165 | * The code segment at @rec->ip should be a nop | ||
166 | * | ||
167 | * Return must be: | ||
168 | * 0 on success | ||
169 | * -EFAULT on error reading the location | ||
170 | * -EINVAL on a failed compare of the contents | ||
171 | * -EPERM on error writing to the location | ||
172 | * Any other value will be considered a failure. | ||
173 | */ | ||
174 | extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); | ||
175 | |||
176 | |||
177 | /* May be defined in arch */ | ||
178 | extern int ftrace_arch_read_dyn_info(char *buf, int size); | ||
99 | 179 | ||
100 | extern int skip_trace(unsigned long ip); | 180 | extern int skip_trace(unsigned long ip); |
101 | 181 | ||
@@ -103,7 +183,6 @@ extern void ftrace_release(void *start, unsigned long size); | |||
103 | 183 | ||
104 | extern void ftrace_disable_daemon(void); | 184 | extern void ftrace_disable_daemon(void); |
105 | extern void ftrace_enable_daemon(void); | 185 | extern void ftrace_enable_daemon(void); |
106 | |||
107 | #else | 186 | #else |
108 | # define skip_trace(ip) ({ 0; }) | 187 | # define skip_trace(ip) ({ 0; }) |
109 | # define ftrace_force_update() ({ 0; }) | 188 | # define ftrace_force_update() ({ 0; }) |
@@ -182,6 +261,12 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
182 | #endif | 261 | #endif |
183 | 262 | ||
184 | #ifdef CONFIG_TRACING | 263 | #ifdef CONFIG_TRACING |
264 | extern int ftrace_dump_on_oops; | ||
265 | |||
266 | extern void tracing_start(void); | ||
267 | extern void tracing_stop(void); | ||
268 | extern void ftrace_off_permanent(void); | ||
269 | |||
185 | extern void | 270 | extern void |
186 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | 271 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); |
187 | 272 | ||
@@ -212,6 +297,9 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | |||
212 | static inline int | 297 | static inline int |
213 | ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0))); | 298 | ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0))); |
214 | 299 | ||
300 | static inline void tracing_start(void) { } | ||
301 | static inline void tracing_stop(void) { } | ||
302 | static inline void ftrace_off_permanent(void) { } | ||
215 | static inline int | 303 | static inline int |
216 | ftrace_printk(const char *fmt, ...) | 304 | ftrace_printk(const char *fmt, ...) |
217 | { | 305 | { |
@@ -222,33 +310,167 @@ static inline void ftrace_dump(void) { } | |||
222 | 310 | ||
223 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 311 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
224 | extern void ftrace_init(void); | 312 | extern void ftrace_init(void); |
225 | extern void ftrace_init_module(unsigned long *start, unsigned long *end); | 313 | extern void ftrace_init_module(struct module *mod, |
314 | unsigned long *start, unsigned long *end); | ||
226 | #else | 315 | #else |
227 | static inline void ftrace_init(void) { } | 316 | static inline void ftrace_init(void) { } |
228 | static inline void | 317 | static inline void |
229 | ftrace_init_module(unsigned long *start, unsigned long *end) { } | 318 | ftrace_init_module(struct module *mod, |
319 | unsigned long *start, unsigned long *end) { } | ||
230 | #endif | 320 | #endif |
231 | 321 | ||
322 | enum { | ||
323 | POWER_NONE = 0, | ||
324 | POWER_CSTATE = 1, | ||
325 | POWER_PSTATE = 2, | ||
326 | }; | ||
327 | |||
328 | struct power_trace { | ||
329 | #ifdef CONFIG_POWER_TRACER | ||
330 | ktime_t stamp; | ||
331 | ktime_t end; | ||
332 | int type; | ||
333 | int state; | ||
334 | #endif | ||
335 | }; | ||
336 | |||
337 | #ifdef CONFIG_POWER_TRACER | ||
338 | extern void trace_power_start(struct power_trace *it, unsigned int type, | ||
339 | unsigned int state); | ||
340 | extern void trace_power_mark(struct power_trace *it, unsigned int type, | ||
341 | unsigned int state); | ||
342 | extern void trace_power_end(struct power_trace *it); | ||
343 | #else | ||
344 | static inline void trace_power_start(struct power_trace *it, unsigned int type, | ||
345 | unsigned int state) { } | ||
346 | static inline void trace_power_mark(struct power_trace *it, unsigned int type, | ||
347 | unsigned int state) { } | ||
348 | static inline void trace_power_end(struct power_trace *it) { } | ||
349 | #endif | ||
350 | |||
351 | |||
352 | /* | ||
353 | * Structure that defines an entry function trace. | ||
354 | */ | ||
355 | struct ftrace_graph_ent { | ||
356 | unsigned long func; /* Current function */ | ||
357 | int depth; | ||
358 | }; | ||
232 | 359 | ||
233 | struct boot_trace { | 360 | /* |
234 | pid_t caller; | 361 | * Structure that defines a return function trace. |
235 | char func[KSYM_SYMBOL_LEN]; | 362 | */ |
236 | int result; | 363 | struct ftrace_graph_ret { |
237 | unsigned long long duration; /* usecs */ | 364 | unsigned long func; /* Current function */ |
238 | ktime_t calltime; | 365 | unsigned long long calltime; |
239 | ktime_t rettime; | 366 | unsigned long long rettime; |
367 | /* Number of functions that overran the depth limit for current task */ | ||
368 | unsigned long overrun; | ||
369 | int depth; | ||
240 | }; | 370 | }; |
241 | 371 | ||
242 | #ifdef CONFIG_BOOT_TRACER | 372 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
243 | extern void trace_boot(struct boot_trace *it, initcall_t fn); | 373 | |
244 | extern void start_boot_trace(void); | 374 | /* |
245 | extern void stop_boot_trace(void); | 375 | * Sometimes we don't want to trace a function with the function |
376 | * graph tracer but we want them to keep traced by the usual function | ||
377 | * tracer if the function graph tracer is not configured. | ||
378 | */ | ||
379 | #define __notrace_funcgraph notrace | ||
380 | |||
381 | #define FTRACE_RETFUNC_DEPTH 50 | ||
382 | #define FTRACE_RETSTACK_ALLOC_SIZE 32 | ||
383 | /* Type of the callback handlers for tracing function graph*/ | ||
384 | typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ | ||
385 | typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ | ||
386 | |||
387 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, | ||
388 | trace_func_graph_ent_t entryfunc); | ||
389 | |||
390 | extern void ftrace_graph_stop(void); | ||
391 | |||
392 | /* The current handlers in use */ | ||
393 | extern trace_func_graph_ret_t ftrace_graph_return; | ||
394 | extern trace_func_graph_ent_t ftrace_graph_entry; | ||
395 | |||
396 | extern void unregister_ftrace_graph(void); | ||
397 | |||
398 | extern void ftrace_graph_init_task(struct task_struct *t); | ||
399 | extern void ftrace_graph_exit_task(struct task_struct *t); | ||
400 | |||
401 | static inline int task_curr_ret_stack(struct task_struct *t) | ||
402 | { | ||
403 | return t->curr_ret_stack; | ||
404 | } | ||
405 | |||
406 | static inline void pause_graph_tracing(void) | ||
407 | { | ||
408 | atomic_inc(¤t->tracing_graph_pause); | ||
409 | } | ||
410 | |||
411 | static inline void unpause_graph_tracing(void) | ||
412 | { | ||
413 | atomic_dec(¤t->tracing_graph_pause); | ||
414 | } | ||
246 | #else | 415 | #else |
247 | static inline void trace_boot(struct boot_trace *it, initcall_t fn) { } | 416 | |
248 | static inline void start_boot_trace(void) { } | 417 | #define __notrace_funcgraph |
249 | static inline void stop_boot_trace(void) { } | 418 | |
419 | static inline void ftrace_graph_init_task(struct task_struct *t) { } | ||
420 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } | ||
421 | |||
422 | static inline int task_curr_ret_stack(struct task_struct *tsk) | ||
423 | { | ||
424 | return -1; | ||
425 | } | ||
426 | |||
427 | static inline void pause_graph_tracing(void) { } | ||
428 | static inline void unpause_graph_tracing(void) { } | ||
250 | #endif | 429 | #endif |
251 | 430 | ||
431 | #ifdef CONFIG_TRACING | ||
432 | #include <linux/sched.h> | ||
433 | |||
434 | /* flags for current->trace */ | ||
435 | enum { | ||
436 | TSK_TRACE_FL_TRACE_BIT = 0, | ||
437 | TSK_TRACE_FL_GRAPH_BIT = 1, | ||
438 | }; | ||
439 | enum { | ||
440 | TSK_TRACE_FL_TRACE = 1 << TSK_TRACE_FL_TRACE_BIT, | ||
441 | TSK_TRACE_FL_GRAPH = 1 << TSK_TRACE_FL_GRAPH_BIT, | ||
442 | }; | ||
443 | |||
444 | static inline void set_tsk_trace_trace(struct task_struct *tsk) | ||
445 | { | ||
446 | set_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace); | ||
447 | } | ||
448 | |||
449 | static inline void clear_tsk_trace_trace(struct task_struct *tsk) | ||
450 | { | ||
451 | clear_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace); | ||
452 | } | ||
453 | |||
454 | static inline int test_tsk_trace_trace(struct task_struct *tsk) | ||
455 | { | ||
456 | return tsk->trace & TSK_TRACE_FL_TRACE; | ||
457 | } | ||
458 | |||
459 | static inline void set_tsk_trace_graph(struct task_struct *tsk) | ||
460 | { | ||
461 | set_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace); | ||
462 | } | ||
463 | |||
464 | static inline void clear_tsk_trace_graph(struct task_struct *tsk) | ||
465 | { | ||
466 | clear_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace); | ||
467 | } | ||
468 | |||
469 | static inline int test_tsk_trace_graph(struct task_struct *tsk) | ||
470 | { | ||
471 | return tsk->trace & TSK_TRACE_FL_GRAPH; | ||
472 | } | ||
252 | 473 | ||
474 | #endif /* CONFIG_TRACING */ | ||
253 | 475 | ||
254 | #endif /* _LINUX_FTRACE_H */ | 476 | #endif /* _LINUX_FTRACE_H */ |
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h new file mode 100644 index 000000000000..366a054d0b05 --- /dev/null +++ b/include/linux/ftrace_irq.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _LINUX_FTRACE_IRQ_H | ||
2 | #define _LINUX_FTRACE_IRQ_H | ||
3 | |||
4 | |||
5 | #if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER) | ||
6 | extern void ftrace_nmi_enter(void); | ||
7 | extern void ftrace_nmi_exit(void); | ||
8 | #else | ||
9 | static inline void ftrace_nmi_enter(void) { } | ||
10 | static inline void ftrace_nmi_exit(void) { } | ||
11 | #endif | ||
12 | |||
13 | #endif /* _LINUX_FTRACE_IRQ_H */ | ||
diff --git a/include/linux/futex.h b/include/linux/futex.h index 586ab56a3ec3..8f627b9ae2b1 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h | |||
@@ -164,6 +164,8 @@ union futex_key { | |||
164 | } both; | 164 | } both; |
165 | }; | 165 | }; |
166 | 166 | ||
167 | #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } | ||
168 | |||
167 | #ifdef CONFIG_FUTEX | 169 | #ifdef CONFIG_FUTEX |
168 | extern void exit_robust_list(struct task_struct *curr); | 170 | extern void exit_robust_list(struct task_struct *curr); |
169 | extern void exit_pi_state_list(struct task_struct *curr); | 171 | extern void exit_pi_state_list(struct task_struct *curr); |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 181006cc94a0..89a56d79e4c6 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/preempt.h> | 4 | #include <linux/preempt.h> |
5 | #include <linux/smp_lock.h> | 5 | #include <linux/smp_lock.h> |
6 | #include <linux/lockdep.h> | 6 | #include <linux/lockdep.h> |
7 | #include <linux/ftrace_irq.h> | ||
7 | #include <asm/hardirq.h> | 8 | #include <asm/hardirq.h> |
8 | #include <asm/system.h> | 9 | #include <asm/system.h> |
9 | 10 | ||
@@ -161,7 +162,17 @@ extern void irq_enter(void); | |||
161 | */ | 162 | */ |
162 | extern void irq_exit(void); | 163 | extern void irq_exit(void); |
163 | 164 | ||
164 | #define nmi_enter() do { lockdep_off(); __irq_enter(); } while (0) | 165 | #define nmi_enter() \ |
165 | #define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0) | 166 | do { \ |
167 | ftrace_nmi_enter(); \ | ||
168 | lockdep_off(); \ | ||
169 | __irq_enter(); \ | ||
170 | } while (0) | ||
171 | #define nmi_exit() \ | ||
172 | do { \ | ||
173 | __irq_exit(); \ | ||
174 | lockdep_on(); \ | ||
175 | ftrace_nmi_exit(); \ | ||
176 | } while (0) | ||
166 | 177 | ||
167 | #endif /* LINUX_HARDIRQ_H */ | 178 | #endif /* LINUX_HARDIRQ_H */ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 48e63934fabe..7e85a6e89e41 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/irqflags.h> | 14 | #include <linux/irqflags.h> |
15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <linux/percpu.h> | 16 | #include <linux/percpu.h> |
17 | #include <linux/irqnr.h> | ||
18 | |||
17 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
18 | #include <asm/ptrace.h> | 20 | #include <asm/ptrace.h> |
19 | #include <asm/system.h> | 21 | #include <asm/system.h> |
diff --git a/include/linux/irq.h b/include/linux/irq.h index ab70fd604d3a..59525b74979f 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -130,6 +130,8 @@ struct irq_chip { | |||
130 | const char *typename; | 130 | const char *typename; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | struct timer_rand_state; | ||
134 | struct irq_2_iommu; | ||
133 | /** | 135 | /** |
134 | * struct irq_desc - interrupt descriptor | 136 | * struct irq_desc - interrupt descriptor |
135 | * @irq: interrupt number for this descriptor | 137 | * @irq: interrupt number for this descriptor |
@@ -155,6 +157,13 @@ struct irq_chip { | |||
155 | */ | 157 | */ |
156 | struct irq_desc { | 158 | struct irq_desc { |
157 | unsigned int irq; | 159 | unsigned int irq; |
160 | #ifdef CONFIG_SPARSE_IRQ | ||
161 | struct timer_rand_state *timer_rand_state; | ||
162 | unsigned int *kstat_irqs; | ||
163 | # ifdef CONFIG_INTR_REMAP | ||
164 | struct irq_2_iommu *irq_2_iommu; | ||
165 | # endif | ||
166 | #endif | ||
158 | irq_flow_handler_t handle_irq; | 167 | irq_flow_handler_t handle_irq; |
159 | struct irq_chip *chip; | 168 | struct irq_chip *chip; |
160 | struct msi_desc *msi_desc; | 169 | struct msi_desc *msi_desc; |
@@ -182,14 +191,43 @@ struct irq_desc { | |||
182 | const char *name; | 191 | const char *name; |
183 | } ____cacheline_internodealigned_in_smp; | 192 | } ____cacheline_internodealigned_in_smp; |
184 | 193 | ||
194 | extern void early_irq_init(void); | ||
195 | extern void arch_early_irq_init(void); | ||
196 | extern void arch_init_chip_data(struct irq_desc *desc, int cpu); | ||
197 | extern void arch_init_copy_chip_data(struct irq_desc *old_desc, | ||
198 | struct irq_desc *desc, int cpu); | ||
199 | extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc); | ||
185 | 200 | ||
201 | #ifndef CONFIG_SPARSE_IRQ | ||
186 | extern struct irq_desc irq_desc[NR_IRQS]; | 202 | extern struct irq_desc irq_desc[NR_IRQS]; |
187 | 203 | ||
188 | static inline struct irq_desc *irq_to_desc(unsigned int irq) | 204 | static inline struct irq_desc *irq_to_desc(unsigned int irq) |
189 | { | 205 | { |
190 | return (irq < nr_irqs) ? irq_desc + irq : NULL; | 206 | return (irq < NR_IRQS) ? irq_desc + irq : NULL; |
207 | } | ||
208 | static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | ||
209 | { | ||
210 | return irq_to_desc(irq); | ||
191 | } | 211 | } |
192 | 212 | ||
213 | #else | ||
214 | |||
215 | extern struct irq_desc *irq_to_desc(unsigned int irq); | ||
216 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | ||
217 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); | ||
218 | |||
219 | # define for_each_irq_desc(irq, desc) \ | ||
220 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) | ||
221 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
222 | for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) | ||
223 | |||
224 | #define kstat_irqs_this_cpu(DESC) \ | ||
225 | ((DESC)->kstat_irqs[smp_processor_id()]) | ||
226 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | ||
227 | ((DESC)->kstat_irqs[smp_processor_id()]++) | ||
228 | |||
229 | #endif | ||
230 | |||
193 | /* | 231 | /* |
194 | * Migration helpers for obsolete names, they will go away: | 232 | * Migration helpers for obsolete names, they will go away: |
195 | */ | 233 | */ |
@@ -381,6 +419,11 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
381 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) | 419 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) |
382 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) | 420 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) |
383 | 421 | ||
422 | #define get_irq_desc_chip(desc) ((desc)->chip) | ||
423 | #define get_irq_desc_chip_data(desc) ((desc)->chip_data) | ||
424 | #define get_irq_desc_data(desc) ((desc)->handler_data) | ||
425 | #define get_irq_desc_msi(desc) ((desc)->msi_desc) | ||
426 | |||
384 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 427 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
385 | 428 | ||
386 | #endif /* !CONFIG_S390 */ | 429 | #endif /* !CONFIG_S390 */ |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 452c280c8115..95d2b74641f5 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
@@ -1,24 +1,38 @@ | |||
1 | #ifndef _LINUX_IRQNR_H | 1 | #ifndef _LINUX_IRQNR_H |
2 | #define _LINUX_IRQNR_H | 2 | #define _LINUX_IRQNR_H |
3 | 3 | ||
4 | /* | ||
5 | * Generic irq_desc iterators: | ||
6 | */ | ||
7 | #ifdef __KERNEL__ | ||
8 | |||
4 | #ifndef CONFIG_GENERIC_HARDIRQS | 9 | #ifndef CONFIG_GENERIC_HARDIRQS |
5 | #include <asm/irq.h> | 10 | #include <asm/irq.h> |
6 | # define nr_irqs NR_IRQS | 11 | # define nr_irqs NR_IRQS |
7 | 12 | ||
8 | # define for_each_irq_desc(irq, desc) \ | 13 | # define for_each_irq_desc(irq, desc) \ |
9 | for (irq = 0; irq < nr_irqs; irq++) | 14 | for (irq = 0; irq < nr_irqs; irq++) |
15 | |||
16 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
17 | for (irq = nr_irqs - 1; irq >= 0; irq--) | ||
10 | #else | 18 | #else |
19 | |||
11 | extern int nr_irqs; | 20 | extern int nr_irqs; |
12 | 21 | ||
22 | #ifndef CONFIG_SPARSE_IRQ | ||
23 | |||
24 | struct irq_desc; | ||
13 | # define for_each_irq_desc(irq, desc) \ | 25 | # define for_each_irq_desc(irq, desc) \ |
14 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) | 26 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) |
15 | 27 | # define for_each_irq_desc_reverse(irq, desc) \ | |
16 | # define for_each_irq_desc_reverse(irq, desc) \ | 28 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ |
17 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ | 29 | irq >= 0; irq--, desc--) |
18 | irq >= 0; irq--, desc--) | 30 | #endif |
19 | #endif | 31 | #endif |
20 | 32 | ||
21 | #define for_each_irq_nr(irq) \ | 33 | #define for_each_irq_nr(irq) \ |
22 | for (irq = 0; irq < nr_irqs; irq++) | 34 | for (irq = 0; irq < nr_irqs; irq++) |
35 | |||
36 | #endif /* __KERNEL__ */ | ||
23 | 37 | ||
24 | #endif | 38 | #endif |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index dc7e0d0a6474..269df5a17b30 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -141,6 +141,15 @@ extern int _cond_resched(void); | |||
141 | (__x < 0) ? -__x : __x; \ | 141 | (__x < 0) ? -__x : __x; \ |
142 | }) | 142 | }) |
143 | 143 | ||
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 | |||
144 | extern struct atomic_notifier_head panic_notifier_list; | 153 | extern struct atomic_notifier_head panic_notifier_list; |
145 | extern long (*panic_blink)(long time); | 154 | extern long (*panic_blink)(long time); |
146 | NORET_TYPE void panic(const char * fmt, ...) | 155 | NORET_TYPE void panic(const char * fmt, ...) |
@@ -188,6 +197,8 @@ extern unsigned long long memparse(const char *ptr, char **retptr); | |||
188 | extern int core_kernel_text(unsigned long addr); | 197 | extern int core_kernel_text(unsigned long addr); |
189 | extern int __kernel_text_address(unsigned long addr); | 198 | extern int __kernel_text_address(unsigned long addr); |
190 | extern int kernel_text_address(unsigned long addr); | 199 | extern int kernel_text_address(unsigned long addr); |
200 | extern int func_ptr_is_kernel_text(void *ptr); | ||
201 | |||
191 | struct pid; | 202 | struct pid; |
192 | extern struct pid *session_of_pgrp(struct pid *pgrp); | 203 | extern struct pid *session_of_pgrp(struct pid *pgrp); |
193 | 204 | ||
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 4a145caeee07..4ee4b3d2316f 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -28,7 +28,9 @@ struct cpu_usage_stat { | |||
28 | 28 | ||
29 | struct kernel_stat { | 29 | struct kernel_stat { |
30 | struct cpu_usage_stat cpustat; | 30 | struct cpu_usage_stat cpustat; |
31 | unsigned int irqs[NR_IRQS]; | 31 | #ifndef CONFIG_SPARSE_IRQ |
32 | unsigned int irqs[NR_IRQS]; | ||
33 | #endif | ||
32 | }; | 34 | }; |
33 | 35 | ||
34 | DECLARE_PER_CPU(struct kernel_stat, kstat); | 36 | DECLARE_PER_CPU(struct kernel_stat, kstat); |
@@ -39,6 +41,10 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); | |||
39 | 41 | ||
40 | extern unsigned long long nr_context_switches(void); | 42 | extern unsigned long long nr_context_switches(void); |
41 | 43 | ||
44 | #ifndef CONFIG_SPARSE_IRQ | ||
45 | #define kstat_irqs_this_cpu(irq) \ | ||
46 | (kstat_this_cpu.irqs[irq]) | ||
47 | |||
42 | struct irq_desc; | 48 | struct irq_desc; |
43 | 49 | ||
44 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | 50 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, |
@@ -46,11 +52,17 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | |||
46 | { | 52 | { |
47 | kstat_this_cpu.irqs[irq]++; | 53 | kstat_this_cpu.irqs[irq]++; |
48 | } | 54 | } |
55 | #endif | ||
56 | |||
49 | 57 | ||
58 | #ifndef CONFIG_SPARSE_IRQ | ||
50 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 59 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
51 | { | 60 | { |
52 | return kstat_cpu(cpu).irqs[irq]; | 61 | return kstat_cpu(cpu).irqs[irq]; |
53 | } | 62 | } |
63 | #else | ||
64 | extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); | ||
65 | #endif | ||
54 | 66 | ||
55 | /* | 67 | /* |
56 | * Number of interrupts per specific IRQ source, since bootup | 68 | * Number of interrupts per specific IRQ source, since bootup |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 29aec6e10020..8956daf64abd 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -73,6 +73,8 @@ struct lock_class_key { | |||
73 | struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; | 73 | struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #define LOCKSTAT_POINTS 4 | ||
77 | |||
76 | /* | 78 | /* |
77 | * The lock-class itself: | 79 | * The lock-class itself: |
78 | */ | 80 | */ |
@@ -119,7 +121,8 @@ struct lock_class { | |||
119 | int name_version; | 121 | int name_version; |
120 | 122 | ||
121 | #ifdef CONFIG_LOCK_STAT | 123 | #ifdef CONFIG_LOCK_STAT |
122 | unsigned long contention_point[4]; | 124 | unsigned long contention_point[LOCKSTAT_POINTS]; |
125 | unsigned long contending_point[LOCKSTAT_POINTS]; | ||
123 | #endif | 126 | #endif |
124 | }; | 127 | }; |
125 | 128 | ||
@@ -144,6 +147,7 @@ enum bounce_type { | |||
144 | 147 | ||
145 | struct lock_class_stats { | 148 | struct lock_class_stats { |
146 | unsigned long contention_point[4]; | 149 | unsigned long contention_point[4]; |
150 | unsigned long contending_point[4]; | ||
147 | struct lock_time read_waittime; | 151 | struct lock_time read_waittime; |
148 | struct lock_time write_waittime; | 152 | struct lock_time write_waittime; |
149 | struct lock_time read_holdtime; | 153 | struct lock_time read_holdtime; |
@@ -165,6 +169,7 @@ struct lockdep_map { | |||
165 | const char *name; | 169 | const char *name; |
166 | #ifdef CONFIG_LOCK_STAT | 170 | #ifdef CONFIG_LOCK_STAT |
167 | int cpu; | 171 | int cpu; |
172 | unsigned long ip; | ||
168 | #endif | 173 | #endif |
169 | }; | 174 | }; |
170 | 175 | ||
@@ -356,7 +361,7 @@ struct lock_class_key { }; | |||
356 | #ifdef CONFIG_LOCK_STAT | 361 | #ifdef CONFIG_LOCK_STAT |
357 | 362 | ||
358 | extern void lock_contended(struct lockdep_map *lock, unsigned long ip); | 363 | extern void lock_contended(struct lockdep_map *lock, unsigned long ip); |
359 | extern void lock_acquired(struct lockdep_map *lock); | 364 | extern void lock_acquired(struct lockdep_map *lock, unsigned long ip); |
360 | 365 | ||
361 | #define LOCK_CONTENDED(_lock, try, lock) \ | 366 | #define LOCK_CONTENDED(_lock, try, lock) \ |
362 | do { \ | 367 | do { \ |
@@ -364,13 +369,13 @@ do { \ | |||
364 | lock_contended(&(_lock)->dep_map, _RET_IP_); \ | 369 | lock_contended(&(_lock)->dep_map, _RET_IP_); \ |
365 | lock(_lock); \ | 370 | lock(_lock); \ |
366 | } \ | 371 | } \ |
367 | lock_acquired(&(_lock)->dep_map); \ | 372 | lock_acquired(&(_lock)->dep_map, _RET_IP_); \ |
368 | } while (0) | 373 | } while (0) |
369 | 374 | ||
370 | #else /* CONFIG_LOCK_STAT */ | 375 | #else /* CONFIG_LOCK_STAT */ |
371 | 376 | ||
372 | #define lock_contended(lockdep_map, ip) do {} while (0) | 377 | #define lock_contended(lockdep_map, ip) do {} while (0) |
373 | #define lock_acquired(lockdep_map) do {} while (0) | 378 | #define lock_acquired(lockdep_map, ip) do {} while (0) |
374 | 379 | ||
375 | #define LOCK_CONTENDED(_lock, try, lock) \ | 380 | #define LOCK_CONTENDED(_lock, try, lock) \ |
376 | lock(_lock) | 381 | lock(_lock) |
@@ -481,4 +486,22 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
481 | # define lock_map_release(l) do { } while (0) | 486 | # define lock_map_release(l) do { } while (0) |
482 | #endif | 487 | #endif |
483 | 488 | ||
489 | #ifdef CONFIG_PROVE_LOCKING | ||
490 | # define might_lock(lock) \ | ||
491 | do { \ | ||
492 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ | ||
493 | lock_acquire(&(lock)->dep_map, 0, 0, 0, 2, NULL, _THIS_IP_); \ | ||
494 | lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ | ||
495 | } while (0) | ||
496 | # define might_lock_read(lock) \ | ||
497 | do { \ | ||
498 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ | ||
499 | lock_acquire(&(lock)->dep_map, 0, 0, 1, 2, NULL, _THIS_IP_); \ | ||
500 | lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ | ||
501 | } while (0) | ||
502 | #else | ||
503 | # define might_lock(lock) do { } while (0) | ||
504 | # define might_lock_read(lock) do { } while (0) | ||
505 | #endif | ||
506 | |||
484 | #endif /* __LINUX_LOCKDEP_H */ | 507 | #endif /* __LINUX_LOCKDEP_H */ |
diff --git a/include/linux/marker.h b/include/linux/marker.h index 889196c7fbb1..b85e74ca782f 100644 --- a/include/linux/marker.h +++ b/include/linux/marker.h | |||
@@ -12,6 +12,7 @@ | |||
12 | * See the file COPYING for more details. | 12 | * See the file COPYING for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <stdarg.h> | ||
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
16 | 17 | ||
17 | struct module; | 18 | struct module; |
@@ -48,10 +49,28 @@ struct marker { | |||
48 | void (*call)(const struct marker *mdata, void *call_private, ...); | 49 | void (*call)(const struct marker *mdata, void *call_private, ...); |
49 | struct marker_probe_closure single; | 50 | struct marker_probe_closure single; |
50 | struct marker_probe_closure *multi; | 51 | struct marker_probe_closure *multi; |
52 | const char *tp_name; /* Optional tracepoint name */ | ||
53 | void *tp_cb; /* Optional tracepoint callback */ | ||
51 | } __attribute__((aligned(8))); | 54 | } __attribute__((aligned(8))); |
52 | 55 | ||
53 | #ifdef CONFIG_MARKERS | 56 | #ifdef CONFIG_MARKERS |
54 | 57 | ||
58 | #define _DEFINE_MARKER(name, tp_name_str, tp_cb, format) \ | ||
59 | static const char __mstrtab_##name[] \ | ||
60 | __attribute__((section("__markers_strings"))) \ | ||
61 | = #name "\0" format; \ | ||
62 | static struct marker __mark_##name \ | ||
63 | __attribute__((section("__markers"), aligned(8))) = \ | ||
64 | { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \ | ||
65 | 0, 0, marker_probe_cb, { __mark_empty_function, NULL},\ | ||
66 | NULL, tp_name_str, tp_cb } | ||
67 | |||
68 | #define DEFINE_MARKER(name, format) \ | ||
69 | _DEFINE_MARKER(name, NULL, NULL, format) | ||
70 | |||
71 | #define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \ | ||
72 | _DEFINE_MARKER(name, #tp_name, tp_cb, format) | ||
73 | |||
55 | /* | 74 | /* |
56 | * Note : the empty asm volatile with read constraint is used here instead of a | 75 | * Note : the empty asm volatile with read constraint is used here instead of a |
57 | * "used" attribute to fix a gcc 4.1.x bug. | 76 | * "used" attribute to fix a gcc 4.1.x bug. |
@@ -65,14 +84,7 @@ struct marker { | |||
65 | */ | 84 | */ |
66 | #define __trace_mark(generic, name, call_private, format, args...) \ | 85 | #define __trace_mark(generic, name, call_private, format, args...) \ |
67 | do { \ | 86 | do { \ |
68 | static const char __mstrtab_##name[] \ | 87 | DEFINE_MARKER(name, format); \ |
69 | __attribute__((section("__markers_strings"))) \ | ||
70 | = #name "\0" format; \ | ||
71 | static struct marker __mark_##name \ | ||
72 | __attribute__((section("__markers"), aligned(8))) = \ | ||
73 | { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \ | ||
74 | 0, 0, marker_probe_cb, \ | ||
75 | { __mark_empty_function, NULL}, NULL }; \ | ||
76 | __mark_check_format(format, ## args); \ | 88 | __mark_check_format(format, ## args); \ |
77 | if (unlikely(__mark_##name.state)) { \ | 89 | if (unlikely(__mark_##name.state)) { \ |
78 | (*__mark_##name.call) \ | 90 | (*__mark_##name.call) \ |
@@ -80,14 +92,39 @@ struct marker { | |||
80 | } \ | 92 | } \ |
81 | } while (0) | 93 | } while (0) |
82 | 94 | ||
95 | #define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \ | ||
96 | do { \ | ||
97 | void __check_tp_type(void) \ | ||
98 | { \ | ||
99 | register_trace_##tp_name(tp_cb); \ | ||
100 | } \ | ||
101 | DEFINE_MARKER_TP(name, tp_name, tp_cb, format); \ | ||
102 | __mark_check_format(format, ## args); \ | ||
103 | (*__mark_##name.call)(&__mark_##name, call_private, \ | ||
104 | ## args); \ | ||
105 | } while (0) | ||
106 | |||
83 | extern void marker_update_probe_range(struct marker *begin, | 107 | extern void marker_update_probe_range(struct marker *begin, |
84 | struct marker *end); | 108 | struct marker *end); |
109 | |||
110 | #define GET_MARKER(name) (__mark_##name) | ||
111 | |||
85 | #else /* !CONFIG_MARKERS */ | 112 | #else /* !CONFIG_MARKERS */ |
113 | #define DEFINE_MARKER(name, tp_name, tp_cb, format) | ||
86 | #define __trace_mark(generic, name, call_private, format, args...) \ | 114 | #define __trace_mark(generic, name, call_private, format, args...) \ |
87 | __mark_check_format(format, ## args) | 115 | __mark_check_format(format, ## args) |
116 | #define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \ | ||
117 | do { \ | ||
118 | void __check_tp_type(void) \ | ||
119 | { \ | ||
120 | register_trace_##tp_name(tp_cb); \ | ||
121 | } \ | ||
122 | __mark_check_format(format, ## args); \ | ||
123 | } while (0) | ||
88 | static inline void marker_update_probe_range(struct marker *begin, | 124 | static inline void marker_update_probe_range(struct marker *begin, |
89 | struct marker *end) | 125 | struct marker *end) |
90 | { } | 126 | { } |
127 | #define GET_MARKER(name) | ||
91 | #endif /* CONFIG_MARKERS */ | 128 | #endif /* CONFIG_MARKERS */ |
92 | 129 | ||
93 | /** | 130 | /** |
@@ -117,6 +154,20 @@ static inline void marker_update_probe_range(struct marker *begin, | |||
117 | __trace_mark(1, name, NULL, format, ## args) | 154 | __trace_mark(1, name, NULL, format, ## args) |
118 | 155 | ||
119 | /** | 156 | /** |
157 | * trace_mark_tp - Marker in a tracepoint callback | ||
158 | * @name: marker name, not quoted. | ||
159 | * @tp_name: tracepoint name, not quoted. | ||
160 | * @tp_cb: tracepoint callback. Should have an associated global symbol so it | ||
161 | * is not optimized away by the compiler (should not be static). | ||
162 | * @format: format string | ||
163 | * @args...: variable argument list | ||
164 | * | ||
165 | * Places a marker in a tracepoint callback. | ||
166 | */ | ||
167 | #define trace_mark_tp(name, tp_name, tp_cb, format, args...) \ | ||
168 | __trace_mark_tp(name, NULL, tp_name, tp_cb, format, ## args) | ||
169 | |||
170 | /** | ||
120 | * MARK_NOARGS - Format string for a marker with no argument. | 171 | * MARK_NOARGS - Format string for a marker with no argument. |
121 | */ | 172 | */ |
122 | #define MARK_NOARGS " " | 173 | #define MARK_NOARGS " " |
@@ -136,8 +187,6 @@ extern marker_probe_func __mark_empty_function; | |||
136 | 187 | ||
137 | extern void marker_probe_cb(const struct marker *mdata, | 188 | extern void marker_probe_cb(const struct marker *mdata, |
138 | void *call_private, ...); | 189 | void *call_private, ...); |
139 | extern void marker_probe_cb_noarg(const struct marker *mdata, | ||
140 | void *call_private, ...); | ||
141 | 190 | ||
142 | /* | 191 | /* |
143 | * Connect a probe to a marker. | 192 | * Connect a probe to a marker. |
@@ -162,8 +211,10 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *probe, | |||
162 | 211 | ||
163 | /* | 212 | /* |
164 | * marker_synchronize_unregister must be called between the last marker probe | 213 | * marker_synchronize_unregister must be called between the last marker probe |
165 | * unregistration and the end of module exit to make sure there is no caller | 214 | * unregistration and the first one of |
166 | * executing a probe when it is freed. | 215 | * - the end of module exit function |
216 | * - the free of any resource used by the probes | ||
217 | * to ensure the code and data are valid for any possibly running probes. | ||
167 | */ | 218 | */ |
168 | #define marker_synchronize_unregister() synchronize_sched() | 219 | #define marker_synchronize_unregister() synchronize_sched() |
169 | 220 | ||
diff --git a/include/linux/msi.h b/include/linux/msi.h index 8f2939227207..d2b8a1e8ca11 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
@@ -10,8 +10,11 @@ struct msi_msg { | |||
10 | }; | 10 | }; |
11 | 11 | ||
12 | /* Helper functions */ | 12 | /* Helper functions */ |
13 | struct irq_desc; | ||
13 | extern void mask_msi_irq(unsigned int irq); | 14 | extern void mask_msi_irq(unsigned int irq); |
14 | extern void unmask_msi_irq(unsigned int irq); | 15 | extern void unmask_msi_irq(unsigned int irq); |
16 | extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); | ||
17 | extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); | ||
15 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); | 18 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); |
16 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); | 19 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); |
17 | 20 | ||
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index bc6da10ceee0..7a0e5c4f8072 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
@@ -144,6 +144,8 @@ extern int __must_check mutex_lock_killable(struct mutex *lock); | |||
144 | /* | 144 | /* |
145 | * NOTE: mutex_trylock() follows the spin_trylock() convention, | 145 | * NOTE: mutex_trylock() follows the spin_trylock() convention, |
146 | * not the down_trylock() convention! | 146 | * not the down_trylock() convention! |
147 | * | ||
148 | * Returns 1 if the mutex has been acquired successfully, and 0 on contention. | ||
147 | */ | 149 | */ |
148 | extern int mutex_trylock(struct mutex *lock); | 150 | extern int mutex_trylock(struct mutex *lock); |
149 | extern void mutex_unlock(struct mutex *lock); | 151 | extern void mutex_unlock(struct mutex *lock); |
diff --git a/include/linux/pid.h b/include/linux/pid.h index d7e98ff8021e..bb206c56d1f0 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -147,9 +147,9 @@ pid_t pid_vnr(struct pid *pid); | |||
147 | #define do_each_pid_task(pid, type, task) \ | 147 | #define do_each_pid_task(pid, type, task) \ |
148 | do { \ | 148 | do { \ |
149 | struct hlist_node *pos___; \ | 149 | struct hlist_node *pos___; \ |
150 | if (pid != NULL) \ | 150 | if ((pid) != NULL) \ |
151 | hlist_for_each_entry_rcu((task), pos___, \ | 151 | hlist_for_each_entry_rcu((task), pos___, \ |
152 | &pid->tasks[type], pids[type].node) { | 152 | &(pid)->tasks[type], pids[type].node) { |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * Both old and new leaders may be attached to | 155 | * Both old and new leaders may be attached to |
diff --git a/include/linux/random.h b/include/linux/random.h index 36f125c0c603..adbf3bd3c6b3 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #define _LINUX_RANDOM_H | 8 | #define _LINUX_RANDOM_H |
9 | 9 | ||
10 | #include <linux/ioctl.h> | 10 | #include <linux/ioctl.h> |
11 | #include <linux/irqnr.h> | ||
11 | 12 | ||
12 | /* ioctl()'s for the random number generator */ | 13 | /* ioctl()'s for the random number generator */ |
13 | 14 | ||
@@ -44,6 +45,56 @@ struct rand_pool_info { | |||
44 | 45 | ||
45 | extern void rand_initialize_irq(int irq); | 46 | extern void rand_initialize_irq(int irq); |
46 | 47 | ||
48 | struct timer_rand_state; | ||
49 | #ifndef CONFIG_SPARSE_IRQ | ||
50 | |||
51 | extern struct timer_rand_state *irq_timer_state[]; | ||
52 | |||
53 | static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
54 | { | ||
55 | if (irq >= nr_irqs) | ||
56 | return NULL; | ||
57 | |||
58 | return irq_timer_state[irq]; | ||
59 | } | ||
60 | |||
61 | static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) | ||
62 | { | ||
63 | if (irq >= nr_irqs) | ||
64 | return; | ||
65 | |||
66 | irq_timer_state[irq] = state; | ||
67 | } | ||
68 | |||
69 | #else | ||
70 | |||
71 | #include <linux/irq.h> | ||
72 | static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
73 | { | ||
74 | struct irq_desc *desc; | ||
75 | |||
76 | desc = irq_to_desc(irq); | ||
77 | |||
78 | if (!desc) | ||
79 | return NULL; | ||
80 | |||
81 | return desc->timer_rand_state; | ||
82 | } | ||
83 | |||
84 | static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) | ||
85 | { | ||
86 | struct irq_desc *desc; | ||
87 | |||
88 | desc = irq_to_desc(irq); | ||
89 | |||
90 | if (!desc) | ||
91 | return; | ||
92 | |||
93 | desc->timer_rand_state = state; | ||
94 | } | ||
95 | #endif | ||
96 | |||
97 | |||
47 | extern void add_input_randomness(unsigned int type, unsigned int code, | 98 | extern void add_input_randomness(unsigned int type, unsigned int code, |
48 | unsigned int value); | 99 | unsigned int value); |
49 | extern void add_interrupt_randomness(int irq); | 100 | extern void add_interrupt_randomness(int irq); |
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h index 5f89b62e6983..301dda829e37 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/seqlock.h> | 41 | #include <linux/seqlock.h> |
42 | 42 | ||
43 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | 43 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR |
44 | #define RCU_SECONDS_TILL_STALL_CHECK ( 3 * HZ) /* for rcp->jiffies_stall */ | 44 | #define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rcp->jiffies_stall */ |
45 | #define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */ | 45 | #define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */ |
46 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | 46 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ |
47 | 47 | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 86f1f5e43e33..895dc9c1088c 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -142,6 +142,7 @@ struct rcu_head { | |||
142 | * on the write-side to insure proper synchronization. | 142 | * on the write-side to insure proper synchronization. |
143 | */ | 143 | */ |
144 | #define rcu_read_lock_sched() preempt_disable() | 144 | #define rcu_read_lock_sched() preempt_disable() |
145 | #define rcu_read_lock_sched_notrace() preempt_disable_notrace() | ||
145 | 146 | ||
146 | /* | 147 | /* |
147 | * rcu_read_unlock_sched - marks the end of a RCU-classic critical section | 148 | * rcu_read_unlock_sched - marks the end of a RCU-classic critical section |
@@ -149,6 +150,7 @@ struct rcu_head { | |||
149 | * See rcu_read_lock_sched for more information. | 150 | * See rcu_read_lock_sched for more information. |
150 | */ | 151 | */ |
151 | #define rcu_read_unlock_sched() preempt_enable() | 152 | #define rcu_read_unlock_sched() preempt_enable() |
153 | #define rcu_read_unlock_sched_notrace() preempt_enable_notrace() | ||
152 | 154 | ||
153 | 155 | ||
154 | 156 | ||
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index e097c2e6b6dc..d363467c8f13 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -28,17 +28,19 @@ struct ring_buffer_event { | |||
28 | * size = 8 bytes | 28 | * size = 8 bytes |
29 | * | 29 | * |
30 | * @RINGBUF_TYPE_TIME_STAMP: Sync time stamp with external clock | 30 | * @RINGBUF_TYPE_TIME_STAMP: Sync time stamp with external clock |
31 | * array[0] = tv_nsec | 31 | * array[0] = tv_nsec |
32 | * array[1] = tv_sec | 32 | * array[1..2] = tv_sec |
33 | * size = 16 bytes | 33 | * size = 16 bytes |
34 | * | 34 | * |
35 | * @RINGBUF_TYPE_DATA: Data record | 35 | * @RINGBUF_TYPE_DATA: Data record |
36 | * If len is zero: | 36 | * If len is zero: |
37 | * array[0] holds the actual length | 37 | * array[0] holds the actual length |
38 | * array[1..(length+3)/4-1] holds data | 38 | * array[1..(length+3)/4] holds data |
39 | * size = 4 + 4 + length (bytes) | ||
39 | * else | 40 | * else |
40 | * length = len << 2 | 41 | * length = len << 2 |
41 | * array[0..(length+3)/4] holds data | 42 | * array[0..(length+3)/4-1] holds data |
43 | * size = 4 + length (bytes) | ||
42 | */ | 44 | */ |
43 | enum ring_buffer_type { | 45 | enum ring_buffer_type { |
44 | RINGBUF_TYPE_PADDING, | 46 | RINGBUF_TYPE_PADDING, |
@@ -122,6 +124,12 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); | |||
122 | 124 | ||
123 | void tracing_on(void); | 125 | void tracing_on(void); |
124 | void tracing_off(void); | 126 | void tracing_off(void); |
127 | void tracing_off_permanent(void); | ||
128 | |||
129 | void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); | ||
130 | void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); | ||
131 | int ring_buffer_read_page(struct ring_buffer *buffer, | ||
132 | void **data_page, int cpu, int full); | ||
125 | 133 | ||
126 | enum ring_buffer_flags { | 134 | enum ring_buffer_flags { |
127 | RB_FL_OVERWRITE = 1 << 0, | 135 | RB_FL_OVERWRITE = 1 << 0, |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 55e30d114477..4240f6bfa812 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -96,6 +96,7 @@ struct exec_domain; | |||
96 | struct futex_pi_state; | 96 | struct futex_pi_state; |
97 | struct robust_list_head; | 97 | struct robust_list_head; |
98 | struct bio; | 98 | struct bio; |
99 | struct bts_tracer; | ||
99 | 100 | ||
100 | /* | 101 | /* |
101 | * List of flags we want to share for kernel threads, | 102 | * List of flags we want to share for kernel threads, |
@@ -249,7 +250,7 @@ extern void init_idle_bootup_task(struct task_struct *idle); | |||
249 | extern int runqueue_is_locked(void); | 250 | extern int runqueue_is_locked(void); |
250 | extern void task_rq_unlock_wait(struct task_struct *p); | 251 | extern void task_rq_unlock_wait(struct task_struct *p); |
251 | 252 | ||
252 | extern cpumask_t nohz_cpu_mask; | 253 | extern cpumask_var_t nohz_cpu_mask; |
253 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) | 254 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) |
254 | extern int select_nohz_load_balancer(int cpu); | 255 | extern int select_nohz_load_balancer(int cpu); |
255 | #else | 256 | #else |
@@ -259,8 +260,6 @@ static inline int select_nohz_load_balancer(int cpu) | |||
259 | } | 260 | } |
260 | #endif | 261 | #endif |
261 | 262 | ||
262 | extern unsigned long rt_needs_cpu(int cpu); | ||
263 | |||
264 | /* | 263 | /* |
265 | * Only dump TASK_* tasks. (0 for all tasks) | 264 | * Only dump TASK_* tasks. (0 for all tasks) |
266 | */ | 265 | */ |
@@ -777,7 +776,6 @@ enum cpu_idle_type { | |||
777 | 776 | ||
778 | struct sched_group { | 777 | struct sched_group { |
779 | struct sched_group *next; /* Must be a circular list */ | 778 | struct sched_group *next; /* Must be a circular list */ |
780 | cpumask_t cpumask; | ||
781 | 779 | ||
782 | /* | 780 | /* |
783 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a | 781 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a |
@@ -790,8 +788,15 @@ struct sched_group { | |||
790 | * (see include/linux/reciprocal_div.h) | 788 | * (see include/linux/reciprocal_div.h) |
791 | */ | 789 | */ |
792 | u32 reciprocal_cpu_power; | 790 | u32 reciprocal_cpu_power; |
791 | |||
792 | unsigned long cpumask[]; | ||
793 | }; | 793 | }; |
794 | 794 | ||
795 | static inline struct cpumask *sched_group_cpus(struct sched_group *sg) | ||
796 | { | ||
797 | return to_cpumask(sg->cpumask); | ||
798 | } | ||
799 | |||
795 | enum sched_domain_level { | 800 | enum sched_domain_level { |
796 | SD_LV_NONE = 0, | 801 | SD_LV_NONE = 0, |
797 | SD_LV_SIBLING, | 802 | SD_LV_SIBLING, |
@@ -815,7 +820,6 @@ struct sched_domain { | |||
815 | struct sched_domain *parent; /* top domain must be null terminated */ | 820 | struct sched_domain *parent; /* top domain must be null terminated */ |
816 | struct sched_domain *child; /* bottom domain must be null terminated */ | 821 | struct sched_domain *child; /* bottom domain must be null terminated */ |
817 | struct sched_group *groups; /* the balancing groups of the domain */ | 822 | struct sched_group *groups; /* the balancing groups of the domain */ |
818 | cpumask_t span; /* span of all CPUs in this domain */ | ||
819 | unsigned long min_interval; /* Minimum balance interval ms */ | 823 | unsigned long min_interval; /* Minimum balance interval ms */ |
820 | unsigned long max_interval; /* Maximum balance interval ms */ | 824 | unsigned long max_interval; /* Maximum balance interval ms */ |
821 | unsigned int busy_factor; /* less balancing by factor if busy */ | 825 | unsigned int busy_factor; /* less balancing by factor if busy */ |
@@ -870,9 +874,17 @@ struct sched_domain { | |||
870 | #ifdef CONFIG_SCHED_DEBUG | 874 | #ifdef CONFIG_SCHED_DEBUG |
871 | char *name; | 875 | char *name; |
872 | #endif | 876 | #endif |
877 | |||
878 | /* span of all CPUs in this domain */ | ||
879 | unsigned long span[]; | ||
873 | }; | 880 | }; |
874 | 881 | ||
875 | extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | 882 | static inline struct cpumask *sched_domain_span(struct sched_domain *sd) |
883 | { | ||
884 | return to_cpumask(sd->span); | ||
885 | } | ||
886 | |||
887 | extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, | ||
876 | struct sched_domain_attr *dattr_new); | 888 | struct sched_domain_attr *dattr_new); |
877 | extern int arch_reinit_sched_domains(void); | 889 | extern int arch_reinit_sched_domains(void); |
878 | 890 | ||
@@ -881,7 +893,7 @@ extern int arch_reinit_sched_domains(void); | |||
881 | struct sched_domain_attr; | 893 | struct sched_domain_attr; |
882 | 894 | ||
883 | static inline void | 895 | static inline void |
884 | partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | 896 | partition_sched_domains(int ndoms_new, struct cpumask *doms_new, |
885 | struct sched_domain_attr *dattr_new) | 897 | struct sched_domain_attr *dattr_new) |
886 | { | 898 | { |
887 | } | 899 | } |
@@ -963,7 +975,7 @@ struct sched_class { | |||
963 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 975 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); |
964 | 976 | ||
965 | void (*set_cpus_allowed)(struct task_struct *p, | 977 | void (*set_cpus_allowed)(struct task_struct *p, |
966 | const cpumask_t *newmask); | 978 | const struct cpumask *newmask); |
967 | 979 | ||
968 | void (*rq_online)(struct rq *rq); | 980 | void (*rq_online)(struct rq *rq); |
969 | void (*rq_offline)(struct rq *rq); | 981 | void (*rq_offline)(struct rq *rq); |
@@ -1165,6 +1177,18 @@ struct task_struct { | |||
1165 | struct list_head ptraced; | 1177 | struct list_head ptraced; |
1166 | struct list_head ptrace_entry; | 1178 | struct list_head ptrace_entry; |
1167 | 1179 | ||
1180 | #ifdef CONFIG_X86_PTRACE_BTS | ||
1181 | /* | ||
1182 | * This is the tracer handle for the ptrace BTS extension. | ||
1183 | * This field actually belongs to the ptracer task. | ||
1184 | */ | ||
1185 | struct bts_tracer *bts; | ||
1186 | /* | ||
1187 | * The buffer to hold the BTS data. | ||
1188 | */ | ||
1189 | void *bts_buffer; | ||
1190 | #endif /* CONFIG_X86_PTRACE_BTS */ | ||
1191 | |||
1168 | /* PID/PID hash table linkage. */ | 1192 | /* PID/PID hash table linkage. */ |
1169 | struct pid_link pids[PIDTYPE_MAX]; | 1193 | struct pid_link pids[PIDTYPE_MAX]; |
1170 | struct list_head thread_group; | 1194 | struct list_head thread_group; |
@@ -1356,6 +1380,23 @@ struct task_struct { | |||
1356 | unsigned long default_timer_slack_ns; | 1380 | unsigned long default_timer_slack_ns; |
1357 | 1381 | ||
1358 | struct list_head *scm_work_list; | 1382 | struct list_head *scm_work_list; |
1383 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
1384 | /* Index of current stored adress in ret_stack */ | ||
1385 | int curr_ret_stack; | ||
1386 | /* Stack of return addresses for return function tracing */ | ||
1387 | struct ftrace_ret_stack *ret_stack; | ||
1388 | /* | ||
1389 | * Number of functions that haven't been traced | ||
1390 | * because of depth overrun. | ||
1391 | */ | ||
1392 | atomic_t trace_overrun; | ||
1393 | /* Pause for the tracing */ | ||
1394 | atomic_t tracing_graph_pause; | ||
1395 | #endif | ||
1396 | #ifdef CONFIG_TRACING | ||
1397 | /* state flags for use by tracers */ | ||
1398 | unsigned long trace; | ||
1399 | #endif | ||
1359 | }; | 1400 | }; |
1360 | 1401 | ||
1361 | /* | 1402 | /* |
@@ -1594,12 +1635,12 @@ extern cputime_t task_gtime(struct task_struct *p); | |||
1594 | 1635 | ||
1595 | #ifdef CONFIG_SMP | 1636 | #ifdef CONFIG_SMP |
1596 | extern int set_cpus_allowed_ptr(struct task_struct *p, | 1637 | extern int set_cpus_allowed_ptr(struct task_struct *p, |
1597 | const cpumask_t *new_mask); | 1638 | const struct cpumask *new_mask); |
1598 | #else | 1639 | #else |
1599 | static inline int set_cpus_allowed_ptr(struct task_struct *p, | 1640 | static inline int set_cpus_allowed_ptr(struct task_struct *p, |
1600 | const cpumask_t *new_mask) | 1641 | const struct cpumask *new_mask) |
1601 | { | 1642 | { |
1602 | if (!cpu_isset(0, *new_mask)) | 1643 | if (!cpumask_test_cpu(0, new_mask)) |
1603 | return -EINVAL; | 1644 | return -EINVAL; |
1604 | return 0; | 1645 | return 0; |
1605 | } | 1646 | } |
@@ -2212,8 +2253,8 @@ __trace_special(void *__tr, void *__data, | |||
2212 | } | 2253 | } |
2213 | #endif | 2254 | #endif |
2214 | 2255 | ||
2215 | extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); | 2256 | extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); |
2216 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); | 2257 | extern long sched_getaffinity(pid_t pid, struct cpumask *mask); |
2217 | 2258 | ||
2218 | extern int sched_mc_power_savings, sched_smt_power_savings; | 2259 | extern int sched_mc_power_savings, sched_smt_power_savings; |
2219 | 2260 | ||
@@ -2224,6 +2265,7 @@ extern void normalize_rt_tasks(void); | |||
2224 | extern struct task_group init_task_group; | 2265 | extern struct task_group init_task_group; |
2225 | #ifdef CONFIG_USER_SCHED | 2266 | #ifdef CONFIG_USER_SCHED |
2226 | extern struct task_group root_task_group; | 2267 | extern struct task_group root_task_group; |
2268 | extern void set_tg_uid(struct user_struct *user); | ||
2227 | #endif | 2269 | #endif |
2228 | 2270 | ||
2229 | extern struct task_group *sched_create_group(struct task_group *parent); | 2271 | extern struct task_group *sched_create_group(struct task_group *parent); |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index dc50bcc282a8..b3dfa72f13b9 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -34,6 +34,7 @@ struct seq_operations { | |||
34 | 34 | ||
35 | #define SEQ_SKIP 1 | 35 | #define SEQ_SKIP 1 |
36 | 36 | ||
37 | char *mangle_path(char *s, char *p, char *esc); | ||
37 | int seq_open(struct file *, const struct seq_operations *); | 38 | int seq_open(struct file *, const struct seq_operations *); |
38 | ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); | 39 | ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); |
39 | loff_t seq_lseek(struct file *, loff_t, int); | 40 | loff_t seq_lseek(struct file *, loff_t, int); |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index b106fd8e0d5c..1a8cecc4f38c 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
@@ -15,9 +15,17 @@ extern void save_stack_trace_tsk(struct task_struct *tsk, | |||
15 | struct stack_trace *trace); | 15 | struct stack_trace *trace); |
16 | 16 | ||
17 | extern void print_stack_trace(struct stack_trace *trace, int spaces); | 17 | extern void print_stack_trace(struct stack_trace *trace, int spaces); |
18 | |||
19 | #ifdef CONFIG_USER_STACKTRACE_SUPPORT | ||
20 | extern void save_stack_trace_user(struct stack_trace *trace); | ||
21 | #else | ||
22 | # define save_stack_trace_user(trace) do { } while (0) | ||
23 | #endif | ||
24 | |||
18 | #else | 25 | #else |
19 | # define save_stack_trace(trace) do { } while (0) | 26 | # define save_stack_trace(trace) do { } while (0) |
20 | # define save_stack_trace_tsk(tsk, trace) do { } while (0) | 27 | # define save_stack_trace_tsk(tsk, trace) do { } while (0) |
28 | # define save_stack_trace_user(trace) do { } while (0) | ||
21 | # define print_stack_trace(trace, spaces) do { } while (0) | 29 | # define print_stack_trace(trace, spaces) do { } while (0) |
22 | #endif | 30 | #endif |
23 | 31 | ||
diff --git a/include/linux/topology.h b/include/linux/topology.h index 117f1b7405cf..0c5b5ac36d8e 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -49,7 +49,7 @@ | |||
49 | for_each_online_node(node) \ | 49 | for_each_online_node(node) \ |
50 | if (nr_cpus_node(node)) | 50 | if (nr_cpus_node(node)) |
51 | 51 | ||
52 | void arch_update_cpu_topology(void); | 52 | int arch_update_cpu_topology(void); |
53 | 53 | ||
54 | /* Conform to ACPI 2.0 SLIT distance definitions */ | 54 | /* Conform to ACPI 2.0 SLIT distance definitions */ |
55 | #define LOCAL_DISTANCE 10 | 55 | #define LOCAL_DISTANCE 10 |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index c5bb39c7a770..757005458366 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -24,8 +24,12 @@ struct tracepoint { | |||
24 | const char *name; /* Tracepoint name */ | 24 | const char *name; /* Tracepoint name */ |
25 | int state; /* State. */ | 25 | int state; /* State. */ |
26 | void **funcs; | 26 | void **funcs; |
27 | } __attribute__((aligned(8))); | 27 | } __attribute__((aligned(32))); /* |
28 | 28 | * Aligned on 32 bytes because it is | |
29 | * globally visible and gcc happily | ||
30 | * align these on the structure size. | ||
31 | * Keep in sync with vmlinux.lds.h. | ||
32 | */ | ||
29 | 33 | ||
30 | #define TPPROTO(args...) args | 34 | #define TPPROTO(args...) args |
31 | #define TPARGS(args...) args | 35 | #define TPARGS(args...) args |
@@ -40,14 +44,14 @@ struct tracepoint { | |||
40 | do { \ | 44 | do { \ |
41 | void **it_func; \ | 45 | void **it_func; \ |
42 | \ | 46 | \ |
43 | rcu_read_lock_sched(); \ | 47 | rcu_read_lock_sched_notrace(); \ |
44 | it_func = rcu_dereference((tp)->funcs); \ | 48 | it_func = rcu_dereference((tp)->funcs); \ |
45 | if (it_func) { \ | 49 | if (it_func) { \ |
46 | do { \ | 50 | do { \ |
47 | ((void(*)(proto))(*it_func))(args); \ | 51 | ((void(*)(proto))(*it_func))(args); \ |
48 | } while (*(++it_func)); \ | 52 | } while (*(++it_func)); \ |
49 | } \ | 53 | } \ |
50 | rcu_read_unlock_sched(); \ | 54 | rcu_read_unlock_sched_notrace(); \ |
51 | } while (0) | 55 | } while (0) |
52 | 56 | ||
53 | /* | 57 | /* |
@@ -55,35 +59,40 @@ struct tracepoint { | |||
55 | * not add unwanted padding between the beginning of the section and the | 59 | * not add unwanted padding between the beginning of the section and the |
56 | * structure. Force alignment to the same alignment as the section start. | 60 | * structure. Force alignment to the same alignment as the section start. |
57 | */ | 61 | */ |
58 | #define DEFINE_TRACE(name, proto, args) \ | 62 | #define DECLARE_TRACE(name, proto, args) \ |
63 | extern struct tracepoint __tracepoint_##name; \ | ||
59 | static inline void trace_##name(proto) \ | 64 | static inline void trace_##name(proto) \ |
60 | { \ | 65 | { \ |
61 | static const char __tpstrtab_##name[] \ | ||
62 | __attribute__((section("__tracepoints_strings"))) \ | ||
63 | = #name ":" #proto; \ | ||
64 | static struct tracepoint __tracepoint_##name \ | ||
65 | __attribute__((section("__tracepoints"), aligned(8))) = \ | ||
66 | { __tpstrtab_##name, 0, NULL }; \ | ||
67 | if (unlikely(__tracepoint_##name.state)) \ | 66 | if (unlikely(__tracepoint_##name.state)) \ |
68 | __DO_TRACE(&__tracepoint_##name, \ | 67 | __DO_TRACE(&__tracepoint_##name, \ |
69 | TPPROTO(proto), TPARGS(args)); \ | 68 | TPPROTO(proto), TPARGS(args)); \ |
70 | } \ | 69 | } \ |
71 | static inline int register_trace_##name(void (*probe)(proto)) \ | 70 | static inline int register_trace_##name(void (*probe)(proto)) \ |
72 | { \ | 71 | { \ |
73 | return tracepoint_probe_register(#name ":" #proto, \ | 72 | return tracepoint_probe_register(#name, (void *)probe); \ |
74 | (void *)probe); \ | ||
75 | } \ | 73 | } \ |
76 | static inline void unregister_trace_##name(void (*probe)(proto))\ | 74 | static inline int unregister_trace_##name(void (*probe)(proto)) \ |
77 | { \ | 75 | { \ |
78 | tracepoint_probe_unregister(#name ":" #proto, \ | 76 | return tracepoint_probe_unregister(#name, (void *)probe);\ |
79 | (void *)probe); \ | ||
80 | } | 77 | } |
81 | 78 | ||
79 | #define DEFINE_TRACE(name) \ | ||
80 | static const char __tpstrtab_##name[] \ | ||
81 | __attribute__((section("__tracepoints_strings"))) = #name; \ | ||
82 | struct tracepoint __tracepoint_##name \ | ||
83 | __attribute__((section("__tracepoints"), aligned(32))) = \ | ||
84 | { __tpstrtab_##name, 0, NULL } | ||
85 | |||
86 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ | ||
87 | EXPORT_SYMBOL_GPL(__tracepoint_##name) | ||
88 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ | ||
89 | EXPORT_SYMBOL(__tracepoint_##name) | ||
90 | |||
82 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | 91 | extern void tracepoint_update_probe_range(struct tracepoint *begin, |
83 | struct tracepoint *end); | 92 | struct tracepoint *end); |
84 | 93 | ||
85 | #else /* !CONFIG_TRACEPOINTS */ | 94 | #else /* !CONFIG_TRACEPOINTS */ |
86 | #define DEFINE_TRACE(name, proto, args) \ | 95 | #define DECLARE_TRACE(name, proto, args) \ |
87 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ | 96 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ |
88 | { } \ | 97 | { } \ |
89 | static inline void trace_##name(proto) \ | 98 | static inline void trace_##name(proto) \ |
@@ -92,8 +101,14 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin, | |||
92 | { \ | 101 | { \ |
93 | return -ENOSYS; \ | 102 | return -ENOSYS; \ |
94 | } \ | 103 | } \ |
95 | static inline void unregister_trace_##name(void (*probe)(proto))\ | 104 | static inline int unregister_trace_##name(void (*probe)(proto)) \ |
96 | { } | 105 | { \ |
106 | return -ENOSYS; \ | ||
107 | } | ||
108 | |||
109 | #define DEFINE_TRACE(name) | ||
110 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | ||
111 | #define EXPORT_TRACEPOINT_SYMBOL(name) | ||
97 | 112 | ||
98 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | 113 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, |
99 | struct tracepoint *end) | 114 | struct tracepoint *end) |
@@ -112,6 +127,10 @@ extern int tracepoint_probe_register(const char *name, void *probe); | |||
112 | */ | 127 | */ |
113 | extern int tracepoint_probe_unregister(const char *name, void *probe); | 128 | extern int tracepoint_probe_unregister(const char *name, void *probe); |
114 | 129 | ||
130 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
131 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
132 | extern void tracepoint_probe_update_all(void); | ||
133 | |||
115 | struct tracepoint_iter { | 134 | struct tracepoint_iter { |
116 | struct module *module; | 135 | struct module *module; |
117 | struct tracepoint *tracepoint; | 136 | struct tracepoint *tracepoint; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 3b8121d4e36f..eaec37c9d83d 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -325,7 +325,7 @@ extern struct class *tty_class; | |||
325 | * go away | 325 | * go away |
326 | */ | 326 | */ |
327 | 327 | ||
328 | extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty) | 328 | static inline struct tty_struct *tty_kref_get(struct tty_struct *tty) |
329 | { | 329 | { |
330 | if (tty) | 330 | if (tty) |
331 | kref_get(&tty->kref); | 331 | kref_get(&tty->kref); |
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index fec6decfb983..6b58367d145e 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
78 | \ | 78 | \ |
79 | set_fs(KERNEL_DS); \ | 79 | set_fs(KERNEL_DS); \ |
80 | pagefault_disable(); \ | 80 | pagefault_disable(); \ |
81 | ret = __get_user(retval, (__force typeof(retval) __user *)(addr)); \ | 81 | ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \ |
82 | pagefault_enable(); \ | 82 | pagefault_enable(); \ |
83 | set_fs(old_fs); \ | 83 | set_fs(old_fs); \ |
84 | ret; \ | 84 | ret; \ |
diff --git a/include/trace/block.h b/include/trace/block.h new file mode 100644 index 000000000000..25c6a1fd5b77 --- /dev/null +++ b/include/trace/block.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef _TRACE_BLOCK_H | ||
2 | #define _TRACE_BLOCK_H | ||
3 | |||
4 | #include <linux/blkdev.h> | ||
5 | #include <linux/tracepoint.h> | ||
6 | |||
7 | DECLARE_TRACE(block_rq_abort, | ||
8 | TPPROTO(struct request_queue *q, struct request *rq), | ||
9 | TPARGS(q, rq)); | ||
10 | |||
11 | DECLARE_TRACE(block_rq_insert, | ||
12 | TPPROTO(struct request_queue *q, struct request *rq), | ||
13 | TPARGS(q, rq)); | ||
14 | |||
15 | DECLARE_TRACE(block_rq_issue, | ||
16 | TPPROTO(struct request_queue *q, struct request *rq), | ||
17 | TPARGS(q, rq)); | ||
18 | |||
19 | DECLARE_TRACE(block_rq_requeue, | ||
20 | TPPROTO(struct request_queue *q, struct request *rq), | ||
21 | TPARGS(q, rq)); | ||
22 | |||
23 | DECLARE_TRACE(block_rq_complete, | ||
24 | TPPROTO(struct request_queue *q, struct request *rq), | ||
25 | TPARGS(q, rq)); | ||
26 | |||
27 | DECLARE_TRACE(block_bio_bounce, | ||
28 | TPPROTO(struct request_queue *q, struct bio *bio), | ||
29 | TPARGS(q, bio)); | ||
30 | |||
31 | DECLARE_TRACE(block_bio_complete, | ||
32 | TPPROTO(struct request_queue *q, struct bio *bio), | ||
33 | TPARGS(q, bio)); | ||
34 | |||
35 | DECLARE_TRACE(block_bio_backmerge, | ||
36 | TPPROTO(struct request_queue *q, struct bio *bio), | ||
37 | TPARGS(q, bio)); | ||
38 | |||
39 | DECLARE_TRACE(block_bio_frontmerge, | ||
40 | TPPROTO(struct request_queue *q, struct bio *bio), | ||
41 | TPARGS(q, bio)); | ||
42 | |||
43 | DECLARE_TRACE(block_bio_queue, | ||
44 | TPPROTO(struct request_queue *q, struct bio *bio), | ||
45 | TPARGS(q, bio)); | ||
46 | |||
47 | DECLARE_TRACE(block_getrq, | ||
48 | TPPROTO(struct request_queue *q, struct bio *bio, int rw), | ||
49 | TPARGS(q, bio, rw)); | ||
50 | |||
51 | DECLARE_TRACE(block_sleeprq, | ||
52 | TPPROTO(struct request_queue *q, struct bio *bio, int rw), | ||
53 | TPARGS(q, bio, rw)); | ||
54 | |||
55 | DECLARE_TRACE(block_plug, | ||
56 | TPPROTO(struct request_queue *q), | ||
57 | TPARGS(q)); | ||
58 | |||
59 | DECLARE_TRACE(block_unplug_timer, | ||
60 | TPPROTO(struct request_queue *q), | ||
61 | TPARGS(q)); | ||
62 | |||
63 | DECLARE_TRACE(block_unplug_io, | ||
64 | TPPROTO(struct request_queue *q), | ||
65 | TPARGS(q)); | ||
66 | |||
67 | DECLARE_TRACE(block_split, | ||
68 | TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), | ||
69 | TPARGS(q, bio, pdu)); | ||
70 | |||
71 | DECLARE_TRACE(block_remap, | ||
72 | TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev, | ||
73 | sector_t from, sector_t to), | ||
74 | TPARGS(q, bio, dev, from, to)); | ||
75 | |||
76 | #endif | ||
diff --git a/include/trace/boot.h b/include/trace/boot.h new file mode 100644 index 000000000000..088ea089e31d --- /dev/null +++ b/include/trace/boot.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef _LINUX_TRACE_BOOT_H | ||
2 | #define _LINUX_TRACE_BOOT_H | ||
3 | |||
4 | #include <linux/module.h> | ||
5 | #include <linux/kallsyms.h> | ||
6 | #include <linux/init.h> | ||
7 | |||
8 | /* | ||
9 | * Structure which defines the trace of an initcall | ||
10 | * while it is called. | ||
11 | * You don't have to fill the func field since it is | ||
12 | * only used internally by the tracer. | ||
13 | */ | ||
14 | struct boot_trace_call { | ||
15 | pid_t caller; | ||
16 | char func[KSYM_SYMBOL_LEN]; | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * Structure which defines the trace of an initcall | ||
21 | * while it returns. | ||
22 | */ | ||
23 | struct boot_trace_ret { | ||
24 | char func[KSYM_SYMBOL_LEN]; | ||
25 | int result; | ||
26 | unsigned long long duration; /* nsecs */ | ||
27 | }; | ||
28 | |||
29 | #ifdef CONFIG_BOOT_TRACER | ||
30 | /* Append the traces on the ring-buffer */ | ||
31 | extern void trace_boot_call(struct boot_trace_call *bt, initcall_t fn); | ||
32 | extern void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn); | ||
33 | |||
34 | /* Tells the tracer that smp_pre_initcall is finished. | ||
35 | * So we can start the tracing | ||
36 | */ | ||
37 | extern void start_boot_trace(void); | ||
38 | |||
39 | /* Resume the tracing of other necessary events | ||
40 | * such as sched switches | ||
41 | */ | ||
42 | extern void enable_boot_trace(void); | ||
43 | |||
44 | /* Suspend this tracing. Actually, only sched_switches tracing have | ||
45 | * to be suspended. Initcalls doesn't need it.) | ||
46 | */ | ||
47 | extern void disable_boot_trace(void); | ||
48 | #else | ||
49 | static inline | ||
50 | void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) { } | ||
51 | |||
52 | static inline | ||
53 | void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) { } | ||
54 | |||
55 | static inline void start_boot_trace(void) { } | ||
56 | static inline void enable_boot_trace(void) { } | ||
57 | static inline void disable_boot_trace(void) { } | ||
58 | #endif /* CONFIG_BOOT_TRACER */ | ||
59 | |||
60 | #endif /* __LINUX_TRACE_BOOT_H */ | ||
diff --git a/include/trace/sched.h b/include/trace/sched.h index ad47369d01b5..9b2854abf7e2 100644 --- a/include/trace/sched.h +++ b/include/trace/sched.h | |||
@@ -4,52 +4,52 @@ | |||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/tracepoint.h> | 5 | #include <linux/tracepoint.h> |
6 | 6 | ||
7 | DEFINE_TRACE(sched_kthread_stop, | 7 | DECLARE_TRACE(sched_kthread_stop, |
8 | TPPROTO(struct task_struct *t), | 8 | TPPROTO(struct task_struct *t), |
9 | TPARGS(t)); | 9 | TPARGS(t)); |
10 | 10 | ||
11 | DEFINE_TRACE(sched_kthread_stop_ret, | 11 | DECLARE_TRACE(sched_kthread_stop_ret, |
12 | TPPROTO(int ret), | 12 | TPPROTO(int ret), |
13 | TPARGS(ret)); | 13 | TPARGS(ret)); |
14 | 14 | ||
15 | DEFINE_TRACE(sched_wait_task, | 15 | DECLARE_TRACE(sched_wait_task, |
16 | TPPROTO(struct rq *rq, struct task_struct *p), | 16 | TPPROTO(struct rq *rq, struct task_struct *p), |
17 | TPARGS(rq, p)); | 17 | TPARGS(rq, p)); |
18 | 18 | ||
19 | DEFINE_TRACE(sched_wakeup, | 19 | DECLARE_TRACE(sched_wakeup, |
20 | TPPROTO(struct rq *rq, struct task_struct *p), | 20 | TPPROTO(struct rq *rq, struct task_struct *p), |
21 | TPARGS(rq, p)); | 21 | TPARGS(rq, p)); |
22 | 22 | ||
23 | DEFINE_TRACE(sched_wakeup_new, | 23 | DECLARE_TRACE(sched_wakeup_new, |
24 | TPPROTO(struct rq *rq, struct task_struct *p), | 24 | TPPROTO(struct rq *rq, struct task_struct *p), |
25 | TPARGS(rq, p)); | 25 | TPARGS(rq, p)); |
26 | 26 | ||
27 | DEFINE_TRACE(sched_switch, | 27 | DECLARE_TRACE(sched_switch, |
28 | TPPROTO(struct rq *rq, struct task_struct *prev, | 28 | TPPROTO(struct rq *rq, struct task_struct *prev, |
29 | struct task_struct *next), | 29 | struct task_struct *next), |
30 | TPARGS(rq, prev, next)); | 30 | TPARGS(rq, prev, next)); |
31 | 31 | ||
32 | DEFINE_TRACE(sched_migrate_task, | 32 | DECLARE_TRACE(sched_migrate_task, |
33 | TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu), | 33 | TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu), |
34 | TPARGS(rq, p, dest_cpu)); | 34 | TPARGS(rq, p, dest_cpu)); |
35 | 35 | ||
36 | DEFINE_TRACE(sched_process_free, | 36 | DECLARE_TRACE(sched_process_free, |
37 | TPPROTO(struct task_struct *p), | 37 | TPPROTO(struct task_struct *p), |
38 | TPARGS(p)); | 38 | TPARGS(p)); |
39 | 39 | ||
40 | DEFINE_TRACE(sched_process_exit, | 40 | DECLARE_TRACE(sched_process_exit, |
41 | TPPROTO(struct task_struct *p), | 41 | TPPROTO(struct task_struct *p), |
42 | TPARGS(p)); | 42 | TPARGS(p)); |
43 | 43 | ||
44 | DEFINE_TRACE(sched_process_wait, | 44 | DECLARE_TRACE(sched_process_wait, |
45 | TPPROTO(struct pid *pid), | 45 | TPPROTO(struct pid *pid), |
46 | TPARGS(pid)); | 46 | TPARGS(pid)); |
47 | 47 | ||
48 | DEFINE_TRACE(sched_process_fork, | 48 | DECLARE_TRACE(sched_process_fork, |
49 | TPPROTO(struct task_struct *parent, struct task_struct *child), | 49 | TPPROTO(struct task_struct *parent, struct task_struct *child), |
50 | TPARGS(parent, child)); | 50 | TPARGS(parent, child)); |
51 | 51 | ||
52 | DEFINE_TRACE(sched_signal_send, | 52 | DECLARE_TRACE(sched_signal_send, |
53 | TPPROTO(int sig, struct task_struct *p), | 53 | TPPROTO(int sig, struct task_struct *p), |
54 | TPARGS(sig, p)); | 54 | TPARGS(sig, p)); |
55 | 55 | ||