From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6A5A409272 for ; Fri, 10 Jul 2026 22:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783723920; cv=none; b=ta1Ywtazl6BlyL8MEznU/icbUIMsgp8ebLR5Y+kT0DmXSR78vbmKkUeEDRQ4u+Gnpa5gdJp8ORzKjH/a6tLA+apVcMUAyxaJemEdQmPteMdVUdvDK/6FeSmeGy7ZwHERXEffe2KdegWyZqqFw3kzjQmX3N4ZLcR09CoXrSONQR4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783723920; c=relaxed/simple; bh=msfYOx+Zqjv92lm+ZFQuv8Qn/QSRo9O+2R4oJIc9aJk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Cxj0kTqcNfGj3X3XOxbDp9BN95xlYwmWpDmyAv0O0o94EkTkVx3ATHGOcd0/2ReEfbHfZwPgbcaM4jxRBG8eDFj4CXlbXdbTlHag7okJnXFsXLnPX60IxuLL4LK8wdaVEfpLyieDgWvgEd6oBxDs2XQao3mUmGg1XHUZV7OUfaY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AcMiigQW; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AcMiigQW" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-493c52cde9eso12141225e9.3 for ; Fri, 10 Jul 2026 15:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783723915; x=1784328715; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=GIt4xJM7May3OoqONNDUUrvaC6hGrOtKAK/QmIsJm8E=; b=AcMiigQW4qWmYbvKwNDxoEQKmT+C7u2BCFkYeZ2QwvVAlP9aG/qQbpYHdCg+6HiGLu sE5J4wdIbzk8LCPok/7w+EMya8r2MlX31isXcplZnqpUTdGFC//tU/F3VVwWRjObU9aH rEfObKwCFN62u4qBR/Cmj5Ddu3k11Z8n6TdpEXbwvwDWGBOpk5ykNC+q/f29ISTT/lbc JU/3EnwuTv4hW/F1+UxveKsZoG8HaI1Y1rS7YbfitppA8/3uErXrG9y0JH0IFmSUSp2A /qygPUn9sVPFMqhpa+jk2NdjSAr3sDFlgptkbkuyB9OTg45kFl0q7R7Dd5PHmdoOsEVz +zOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783723915; x=1784328715; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GIt4xJM7May3OoqONNDUUrvaC6hGrOtKAK/QmIsJm8E=; b=J/RLyMhu47VPxS6utsPEqVBdrR9CEXfjA7NgsUfhYMkhCEthekclM63Bamvf3/gXln BKhcDXLb7WErzo1szmdvqZrik2xF/sHQ5qtNJhoFoqaEAAFPcXmMP/HS7XXl03fKPHwV I69nvr6kqeVzGmCi8mSCW/9+1lb6OXPk8pMSKgg1UlBD5+WVhamxFYPJ6QnRXfTDZYcX aw0eMf0CSfZ1Nnjp45u3wDfBJ9yevlOihVzdBo+fyWJk4ydgDrbgL6Sj3OwZmZszvaQe Rt88DqOYL0GDkZGkI82HoFk7FeDp6cxV5JhDzOQ5VSzvueHLoh29FopfvNcRf0hMhkbo JHjg== X-Forwarded-Encrypted: i=1; AHgh+RoN0jyPUrG2lAzZ7Y0hp8yKetRfv4RiV/brNhk7eVJ4Znqjf05whI67/0UvqTxmoqC12NXU6Fl9UE6U@vger.kernel.org X-Gm-Message-State: AOJu0YwTbkvoP1TS0Ub6u5CtTrv6ppryt7AK7NXvt0GgzGBbHYwuCT+q HmKq5e7CTY/PzcqWW9//7+25mBmKBER0ymnnyLOsJtZyqPugXBuif+z4ZDH5sA== X-Gm-Gg: AfdE7cmQskQ37ER7eJqkPhDqWXuaIA5D2PHDgxTMEtttjBRZ63NZydRv+VKtr3W7wvw w9e3gD4yGd4GbFTzvorwAFywtUE16Y2dOEedgyUVDKsKXkYuq+80w66n1hSfo9cKyAFvklJXV73 k2/ykROp6uaD2kmH7KxNOBc8d/zAq4LSFLQNd1jF9lGs2CEHJqyZz8qFyhW/Vz2XKxFpSd2xHAA smPbJ83Q8RQ3IB/SgqHJn8s95xW+9D/qSyJeflobqt7vKB1F8vTIVxPB8I+ilTJyUIJhdSaa0jy UlveQvrrsj0n5utRKyqfx3fPuxqWplQA8iL8rXO7mBIXjXaRUiSKe39fm/lmfBOmeDfU2LGBotV PchyH/5U5oNNiJO7QucFhkPzrnqaXMu1Dh6i0BwZv2OQZ+FXyD8OlMWBj8Dd8sMujmtvdPvC3B2 aWFZz1APzl4IrUDlY= X-Received: by 2002:a05:600c:4f8a:b0:493:9cb3:53fc with SMTP id 5b1f17b1804b1-493f87e72cdmr5820095e9.11.1783723914816; Fri, 10 Jul 2026 15:51:54 -0700 (PDT) Received: from builder ([2001:9e8:f113:9116:be24:11ff:fe30:5d85]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493f2a38b19sm68297225e9.0.2026.07.10.15.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 15:51:54 -0700 (PDT) From: Jonas Jelonek To: stable@vger.kernel.org Cc: Thomas Bogendoerfer , Sebastian Andrzej Siewior , Thomas Gleixner , Jiayuan Chen , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Sasha Levin , Jonas Jelonek Subject: [PATCH 6.1.y] MIPS: smp: report dying CPU to RCU in stop_this_cpu() Date: Fri, 10 Jul 2026 22:51:47 +0000 Message-ID: <20260710225147.24574-1-jelonek.jonas@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit commit 9f3f3bdc6d9dac1a5a8262ee7ad0f2ff1527a7e7 upstream. smp_send_stop() parks all secondary CPUs in stop_this_cpu(). The function marks the CPU offline for the scheduler via set_cpu_online(false) but never informs RCU, so RCU keeps expecting a quiescent state from CPUs that are now spinning forever with interrupts disabled. As long as nothing waits for an RCU grace period after smp_send_stop() this is harmless, which is why it went unnoticed. Since commit 91840be8f710 ("irq_work: Fix use-after-free in irq_work_single() on PREEMPT_RT") however, irq_work_sync() calls synchronize_rcu() on architectures without an irq_work self-IPI, i.e. where arch_irq_work_has_interrupt() returns false. That is the asm-generic default used by MIPS. Any irq_work_sync() issued in the reboot/shutdown path after smp_send_stop() then blocks on a grace period that can never complete, hanging the reboot: WARNING: CPU: 0 PID: 15 at kernel/irq_work.c:144 irq_work_queue_on ... rcu: INFO: rcu_sched detected stalls on CPUs/tasks: rcu: Offline CPU 1 blocking current GP. rcu: Offline CPU 2 blocking current GP. rcu: Offline CPU 3 blocking current GP. This issue was noticed on several Realtek MIPS switch SoCs (MIPS interAptiv) and came up during kernel bump downstream in OpenWrt from 6.18.33 to 6.18.34, after the backport of the patch to the 6.18 stable branch. The patch also has been backported all the way back to 6.1. Call rcu_report_dead() once interrupts are disabled, mirroring the generic CPU-hotplug offline path, so RCU stops waiting on the parked CPUs and grace periods can still complete. MIPS shuts down all CPUs here without going through the CPU-hotplug mechanism, so this report is not otherwise issued. Reporting a dying CPU to RCU outside the regular hotplug offline path is not unprecedented: arm64 does the same in cpu_die_early(). There it is an exception for a CPU that was coming online and is aborting bringup, rather than the default shutdown action as on MIPS. Note: this differs from the upstream commit in that it calls rcu_report_dead(smp_processor_id()) instead of rcutree_report_cpu_dead(). The latter, along with the rcutree_report_cpu_dead() name, was introduced by commit 448e9f34d91d ("rcu: Standardize explicit CPU-hotplug calls") in v6.7; on this kernel the equivalent function is still named rcu_report_dead() and takes an explicit CPU argument. Fixes: 91840be8f710 ("irq_work: Fix use-after-free in irq_work_single() on PREEMPT_RT") Signed-off-by: Jonas Jelonek --- arch/mips/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 002c91fcb842..06030533bcfa 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -392,6 +393,7 @@ static void stop_this_cpu(void *dummy) set_cpu_online(smp_processor_id(), false); calculate_cpu_foreign_map(); local_irq_disable(); + rcu_report_dead(smp_processor_id()); while (1); } base-commit: 090666d3cc906176fc47363520eb746b94c7d578 -- 2.53.0