mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: linux-kernel@vger.kernel.org,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang@linux.dev>
Cc: rcu@vger.kernel.org, neeraj.iitr10@gmail.com
Subject: [PATCH -next 6/6] [please squash] fixup! rcu: Fix rcu_read_unlock() deadloop due to IRQ work
Date: Tue, 15 Jul 2025 16:01:56 -0400	[thread overview]
Message-ID: <20250715200156.2852484-7-joelagnelf@nvidia.com> (raw)
In-Reply-To: <20250715200156.2852484-1-joelagnelf@nvidia.com>

Please squash few comment-related changes courtesy of review from
Frederic.

Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
 kernel/rcu/tree.h        | 10 ++++++----
 kernel/rcu/tree_plugin.h |  7 ++++++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index f8f612269e6e..de6ca13a7b5f 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -175,10 +175,12 @@ struct rcu_snap_record {
 };
 
 /*
- * The IRQ work (deferred_qs_iw) is used by RCU to get scheduler's attention.
- * It can be in one of the following states:
- * - DEFER_QS_IDLE: An IRQ work was never scheduled.
- * - DEFER_QS_PENDING: An IRQ work was scheduler but never run.
+ * An IRQ work (deferred_qs_iw) is used by RCU to get the scheduler's attention.
+ * to report quiescent states at the soonest possible time.
+ * The request can be in one of the following states:
+ * - DEFER_QS_IDLE: An IRQ work is yet to be scheduled.
+ * - DEFER_QS_PENDING: An IRQ work was scheduled but either not yet run, or it
+ *                     ran and we still haven't reported a quiescent state.
  */
 #define DEFER_QS_IDLE		0
 #define DEFER_QS_PENDING	1
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index ffe6eb5d8e34..1b9403505c42 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -633,7 +633,12 @@ static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp)
 	local_irq_save(flags);
 
 	/*
-	 * Requeue the IRQ work on next unlock in following situation:
+	 * If the IRQ work handler happens to run in the middle of RCU read-side
+	 * critical section, it could be ineffective in getting the scheduler's
+	 * attention to report a deferred quiescent state (the whole point of the
+	 * IRQ work). For this reason, requeue the IRQ work.
+	 *
+	 * Basically, we want to avoid following situation:
 	 * 1. rcu_read_unlock() queues IRQ work (state -> DEFER_QS_PENDING)
 	 * 2. CPU enters new rcu_read_lock()
 	 * 3. IRQ work runs but cannot report QS due to rcu_preempt_depth() > 0
-- 
2.34.1


  parent reply	other threads:[~2025-07-15 20:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 20:01 [PATCH -next 0/6] Patches for v6.17 Joel Fernandes
2025-07-15 20:01 ` [PATCH -next 1/6] smp: Document preemption and stop_machine() mutual exclusion Joel Fernandes
2025-07-15 20:01 ` [PATCH -next 2/6] rcu: Refactor expedited handling check in rcu_read_unlock_special() Joel Fernandes
2025-07-15 20:01 ` [PATCH -next 3/6] rcu: Document GP init vs hotplug-scan ordering requirements Joel Fernandes
2025-07-15 20:01 ` [PATCH -next 4/6] rcu: Document separation of rcu_state and rnp's gp_seq Joel Fernandes
2025-07-15 20:01 ` [PATCH -next 5/6] rcu: Document concurrent quiescent state reporting for offline CPUs Joel Fernandes
2025-07-15 20:01 ` Joel Fernandes [this message]
2025-07-16  5:32 ` [PATCH -next 0/6] Patches for v6.17 Neeraj upadhyay
2025-07-20  4:30 ` Akira Yokosawa
2025-07-21  4:29   ` Neeraj upadhyay
2025-07-21  8:27     ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250715200156.2852484-7-joelagnelf@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=boqun.feng@gmail.com \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=neeraj.iitr10@gmail.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang@linux.dev \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®