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