Files
linux-stable-mirror/include/linux
Sebastian Andrzej Siewior ac0de86fa7 srcu: Use try-lock lockdep annotation for NMI-safe access.
[ Upstream commit 3c6b0c1c28 ]

It is claimed that srcu_read_lock_nmisafe() NMI-safe. However it
triggers a lockdep if used from NMI because lockdep expects a deadlock
since nothing disables NMIs while the lock is acquired.

This is because commit f0f44752f5 ("rcu: Annotate SRCU's update-side
lockdep dependencies") annotates synchronize_srcu() as a write lock
usage. This helps to detect a deadlocks such as
	srcu_read_lock();
	synchronize_srcu();
	srcu_read_unlock();

The side effect is that the lock srcu_struct now has a USED usage in normal
contexts, so it conflicts with a USED_READ usage in NMI. But this shouldn't
cause a real deadlock because the write lock usage from synchronize_srcu()
is a fake one and only used for read/write deadlock detection.

Use a try-lock annotation for srcu_read_lock_nmisafe() to avoid lockdep
complains if used from NMI.

Fixes: f0f44752f5 ("rcu: Annotate SRCU's update-side lockdep dependencies")
Link: https://lore.kernel.org/r/20230927160231.XRCDDSK4@linutronix.de
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.iitr10@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-25 15:35:49 -08:00
..
2024-01-25 15:35:39 -08:00
2023-11-28 17:19:55 +00:00
2023-09-11 15:24:16 -07:00
2024-01-05 15:19:42 +01:00
2023-09-01 00:29:34 +02:00
2023-09-13 10:48:48 +02:00
2023-11-20 11:58:53 +01:00
2023-11-28 17:19:54 +00:00
2023-09-29 17:20:46 -07:00
2023-11-28 17:19:48 +00:00
2023-10-06 11:01:23 +02:00
2023-10-06 11:01:23 +02:00
2023-09-02 15:17:33 -07:00
2023-10-10 19:35:54 -07:00
2023-11-28 17:19:38 +00:00
2023-12-13 18:45:05 +01:00
2023-11-20 11:58:56 +01:00