From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, "Paul E. McKenney" <paulmck@kernel.org>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>
Subject: [PATCH 5.10 08/11] rcu: Prevent expedited GP from enabling tick on offline CPU
Date: Thu, 31 Aug 2023 13:10:00 +0200 [thread overview]
Message-ID: <20230831110830.783476883@linuxfoundation.org> (raw)
In-Reply-To: <20230831110830.455765526@linuxfoundation.org>
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul E. McKenney <paulmck@kernel.org>
commit 147f04b14adde831eb4a0a1e378667429732f9e8 upstream.
If an RCU expedited grace period starts just when a CPU is in the process
of going offline, so that the outgoing CPU has completed its pass through
stop-machine but has not yet completed its final dive into the idle loop,
RCU will attempt to enable that CPU's scheduling-clock tick via a call
to tick_dep_set_cpu(). For this to happen, that CPU has to have been
online when the expedited grace period completed its CPU-selection phase.
This is pointless: The outgoing CPU has interrupts disabled, so it cannot
take a scheduling-clock tick anyway. In addition, the tick_dep_set_cpu()
function's eventual call to irq_work_queue_on() will splat as follows:
smpboot: CPU 1 is now offline
WARNING: CPU: 6 PID: 124 at kernel/irq_work.c:95
+irq_work_queue_on+0x57/0x60
Modules linked in:
CPU: 6 PID: 124 Comm: kworker/6:2 Not tainted 5.15.0-rc1+ #3
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
+rel-1.14.0-0-g155821a-rebuilt.opensuse.org 04/01/2014
Workqueue: rcu_gp wait_rcu_exp_gp
RIP: 0010:irq_work_queue_on+0x57/0x60
Code: 8b 05 1d c7 ea 62 a9 00 00 f0 00 75 21 4c 89 ce 44 89 c7 e8
+9b 37 fa ff ba 01 00 00 00 89 d0 c3 4c 89 cf e8 3b ff ff ff eb ee <0f> 0b eb b7
+0f 0b eb db 90 48 c7 c0 98 2a 02 00 65 48 03 05 91
6f
RSP: 0000:ffffb12cc038fe48 EFLAGS: 00010282
RAX: 0000000000000001 RBX: 0000000000005208 RCX: 0000000000000020
RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff9ad01f45a680
RBP: 000000000004c990 R08: 0000000000000001 R09: ffff9ad01f45a680
R10: ffffb12cc0317db0 R11: 0000000000000001 R12: 00000000fffecee8
R13: 0000000000000001 R14: 0000000000026980 R15: ffffffff9e53ae00
FS: 0000000000000000(0000) GS:ffff9ad01f580000(0000)
+knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000000de0c000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
tick_nohz_dep_set_cpu+0x59/0x70
rcu_exp_wait_wake+0x54e/0x870
? sync_rcu_exp_select_cpus+0x1fc/0x390
process_one_work+0x1ef/0x3c0
? process_one_work+0x3c0/0x3c0
worker_thread+0x28/0x3c0
? process_one_work+0x3c0/0x3c0
kthread+0x115/0x140
? set_kthread_struct+0x40/0x40
ret_from_fork+0x22/0x30
---[ end trace c5bf75eb6aa80bc6 ]---
This commit therefore avoids invoking tick_dep_set_cpu() on offlined
CPUs to limit both futility and false-positive splats.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/rcu/tree_exp.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -507,7 +507,10 @@ static void synchronize_rcu_expedited_wa
if (rdp->rcu_forced_tick_exp)
continue;
rdp->rcu_forced_tick_exp = true;
- tick_dep_set_cpu(cpu, TICK_DEP_BIT_RCU_EXP);
+ preempt_disable();
+ if (cpu_online(cpu))
+ tick_dep_set_cpu(cpu, TICK_DEP_BIT_RCU_EXP);
+ preempt_enable();
}
}
j = READ_ONCE(jiffies_till_first_fqs);
next prev parent reply other threads:[~2023-08-31 11:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 11:09 [PATCH 5.10 00/11] 5.10.194-rc1 review Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 01/11] module: Expose module_init_layout_section() Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 02/11] arm64: module-plts: inline linux/moduleloader.h Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 03/11] arm64: module: Use module_init_layout_section() to spot init sections Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 04/11] ARM: " Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 05/11] mhi: pci_generic: Fix implicit conversion warning Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 06/11] Revert "drm/amdgpu: install stub fence into potential unused fence pointers" Greg Kroah-Hartman
2023-08-31 11:09 ` [PATCH 5.10 07/11] Revert "MIPS: Alchemy: fix dbdma2" Greg Kroah-Hartman
2023-08-31 11:10 ` Greg Kroah-Hartman [this message]
2023-08-31 11:10 ` [PATCH 5.10 09/11] rcu-tasks: Fix IPI failure handling in trc_wait_for_one_reader Greg Kroah-Hartman
2023-08-31 11:10 ` [PATCH 5.10 10/11] rcu-tasks: Wait for trc_read_check_handler() IPIs Greg Kroah-Hartman
2023-08-31 11:10 ` [PATCH 5.10 11/11] rcu-tasks: Add trc_inspect_reader() checks for exiting critical section Greg Kroah-Hartman
2023-08-31 20:22 ` [PATCH 5.10 00/11] 5.10.194-rc1 review Florian Fainelli
2023-09-01 9:28 ` Sudip Mukherjee (Codethink)
2023-09-01 11:59 ` Naresh Kamboju
2023-09-01 15:50 ` Shuah Khan
2023-09-01 19:58 ` Jon Hunter
2023-09-02 4:18 ` Guenter Roeck
2023-09-18 21:33 ` Naresh Kamboju
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=20230831110830.783476883@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=patches@lists.linux.dev \
--cc=paulmck@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.