[PATCH 03/21] rcu: Add a note about noinstr VS unsafe eqs functions

Frederic Weisbecker
2022-05-03T10:01:31Z

Some RCU functions enter or exit into/from RCU idle mode while using
trace-able and lockdep-aware IRQs (un-)masking. This could be easily
solved with using raw versions of local_irq_*() but we would then
lose some precious debugging informations.

Another possible way to solve this may consist in using rude RCU-tasks
in lockdep and irqsoff tracing.

In any case and until this get solved, those RCU functions can't get
tagged as noinstr even though they should.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Cc: Uladzislau Rezki <uladzislau.rezki@sony.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Nicolas Saenz Julienne <nsaenz@kernel.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Cc: Yu Liao<liaoyu15@huawei.com>
Cc: Phil Auld <pauld@redhat.com>
Cc: Paul Gortmaker<paul.gortmaker@windriver.com>
Cc: Alex Belits <abelits@marvell.com>
---
kernel/rcu/tree.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index a5da4b87afde..2a6e7723fc4d 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -838,6 +838,10 @@ void rcu_irq_exit_check_preempt(void)
*
* If you add or remove a call to rcu_irq_exit_irqson(), be sure to test
* with CONFIG_RCU_EQS_DEBUG=y.
+ *
+ * FIXME: This function should be noinstr but the below local_irq_restore() is
+ * unsafe because it involves illegal RCU uses through tracing and lockdep.
+ * This must be fixed first.
*/
void rcu_irq_exit_irqson(void)
{
@@ -895,6 +899,10 @@ static void noinstr rcu_eqs_exit(bool user)
*
* If you add or remove a call to rcu_idle_exit(), be sure to test with
* CONFIG_RCU_EQS_DEBUG=y.
+ *
+ * FIXME: This function should be noinstr but the below local_irq_save() is
+ * unsafe because it involves illegal RCU uses through tracing and lockdep.
+ * This must be fixed first.
*/
void rcu_idle_exit(void)
{
@@ -1076,6 +1084,10 @@ noinstr void rcu_irq_enter(void)
*
* If you add or remove a call to rcu_irq_enter_irqson(), be sure to test
* with CONFIG_RCU_EQS_DEBUG=y.
+ *
+ * FIXME: This function should be noinstr but the below local_irq_save() is
+ * unsafe because it involves illegal RCU uses through tracing and lockdep.
+ * This must be fixed first.
*/
void rcu_irq_enter_irqson(void)
{
--
2.25.1