diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-07-03 03:24:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-03 18:27:03 -0400 |
commit | de30a2b355ea85350ca2f58f3b9bf4e5bc007986 (patch) | |
tree | 0bef670aff65614b3c78ca13b20307355b8221d5 /include/linux/irqflags.h | |
parent | 5bdc9b447c0076f494a56fdcd93ee8c5e78a2afd (diff) |
[PATCH] lockdep: irqtrace subsystem, core
Accurate hard-IRQ-flags and softirq-flags state tracing.
This allows us to attach extra functionality to IRQ flags on/off
events (such as trace-on/off).
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/irqflags.h')
-rw-r--r-- | include/linux/irqflags.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h new file mode 100644 index 000000000000..412e025bc5c7 --- /dev/null +++ b/include/linux/irqflags.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * include/linux/irqflags.h | ||
3 | * | ||
4 | * IRQ flags tracing: follow the state of the hardirq and softirq flags and | ||
5 | * provide callbacks for transitions between ON and OFF states. | ||
6 | * | ||
7 | * This file gets included from lowlevel asm headers too, to provide | ||
8 | * wrapped versions of the local_irq_*() APIs, based on the | ||
9 | * raw_local_irq_*() macros from the lowlevel headers. | ||
10 | */ | ||
11 | #ifndef _LINUX_TRACE_IRQFLAGS_H | ||
12 | #define _LINUX_TRACE_IRQFLAGS_H | ||
13 | |||
14 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
15 | extern void trace_hardirqs_on(void); | ||
16 | extern void trace_hardirqs_off(void); | ||
17 | extern void trace_softirqs_on(unsigned long ip); | ||
18 | extern void trace_softirqs_off(unsigned long ip); | ||
19 | # define trace_hardirq_context(p) ((p)->hardirq_context) | ||
20 | # define trace_softirq_context(p) ((p)->softirq_context) | ||
21 | # define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) | ||
22 | # define trace_softirqs_enabled(p) ((p)->softirqs_enabled) | ||
23 | # define trace_hardirq_enter() do { current->hardirq_context++; } while (0) | ||
24 | # define trace_hardirq_exit() do { current->hardirq_context--; } while (0) | ||
25 | # define trace_softirq_enter() do { current->softirq_context++; } while (0) | ||
26 | # define trace_softirq_exit() do { current->softirq_context--; } while (0) | ||
27 | # define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1, | ||
28 | #else | ||
29 | # define trace_hardirqs_on() do { } while (0) | ||
30 | # define trace_hardirqs_off() do { } while (0) | ||
31 | # define trace_softirqs_on(ip) do { } while (0) | ||
32 | # define trace_softirqs_off(ip) do { } while (0) | ||
33 | # define trace_hardirq_context(p) 0 | ||
34 | # define trace_softirq_context(p) 0 | ||
35 | # define trace_hardirqs_enabled(p) 0 | ||
36 | # define trace_softirqs_enabled(p) 0 | ||
37 | # define trace_hardirq_enter() do { } while (0) | ||
38 | # define trace_hardirq_exit() do { } while (0) | ||
39 | # define trace_softirq_enter() do { } while (0) | ||
40 | # define trace_softirq_exit() do { } while (0) | ||
41 | # define INIT_TRACE_IRQFLAGS | ||
42 | #endif | ||
43 | |||
44 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | ||
45 | |||
46 | #include <asm/irqflags.h> | ||
47 | |||
48 | #define local_irq_enable() \ | ||
49 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) | ||
50 | #define local_irq_disable() \ | ||
51 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) | ||
52 | #define local_irq_save(flags) \ | ||
53 | do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0) | ||
54 | |||
55 | #define local_irq_restore(flags) \ | ||
56 | do { \ | ||
57 | if (raw_irqs_disabled_flags(flags)) { \ | ||
58 | raw_local_irq_restore(flags); \ | ||
59 | trace_hardirqs_off(); \ | ||
60 | } else { \ | ||
61 | trace_hardirqs_on(); \ | ||
62 | raw_local_irq_restore(flags); \ | ||
63 | } \ | ||
64 | } while (0) | ||
65 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ | ||
66 | /* | ||
67 | * The local_irq_*() APIs are equal to the raw_local_irq*() | ||
68 | * if !TRACE_IRQFLAGS. | ||
69 | */ | ||
70 | # define raw_local_irq_disable() local_irq_disable() | ||
71 | # define raw_local_irq_enable() local_irq_enable() | ||
72 | # define raw_local_irq_save(flags) local_irq_save(flags) | ||
73 | # define raw_local_irq_restore(flags) local_irq_restore(flags) | ||
74 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ | ||
75 | |||
76 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | ||
77 | #define safe_halt() \ | ||
78 | do { \ | ||
79 | trace_hardirqs_on(); \ | ||
80 | raw_safe_halt(); \ | ||
81 | } while (0) | ||
82 | |||
83 | #define local_save_flags(flags) raw_local_save_flags(flags) | ||
84 | |||
85 | #define irqs_disabled() \ | ||
86 | ({ \ | ||
87 | unsigned long flags; \ | ||
88 | \ | ||
89 | raw_local_save_flags(flags); \ | ||
90 | raw_irqs_disabled_flags(flags); \ | ||
91 | }) | ||
92 | |||
93 | #define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) | ||
94 | #endif /* CONFIG_X86 */ | ||
95 | |||
96 | #endif | ||