All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] lockdep: Add assertion to check if in an interrupt
@ 2019-03-26 19:24 ` Joel Fernandes (Google)
  0 siblings, 0 replies; 33+ messages in thread
From: joel @ 2019-03-26 19:24 UTC (permalink / raw)


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 at goodmis.org>
Cc: kernel-team at android.com
Cc: rcu at vger.kernel.org
Signed-off-by: Joel Fernandes (Google) <joel at joelfernandes.org>

---
 include/linux/lockdep.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index c5335df2372f..d24f564823d3 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -601,11 +601,18 @@ do {									\
 			  "IRQs not disabled as expected\n");		\
 	} while (0)
 
+#define lockdep_assert_in_irq() do {					\
+		WARN_ONCE(debug_locks && !current->lockdep_recursion &&	\
+			  !current->hardirq_context,			\
+			  "Not in hardirq as expected\n");		\
+	} while (0)
+
 #else
 # define might_lock(lock) do { } while (0)
 # define might_lock_read(lock) do { } while (0)
 # define lockdep_assert_irqs_enabled() do { } while (0)
 # define lockdep_assert_irqs_disabled() do { } while (0)
+# define lockdep_assert_in_irq() do { } while (0)
 #endif
 
 #ifdef CONFIG_LOCKDEP
-- 
2.21.0.392.gf8f6787159e-goog

^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2019-03-28 15:09 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-26 19:24 [PATCH v2 1/4] lockdep: Add assertion to check if in an interrupt joel
2019-03-26 19:24 ` Joel Fernandes (Google)
2019-03-26 19:24 ` Joel Fernandes (Google)
2019-03-26 19:24 ` [PATCH v2 2/4] rcutree: Add checks for dynticks counters in rcu_is_cpu_rrupt_from_idle joel
2019-03-26 19:24   ` Joel Fernandes (Google)
2019-03-26 19:24   ` Joel Fernandes (Google)
2019-03-27  2:47   ` paulmck
2019-03-27  2:47     ` Paul E. McKenney
2019-03-27  2:47     ` Paul E. McKenney
2019-03-27 15:34     ` joel
2019-03-27 15:34       ` Joel Fernandes
2019-03-27 15:34       ` Joel Fernandes
2019-03-27 15:53       ` paulmck
2019-03-27 15:53         ` Paul E. McKenney
2019-03-27 15:53         ` Paul E. McKenney
2019-03-27 17:45         ` joel
2019-03-27 17:45           ` Joel Fernandes
2019-03-27 17:45           ` Joel Fernandes
2019-03-27 18:44           ` paulmck
2019-03-27 18:44             ` Paul E. McKenney
2019-03-27 18:44             ` Paul E. McKenney
2019-03-27 21:38             ` joel
2019-03-27 21:38               ` Joel Fernandes
2019-03-27 21:38               ` Joel Fernandes
2019-03-28 15:06               ` paulmck
2019-03-28 15:06                 ` Paul E. McKenney
2019-03-28 15:06                 ` Paul E. McKenney
2019-03-26 19:24 ` [PATCH v2 3/4] rcutorture: Select from only online CPUs joel
2019-03-26 19:24   ` Joel Fernandes (Google)
2019-03-26 19:24   ` Joel Fernandes (Google)
2019-03-26 19:24 ` [PATCH v2 4/4] rcutorture: Add cpu0 to the set of CPUs to add jitter joel
2019-03-26 19:24   ` Joel Fernandes (Google)
2019-03-26 19:24   ` Joel Fernandes (Google)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.