]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef LINUX_HARDIRQ_H |
2 | #define LINUX_HARDIRQ_H | |
3 | ||
2d4b8473 | 4 | #include <linux/preempt_mask.h> |
fbb9ce95 | 5 | #include <linux/lockdep.h> |
6a60dd12 | 6 | #include <linux/ftrace_irq.h> |
dcbf832e | 7 | #include <linux/vtime.h> |
0bd3a173 | 8 | #include <asm/hardirq.h> |
1da177e4 | 9 | |
1da177e4 | 10 | |
1da177e4 | 11 | extern void synchronize_irq(unsigned int irq); |
1da177e4 | 12 | |
127781d1 | 13 | #if defined(CONFIG_TINY_RCU) |
9b1d82fa PM |
14 | |
15 | static inline void rcu_nmi_enter(void) | |
16 | { | |
17 | } | |
18 | ||
19 | static inline void rcu_nmi_exit(void) | |
20 | { | |
21 | } | |
22 | ||
23 | #else | |
64db4cff PM |
24 | extern void rcu_nmi_enter(void); |
25 | extern void rcu_nmi_exit(void); | |
9b1d82fa | 26 | #endif |
2232c2d8 | 27 | |
de30a2b3 IM |
28 | /* |
29 | * It is safe to do non-atomic ops on ->hardirq_context, | |
30 | * because NMI handlers may not preempt and the ops are | |
31 | * always balanced, so the interrupted value of ->hardirq_context | |
32 | * will always be restored. | |
33 | */ | |
79bf2bb3 TG |
34 | #define __irq_enter() \ |
35 | do { \ | |
6a61671b | 36 | account_irq_enter_time(current); \ |
bdb43806 | 37 | preempt_count_add(HARDIRQ_OFFSET); \ |
79bf2bb3 TG |
38 | trace_hardirq_enter(); \ |
39 | } while (0) | |
40 | ||
41 | /* | |
42 | * Enter irq context (on NO_HZ, update jiffies): | |
43 | */ | |
dde4b2b5 | 44 | extern void irq_enter(void); |
de30a2b3 IM |
45 | |
46 | /* | |
47 | * Exit irq context without processing softirqs: | |
48 | */ | |
49 | #define __irq_exit() \ | |
50 | do { \ | |
51 | trace_hardirq_exit(); \ | |
6a61671b | 52 | account_irq_exit_time(current); \ |
bdb43806 | 53 | preempt_count_sub(HARDIRQ_OFFSET); \ |
1da177e4 LT |
54 | } while (0) |
55 | ||
de30a2b3 IM |
56 | /* |
57 | * Exit irq context and process softirqs if needed: | |
58 | */ | |
1da177e4 LT |
59 | extern void irq_exit(void); |
60 | ||
2a7b8df0 SR |
61 | #define nmi_enter() \ |
62 | do { \ | |
0f1ac8fd | 63 | lockdep_off(); \ |
2a7b8df0 SR |
64 | ftrace_nmi_enter(); \ |
65 | BUG_ON(in_nmi()); \ | |
bdb43806 | 66 | preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \ |
2a7b8df0 SR |
67 | rcu_nmi_enter(); \ |
68 | trace_hardirq_enter(); \ | |
17666f02 | 69 | } while (0) |
5f34fe1c | 70 | |
2a7b8df0 SR |
71 | #define nmi_exit() \ |
72 | do { \ | |
73 | trace_hardirq_exit(); \ | |
74 | rcu_nmi_exit(); \ | |
2a7b8df0 | 75 | BUG_ON(!in_nmi()); \ |
bdb43806 | 76 | preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \ |
2a7b8df0 | 77 | ftrace_nmi_exit(); \ |
0f1ac8fd | 78 | lockdep_on(); \ |
17666f02 | 79 | } while (0) |
de30a2b3 | 80 | |
1da177e4 | 81 | #endif /* LINUX_HARDIRQ_H */ |