Repository navigation
Commit f1a83e6
lockdep: Correctly annotate hardirq context in irq_exit()
There was a reported deadlock on -rt which lockdep didn't report.
It turns out that in irq_exit() we tell lockdep that the hardirq
context ends and then do all kinds of locking afterwards.
To fix it, move trace_hardirq_exit() to the very end of irq_exit(), this
ensures all locking in tick_irq_exit() and rcu_irq_exit() are properly
recorded as happening from hardirq context.
This however leads to the 'fun' little problem of running softirqs
while in hardirq context. To cure this make the softirq code a little
more complex (in the CONFIG_TRACE_IRQFLAGS case).
Due to stack swizzling arch dependent trickery we cannot pass an
argument to __do_softirq() to tell it if it was done from hardirq
context or not; so use a side-band argument.
When we do __do_softirq() from hardirq context, 'atomically' flip to
softirq context and back, so that no locking goes without being in
either hard- or soft-irq context.
I didn't find any new problems in mainline using this patch, but it
did show the -rt problem.
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-dgwc5cdksbn0jk09vbmcc9sa@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>1 parent 9dd1220 commit f1a83e6
1 file changed
Lines changed: 45 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
216 | 254 | | |
217 | 255 | | |
218 | | - | |
219 | | - | |
220 | 256 | | |
221 | | - | |
222 | 257 | | |
223 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
224 | 262 | | |
225 | 263 | | |
226 | 264 | | |
| |||
233 | 271 | | |
234 | 272 | | |
235 | 273 | | |
236 | | - | |
| 274 | + | |
237 | 275 | | |
238 | 276 | | |
239 | 277 | | |
| |||
280 | 318 | | |
281 | 319 | | |
282 | 320 | | |
283 | | - | |
284 | | - | |
| 321 | + | |
285 | 322 | | |
286 | 323 | | |
287 | 324 | | |
288 | 325 | | |
289 | 326 | | |
290 | 327 | | |
291 | | - | |
292 | | - | |
293 | 328 | | |
294 | 329 | | |
295 | 330 | | |
| |||
332 | 367 | | |
333 | 368 | | |
334 | 369 | | |
| 370 | + | |
335 | 371 | | |
336 | 372 | | |
337 | 373 | | |
| |||
377 | 413 | | |
378 | 414 | | |
379 | 415 | | |
380 | | - | |
381 | 416 | | |
382 | 417 | | |
383 | 418 | | |
384 | 419 | | |
385 | 420 | | |
386 | 421 | | |
| 422 | + | |
387 | 423 | | |
388 | 424 | | |
389 | 425 | | |
| |||
0 commit comments