diff options
Diffstat (limited to 'kernel/softirq.c')
-rw-r--r-- | kernel/softirq.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/kernel/softirq.c b/kernel/softirq.c index 9a4500e4c189..8b93b3770f85 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -89,7 +89,7 @@ static void wakeup_softirqd(void) | |||
89 | * where hardirqs are disabled legitimately: | 89 | * where hardirqs are disabled legitimately: |
90 | */ | 90 | */ |
91 | #ifdef CONFIG_TRACE_IRQFLAGS | 91 | #ifdef CONFIG_TRACE_IRQFLAGS |
92 | static void __local_bh_disable(unsigned long ip, unsigned int cnt) | 92 | void __local_bh_disable_ip(unsigned long ip, unsigned int cnt) |
93 | { | 93 | { |
94 | unsigned long flags; | 94 | unsigned long flags; |
95 | 95 | ||
@@ -107,33 +107,21 @@ static void __local_bh_disable(unsigned long ip, unsigned int cnt) | |||
107 | /* | 107 | /* |
108 | * Were softirqs turned off above: | 108 | * Were softirqs turned off above: |
109 | */ | 109 | */ |
110 | if (softirq_count() == cnt) | 110 | if (softirq_count() == (cnt & SOFTIRQ_MASK)) |
111 | trace_softirqs_off(ip); | 111 | trace_softirqs_off(ip); |
112 | raw_local_irq_restore(flags); | 112 | raw_local_irq_restore(flags); |
113 | 113 | ||
114 | if (preempt_count() == cnt) | 114 | if (preempt_count() == cnt) |
115 | trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1)); | 115 | trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1)); |
116 | } | 116 | } |
117 | #else /* !CONFIG_TRACE_IRQFLAGS */ | 117 | EXPORT_SYMBOL(__local_bh_disable_ip); |
118 | static inline void __local_bh_disable(unsigned long ip, unsigned int cnt) | ||
119 | { | ||
120 | preempt_count_add(cnt); | ||
121 | barrier(); | ||
122 | } | ||
123 | #endif /* CONFIG_TRACE_IRQFLAGS */ | 118 | #endif /* CONFIG_TRACE_IRQFLAGS */ |
124 | 119 | ||
125 | void local_bh_disable(void) | ||
126 | { | ||
127 | __local_bh_disable(_RET_IP_, SOFTIRQ_DISABLE_OFFSET); | ||
128 | } | ||
129 | |||
130 | EXPORT_SYMBOL(local_bh_disable); | ||
131 | |||
132 | static void __local_bh_enable(unsigned int cnt) | 120 | static void __local_bh_enable(unsigned int cnt) |
133 | { | 121 | { |
134 | WARN_ON_ONCE(!irqs_disabled()); | 122 | WARN_ON_ONCE(!irqs_disabled()); |
135 | 123 | ||
136 | if (softirq_count() == cnt) | 124 | if (softirq_count() == (cnt & SOFTIRQ_MASK)) |
137 | trace_softirqs_on(_RET_IP_); | 125 | trace_softirqs_on(_RET_IP_); |
138 | preempt_count_sub(cnt); | 126 | preempt_count_sub(cnt); |
139 | } | 127 | } |
@@ -151,7 +139,7 @@ void _local_bh_enable(void) | |||
151 | 139 | ||
152 | EXPORT_SYMBOL(_local_bh_enable); | 140 | EXPORT_SYMBOL(_local_bh_enable); |
153 | 141 | ||
154 | static inline void _local_bh_enable_ip(unsigned long ip) | 142 | void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) |
155 | { | 143 | { |
156 | WARN_ON_ONCE(in_irq() || irqs_disabled()); | 144 | WARN_ON_ONCE(in_irq() || irqs_disabled()); |
157 | #ifdef CONFIG_TRACE_IRQFLAGS | 145 | #ifdef CONFIG_TRACE_IRQFLAGS |
@@ -166,7 +154,7 @@ static inline void _local_bh_enable_ip(unsigned long ip) | |||
166 | * Keep preemption disabled until we are done with | 154 | * Keep preemption disabled until we are done with |
167 | * softirq processing: | 155 | * softirq processing: |
168 | */ | 156 | */ |
169 | preempt_count_sub(SOFTIRQ_DISABLE_OFFSET - 1); | 157 | preempt_count_sub(cnt - 1); |
170 | 158 | ||
171 | if (unlikely(!in_interrupt() && local_softirq_pending())) { | 159 | if (unlikely(!in_interrupt() && local_softirq_pending())) { |
172 | /* | 160 | /* |
@@ -182,18 +170,7 @@ static inline void _local_bh_enable_ip(unsigned long ip) | |||
182 | #endif | 170 | #endif |
183 | preempt_check_resched(); | 171 | preempt_check_resched(); |
184 | } | 172 | } |
185 | 173 | EXPORT_SYMBOL(__local_bh_enable_ip); | |
186 | void local_bh_enable(void) | ||
187 | { | ||
188 | _local_bh_enable_ip(_RET_IP_); | ||
189 | } | ||
190 | EXPORT_SYMBOL(local_bh_enable); | ||
191 | |||
192 | void local_bh_enable_ip(unsigned long ip) | ||
193 | { | ||
194 | _local_bh_enable_ip(ip); | ||
195 | } | ||
196 | EXPORT_SYMBOL(local_bh_enable_ip); | ||
197 | 174 | ||
198 | /* | 175 | /* |
199 | * We restart softirq processing for at most MAX_SOFTIRQ_RESTART times, | 176 | * We restart softirq processing for at most MAX_SOFTIRQ_RESTART times, |
@@ -264,7 +241,7 @@ asmlinkage void __do_softirq(void) | |||
264 | pending = local_softirq_pending(); | 241 | pending = local_softirq_pending(); |
265 | account_irq_enter_time(current); | 242 | account_irq_enter_time(current); |
266 | 243 | ||
267 | __local_bh_disable(_RET_IP_, SOFTIRQ_OFFSET); | 244 | __local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET); |
268 | in_hardirq = lockdep_softirq_start(); | 245 | in_hardirq = lockdep_softirq_start(); |
269 | 246 | ||
270 | cpu = smp_processor_id(); | 247 | cpu = smp_processor_id(); |