aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irqflags.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/irqflags.h')
-rw-r--r--include/linux/irqflags.h67
1 files changed, 50 insertions, 17 deletions
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index e600c4e9b8c5..74bde13224c9 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -11,11 +11,13 @@
11#ifndef _LINUX_TRACE_IRQFLAGS_H 11#ifndef _LINUX_TRACE_IRQFLAGS_H
12#define _LINUX_TRACE_IRQFLAGS_H 12#define _LINUX_TRACE_IRQFLAGS_H
13 13
14#include <linux/typecheck.h>
15
14#ifdef CONFIG_TRACE_IRQFLAGS 16#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); 17 extern void trace_softirqs_on(unsigned long ip);
18 extern void trace_softirqs_off(unsigned long ip); 18 extern void trace_softirqs_off(unsigned long ip);
19 extern void trace_hardirqs_on(void);
20 extern void trace_hardirqs_off(void);
19# define trace_hardirq_context(p) ((p)->hardirq_context) 21# define trace_hardirq_context(p) ((p)->hardirq_context)
20# define trace_softirq_context(p) ((p)->softirq_context) 22# define trace_softirq_context(p) ((p)->softirq_context)
21# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) 23# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
@@ -41,6 +43,15 @@
41# define INIT_TRACE_IRQFLAGS 43# define INIT_TRACE_IRQFLAGS
42#endif 44#endif
43 45
46#if defined(CONFIG_IRQSOFF_TRACER) || \
47 defined(CONFIG_PREEMPT_TRACER)
48 extern void stop_critical_timings(void);
49 extern void start_critical_timings(void);
50#else
51# define stop_critical_timings() do { } while (0)
52# define start_critical_timings() do { } while (0)
53#endif
54
44#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 55#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
45 56
46#include <asm/irqflags.h> 57#include <asm/irqflags.h>
@@ -49,18 +60,24 @@
49 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) 60 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
50#define local_irq_disable() \ 61#define local_irq_disable() \
51 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) 62 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
52#define local_irq_save(flags) \ 63#define local_irq_save(flags) \
53 do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0) 64 do { \
65 typecheck(unsigned long, flags); \
66 raw_local_irq_save(flags); \
67 trace_hardirqs_off(); \
68 } while (0)
54 69
55#define local_irq_restore(flags) \ 70
56 do { \ 71#define local_irq_restore(flags) \
57 if (raw_irqs_disabled_flags(flags)) { \ 72 do { \
58 raw_local_irq_restore(flags); \ 73 typecheck(unsigned long, flags); \
59 trace_hardirqs_off(); \ 74 if (raw_irqs_disabled_flags(flags)) { \
60 } else { \ 75 raw_local_irq_restore(flags); \
61 trace_hardirqs_on(); \ 76 trace_hardirqs_off(); \
62 raw_local_irq_restore(flags); \ 77 } else { \
63 } \ 78 trace_hardirqs_on(); \
79 raw_local_irq_restore(flags); \
80 } \
64 } while (0) 81 } while (0)
65#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ 82#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
66/* 83/*
@@ -69,8 +86,16 @@
69 */ 86 */
70# define raw_local_irq_disable() local_irq_disable() 87# define raw_local_irq_disable() local_irq_disable()
71# define raw_local_irq_enable() local_irq_enable() 88# define raw_local_irq_enable() local_irq_enable()
72# define raw_local_irq_save(flags) local_irq_save(flags) 89# define raw_local_irq_save(flags) \
73# define raw_local_irq_restore(flags) local_irq_restore(flags) 90 do { \
91 typecheck(unsigned long, flags); \
92 local_irq_save(flags); \
93 } while (0)
94# define raw_local_irq_restore(flags) \
95 do { \
96 typecheck(unsigned long, flags); \
97 local_irq_restore(flags); \
98 } while (0)
74#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ 99#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
75 100
76#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 101#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
@@ -80,7 +105,11 @@
80 raw_safe_halt(); \ 105 raw_safe_halt(); \
81 } while (0) 106 } while (0)
82 107
83#define local_save_flags(flags) raw_local_save_flags(flags) 108#define local_save_flags(flags) \
109 do { \
110 typecheck(unsigned long, flags); \
111 raw_local_save_flags(flags); \
112 } while (0)
84 113
85#define irqs_disabled() \ 114#define irqs_disabled() \
86({ \ 115({ \
@@ -90,7 +119,11 @@
90 raw_irqs_disabled_flags(_flags); \ 119 raw_irqs_disabled_flags(_flags); \
91}) 120})
92 121
93#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) 122#define irqs_disabled_flags(flags) \
123({ \
124 typecheck(unsigned long, flags); \
125 raw_irqs_disabled_flags(flags); \
126})
94#endif /* CONFIG_X86 */ 127#endif /* CONFIG_X86 */
95 128
96#endif 129#endif