public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	frederic@kernel.org, quic_neeraju@quicinc.com,
	josh@joshtriplett.org, rcu@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 02/11] rcu: Suppress smp_processor_id() complaint in synchronize_rcu_expedited_wait()
Date: Sun, 26 Feb 2023 09:52:44 -0500	[thread overview]
Message-ID: <20230226145255.829660-2-sashal@kernel.org> (raw)
In-Reply-To: <20230226145255.829660-1-sashal@kernel.org>

From: "Paul E. McKenney" <paulmck@kernel.org>

[ Upstream commit 2d7f00b2f01301d6e41fd4a28030dab0442265be ]

The normal grace period's RCU CPU stall warnings are invoked from the
scheduling-clock interrupt handler, and can thus invoke smp_processor_id()
with impunity, which allows them to directly invoke dump_cpu_task().
In contrast, the expedited grace period's RCU CPU stall warnings are
invoked from process context, which causes the dump_cpu_task() function's
calls to smp_processor_id() to complain bitterly in debug kernels.

This commit therefore causes synchronize_rcu_expedited_wait() to disable
preemption around its call to dump_cpu_task().

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/rcu/tree_exp.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index f90d10c1c3c8d..843399e98bb37 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -498,7 +498,9 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp)
 				mask = leaf_node_cpu_bit(rnp, cpu);
 				if (!(rnp->expmask & mask))
 					continue;
+				preempt_disable(); // For smp_processor_id() in dump_cpu_task().
 				dump_cpu_task(cpu);
+				preempt_enable();
 			}
 		}
 		jiffies_stall = 3 * rcu_jiffies_till_stall_check() + 3;
-- 
2.39.0


  reply	other threads:[~2023-02-26 15:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26 14:52 [PATCH AUTOSEL 4.14 01/11] wifi: brcmfmac: Fix potential stack-out-of-bounds in brcmf_c_preinit_dcmds() Sasha Levin
2023-02-26 14:52 ` Sasha Levin [this message]
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 03/11] thermal: intel: Fix unsigned comparison with less than zero Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 04/11] timers: Prevent union confusion from unexpected restart_syscall() Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 05/11] x86/bugs: Reset speculation control settings on init Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 06/11] inet: fix fast path in __inet_hash_connect() Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 07/11] ACPI: Don't build ACPICA with '-Os' Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 08/11] netpoll: Remove 4s sleep during carrier detection Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 09/11] net: bcmgenet: Add a check for oversized packets Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 10/11] m68k: Check syscall_trace_enter() return code Sasha Levin
2023-02-26 14:52 ` [PATCH AUTOSEL 4.14 11/11] ACPI: video: Fix Lenovo Ideapad Z570 DMI match Sasha Levin

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=20230226145255.829660-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=frederic@kernel.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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