RCU fixes for v7.1

Fix a regression introduced by commit 61bbcfb505 ("srcu: Push
 srcu_node allocation to GP when non-preemptible"): SRCU may queue works
 on CPUs that are "possible" but never have been online. In such a case,
 the work callbacks may not be executed until the corresponding CPU gets
 online, and as the callbacks accumulates, workqueue lockups will fire.
 Fix this by avoiding queuing works on CPUs that have never been online.
 -----BEGIN PGP SIGNATURE-----
 
 iQFhBAABCABLFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAmoMy/EbFIAAAAAABAAO
 bWFudTIsMi41KzEuMTIsMCwzERxib3F1bkBrZXJuZWwub3JnAAoJEEl56MO1B/q4
 lT8H/RlNu00LC24b0JxPYRBZJz3TSM2WlnGJQ+5LXSQgk2ecqzoTzwDE7oC3naPC
 QDkwGpSif8Y5OKaEnlVavtDcHdNa824mKrgRo/nXkk5fqrrMMubHOHe5Y0fwy5z5
 upPoEvEs0XtbW4Mm6lI4uRw+qvIH16+Ud9SMrfZMwLRGaO8axBXi3rijUtfAMRGv
 xBFqJX15Z/ixWkA6aHGuM1fI4WdApUen4/W3oUC+Ka4Lpgtt29GmIOV3n/topNQq
 R8bZM9QC+7f6Vk1s49ywD9WZYa1b4Pig74XDOXn3328kulGBxVtOnOz4sXMgBmBF
 ZLvJ4xXy8+u1eM0DFcSExJCCvHc=
 =PyvW
 -----END PGP SIGNATURE-----

Merge tag 'rcu-fixes.v7.1-20260519a' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux

Pull RCU fixes from Boqun Feng:
 "Fix a regression introduced by commit 61bbcfb505 ("srcu: Push
  srcu_node allocation to GP when non-preemptible").

  SRCU may queue works on CPUs that are "possible" but never have been
  online. In such a case, the work callbacks may not be executed until
  the corresponding CPU gets online, and as the callbacks accumulates,
  workqueue lockups will fire.

  Fix this by avoiding queuing works on CPUs that have never been
  online"

* tag 'rcu-fixes.v7.1-20260519a' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux:
  srcu: Don't queue workqueue handlers to never-online CPUs
This commit is contained in:
Linus Torvalds 2026-05-20 10:15:30 -05:00
commit df685633c3

View File

@ -897,11 +897,9 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *ssp, struct srcu_node *snp
{
int cpu;
for (cpu = snp->grplo; cpu <= snp->grphi; cpu++) {
if (!(mask & (1UL << (cpu - snp->grplo))))
continue;
srcu_schedule_cbs_sdp(per_cpu_ptr(ssp->sda, cpu), delay);
}
for (cpu = snp->grplo; cpu <= snp->grphi; cpu++)
if ((mask & (1UL << (cpu - snp->grplo))) && rcu_cpu_beenfullyonline(cpu))
srcu_schedule_cbs_sdp(per_cpu_ptr(ssp->sda, cpu), delay);
}
/*
@ -1322,7 +1320,9 @@ static unsigned long srcu_gp_start_if_needed(struct srcu_struct *ssp,
*/
idx = __srcu_read_lock_nmisafe(ssp);
ss_state = smp_load_acquire(&ssp->srcu_sup->srcu_size_state);
if (ss_state < SRCU_SIZE_WAIT_CALL)
// If !rcu_cpu_beenfullyonline(), interrupts are still disabled,
// so no migration is possible in either direction from this CPU.
if (ss_state < SRCU_SIZE_WAIT_CALL || !rcu_cpu_beenfullyonline(raw_smp_processor_id()))
sdp = per_cpu_ptr(ssp->sda, get_boot_cpu_id());
else
sdp = raw_cpu_ptr(ssp->sda);