diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 19:43:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 19:43:49 -0400 |
commit | 391d6276db9fbdedfbc30e1b56390414f0e55988 (patch) | |
tree | d22cd2482f5452d616ee981e954074ffc6ae094d /kernel/lockdep.c | |
parent | 75b56ec294b074d70f8a676ab02611a3fea76cab (diff) | |
parent | dd4e5d3ac4a76b868daf30e35bd572def96c30ed (diff) |
Merge branch 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
lockdep: Fix trace_[soft,hard]irqs_[on,off]() recursion
printk: Fix console_sem vs logbuf_lock unlock race
printk: Release console_sem after logbuf_lock
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r-- | kernel/lockdep.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 628276d05915..3956f5149e25 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -2481,15 +2481,10 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark) | |||
2481 | /* | 2481 | /* |
2482 | * Hardirqs will be enabled: | 2482 | * Hardirqs will be enabled: |
2483 | */ | 2483 | */ |
2484 | void trace_hardirqs_on_caller(unsigned long ip) | 2484 | static void __trace_hardirqs_on_caller(unsigned long ip) |
2485 | { | 2485 | { |
2486 | struct task_struct *curr = current; | 2486 | struct task_struct *curr = current; |
2487 | 2487 | ||
2488 | time_hardirqs_on(CALLER_ADDR0, ip); | ||
2489 | |||
2490 | if (unlikely(!debug_locks || current->lockdep_recursion)) | ||
2491 | return; | ||
2492 | |||
2493 | if (DEBUG_LOCKS_WARN_ON(unlikely(early_boot_irqs_disabled))) | 2488 | if (DEBUG_LOCKS_WARN_ON(unlikely(early_boot_irqs_disabled))) |
2494 | return; | 2489 | return; |
2495 | 2490 | ||
@@ -2505,8 +2500,6 @@ void trace_hardirqs_on_caller(unsigned long ip) | |||
2505 | /* we'll do an OFF -> ON transition: */ | 2500 | /* we'll do an OFF -> ON transition: */ |
2506 | curr->hardirqs_enabled = 1; | 2501 | curr->hardirqs_enabled = 1; |
2507 | 2502 | ||
2508 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | ||
2509 | return; | ||
2510 | if (DEBUG_LOCKS_WARN_ON(current->hardirq_context)) | 2503 | if (DEBUG_LOCKS_WARN_ON(current->hardirq_context)) |
2511 | return; | 2504 | return; |
2512 | /* | 2505 | /* |
@@ -2528,6 +2521,21 @@ void trace_hardirqs_on_caller(unsigned long ip) | |||
2528 | curr->hardirq_enable_event = ++curr->irq_events; | 2521 | curr->hardirq_enable_event = ++curr->irq_events; |
2529 | debug_atomic_inc(hardirqs_on_events); | 2522 | debug_atomic_inc(hardirqs_on_events); |
2530 | } | 2523 | } |
2524 | |||
2525 | void trace_hardirqs_on_caller(unsigned long ip) | ||
2526 | { | ||
2527 | time_hardirqs_on(CALLER_ADDR0, ip); | ||
2528 | |||
2529 | if (unlikely(!debug_locks || current->lockdep_recursion)) | ||
2530 | return; | ||
2531 | |||
2532 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | ||
2533 | return; | ||
2534 | |||
2535 | current->lockdep_recursion = 1; | ||
2536 | __trace_hardirqs_on_caller(ip); | ||
2537 | current->lockdep_recursion = 0; | ||
2538 | } | ||
2531 | EXPORT_SYMBOL(trace_hardirqs_on_caller); | 2539 | EXPORT_SYMBOL(trace_hardirqs_on_caller); |
2532 | 2540 | ||
2533 | void trace_hardirqs_on(void) | 2541 | void trace_hardirqs_on(void) |
@@ -2577,7 +2585,7 @@ void trace_softirqs_on(unsigned long ip) | |||
2577 | { | 2585 | { |
2578 | struct task_struct *curr = current; | 2586 | struct task_struct *curr = current; |
2579 | 2587 | ||
2580 | if (unlikely(!debug_locks)) | 2588 | if (unlikely(!debug_locks || current->lockdep_recursion)) |
2581 | return; | 2589 | return; |
2582 | 2590 | ||
2583 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | 2591 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
@@ -2588,6 +2596,7 @@ void trace_softirqs_on(unsigned long ip) | |||
2588 | return; | 2596 | return; |
2589 | } | 2597 | } |
2590 | 2598 | ||
2599 | current->lockdep_recursion = 1; | ||
2591 | /* | 2600 | /* |
2592 | * We'll do an OFF -> ON transition: | 2601 | * We'll do an OFF -> ON transition: |
2593 | */ | 2602 | */ |
@@ -2602,6 +2611,7 @@ void trace_softirqs_on(unsigned long ip) | |||
2602 | */ | 2611 | */ |
2603 | if (curr->hardirqs_enabled) | 2612 | if (curr->hardirqs_enabled) |
2604 | mark_held_locks(curr, SOFTIRQ); | 2613 | mark_held_locks(curr, SOFTIRQ); |
2614 | current->lockdep_recursion = 0; | ||
2605 | } | 2615 | } |
2606 | 2616 | ||
2607 | /* | 2617 | /* |
@@ -2611,7 +2621,7 @@ void trace_softirqs_off(unsigned long ip) | |||
2611 | { | 2621 | { |
2612 | struct task_struct *curr = current; | 2622 | struct task_struct *curr = current; |
2613 | 2623 | ||
2614 | if (unlikely(!debug_locks)) | 2624 | if (unlikely(!debug_locks || current->lockdep_recursion)) |
2615 | return; | 2625 | return; |
2616 | 2626 | ||
2617 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | 2627 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |