History

lockdep: Add assertion to check if in an interrupt

In rcu_rrupt_from_idle, we want to check if it is called from within an interrupt, but want to do such checking only for debug builds. lockdep already tracks when we enter an interrupt. Let us expose it as an assertion macro so it can be used to assert this.

Joel Fernandes (Google) committed 7 years ago

Commit 71d8d151 parent e015a341 file · +7 −0Browse files

Unified · Split

include/linux/lockdep.h+7−0
@@ -632,11 +632,18 @@ do { \ · 631 unmodified lines
632 "IRQs not disabled as expected\n"); \632 "IRQs not disabled as expected\n"); \
633 } while (0)633 } while (0)
634 634
635#define lockdep_assert_in_irq() do { \
636 WARN_ONCE(debug_locks && !current->lockdep_recursion && \
637 !current->hardirq_context, \
638 "Not in hardirq as expected\n"); \
639 } while (0)
640
635#else641#else
636# define might_lock(lock) do { } while (0)642# define might_lock(lock) do { } while (0)
637# define might_lock_read(lock) do { } while (0)643# define might_lock_read(lock) do { } while (0)
638# define lockdep_assert_irqs_enabled() do { } while (0)644# define lockdep_assert_irqs_enabled() do { } while (0)
639# define lockdep_assert_irqs_disabled() do { } while (0)645# define lockdep_assert_irqs_disabled() do { } while (0)
646# define lockdep_assert_in_irq() do { } while (0)
640#endif647#endif
641 648
642#ifdef CONFIG_LOCKDEP649#ifdef CONFIG_LOCKDEP

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t