Skip to content

Commit 71d8d15

Browse files
joelagnelPaul E. McKenney
authored andcommitted
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. Suggested-by: Steven Rostedt <rostedt@goodmis.org> Cc: kernel-team@android.com Cc: rcu@vger.kernel.org Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
1 parent e015a34 commit 71d8d15

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎include/linux/lockdep.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,18 @@ do { \
632632
"IRQs not disabled as expected\n"); \
633633
} while (0)
634634

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+
635641
#else
636642
# define might_lock(lock) do { } while (0)
637643
# define might_lock_read(lock) do { } while (0)
638644
# define lockdep_assert_irqs_enabled() do { } while (0)
639645
# define lockdep_assert_irqs_disabled() do { } while (0)
646+
# define lockdep_assert_in_irq() do { } while (0)
640647
#endif
641648

642649
#ifdef CONFIG_LOCKDEP

0 commit comments

Comments
 (0)