linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Will Deacon <will@kernel.org>, Qian Cai <cai@redhat.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-arm-kernel@lists.infradead.org, rcu@vger.kernel.org
Subject: [PATCH AUTOSEL 5.9 12/21] arm64: smp: Tell RCU about CPUs that fail to come online
Date: Tue, 17 Nov 2020 07:56:43 -0500	[thread overview]
Message-ID: <20201117125652.599614-12-sashal@kernel.org> (raw)
In-Reply-To: <20201117125652.599614-1-sashal@kernel.org>

From: Will Deacon <will@kernel.org>

[ Upstream commit 04e613ded8c26489b3e0f9101b44462f780d1a35 ]

Commit ce3d31ad3cac ("arm64/smp: Move rcu_cpu_starting() earlier") ensured
that RCU is informed early about incoming CPUs that might end up calling
into printk() before they are online. However, if such a CPU fails the
early CPU feature compatibility checks in check_local_cpu_capabilities(),
then it will be powered off or parked without informing RCU, leading to
an endless stream of stalls:

  | rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
  | rcu:	2-O...: (0 ticks this GP) idle=002/1/0x4000000000000000 softirq=0/0 fqs=2593
  | (detected by 0, t=5252 jiffies, g=9317, q=136)
  | Task dump for CPU 2:
  | task:swapper/2       state:R  running task     stack:    0 pid:    0 ppid:     1 flags:0x00000028
  | Call trace:
  | ret_from_fork+0x0/0x30

Ensure that the dying CPU invokes rcu_report_dead() prior to being powered
off or parked.

Cc: Qian Cai <cai@redhat.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Suggested-by: Qian Cai <cai@redhat.com>
Link: https://lore.kernel.org/r/20201105222242.GA8842@willie-the-truck
Link: https://lore.kernel.org/r/20201106103602.9849-3-will@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/kernel/smp.c | 1 +
 kernel/rcu/tree.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 98c059b6bacae..361cfc55cf5a7 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -401,6 +401,7 @@ void cpu_die_early(void)
 
 	/* Mark this CPU absent */
 	set_cpu_present(cpu, 0);
+	rcu_report_dead(cpu);
 
 	if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) {
 		update_cpu_boot_status(CPU_KILL_ME);
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index c8f62e2d02761..b4924fefe2745 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -4024,7 +4024,6 @@ void rcu_cpu_starting(unsigned int cpu)
 	smp_mb(); /* Ensure RCU read-side usage follows above initialization. */
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
 /*
  * The outgoing function has no further need of RCU, so remove it from
  * the rcu_node tree's ->qsmaskinitnext bit masks.
@@ -4064,6 +4063,7 @@ void rcu_report_dead(unsigned int cpu)
 	per_cpu(rcu_cpu_started, cpu) = 0;
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
 /*
  * The outgoing CPU has just passed through the dying-idle state, and we
  * are being invoked from the CPU that was IPIed to continue the offline
-- 
2.27.0


  parent reply	other threads:[~2020-11-17 12:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 12:56 [PATCH AUTOSEL 5.9 01/21] Revert "Revert "gpio: omap: Fix lost edge wake-up interrupts"" Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 02/21] tools, bpftool: Avoid array index warnings Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 03/21] habanalabs/gaudi: mask WDT error in QMAN Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 04/21] pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 05/21] scsi: ufs: Fix unbalanced scsi_block_reqs_cnt caused by ufshcd_hold() Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 06/21] scsi: ufs: Try to save power mode change and UIC cmd completion timeout Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 07/21] pinctrl: mcp23s08: Print error message when regmap init fails Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 08/21] selftests: kvm: Fix the segment descriptor layout to match the actual layout Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 09/21] ACPI: button: Add DMI quirk for Medion Akoya E2228T Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 10/21] arm64: errata: Fix handling of 1418040 with late CPU onlining Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 11/21] arm64: psci: Avoid printing in cpu_psci_cpu_die() Sasha Levin
2020-11-17 12:56 ` Sasha Levin [this message]
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 13/21] lockdep: Avoid to modify chain keys in validate_chain() Sasha Levin
2020-11-18  1:26   ` Boqun Feng
2020-11-19  1:22     ` Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 14/21] um: Call pgtable_pmd_page_dtor() in __pmd_free_tlb() Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 15/21] vfs: remove lockdep bogosity in __sb_start_write Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 16/21] gfs2: fix possible reference leak in gfs2_check_blk_type Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 17/21] hwmon: (pwm-fan) Fix RPM calculation Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 18/21] gfs2: Fix case in which ail writes are done to jdata holes Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 19/21] arm64: Add MIDR value for KRYO2XX gold/silver CPU cores Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 20/21] arm64: kpti: Add KRYO2XX gold/silver CPU cores to kpti safelist Sasha Levin
2020-11-17 12:56 ` [PATCH AUTOSEL 5.9 21/21] arm64: cpu_errata: Apply Erratum 845719 to KRYO2XX Silver 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=20201117125652.599614-12-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cai@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).