From nobody Fri Oct 2 09:22:05 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EF463AE18C; Mon, 3 Aug 2026 07:48:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785743310; cv=none; b=CLBKGsqEY2n/9bdVKR4HzMOBkJ2LIh/f9CHOJgV9bYaCoijlM6Mh/9AlJW4E6FW8zIc1vobTFvLuNmAEAyligiAGncNHWUVvaxAumFmy4T80fvdXtVMscuWMU9g0sYT7/rKQ4fPhAElP6dao8yyK6TKIvna7D0wZZlbvSvefPlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785743310; c=relaxed/simple; bh=uaXREg9Zoki6TLkozhonZktCtxIBP9IB4NAX139Npjs=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=FTKHn8IFK7gdqD0XvaFHl+HMaeof/fsz9vxG02xV7FyFIFeexOYgC7m4XYp3rfWfYUkeHoNEXRbfqD4XSICqWAlZ4om5LtyD6V+YfkYeEuOnBhT1qyugf36USw3LUpEPmrK5S5NFsOM3yv713XxpsoixrErFyY7ymTIn1lAeMHQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=z2CZXb/L; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lyFTuIiw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="z2CZXb/L"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lyFTuIiw" Date: Mon, 03 Aug 2026 07:48:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1785743304; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Oxsmz9g3eetR/C9jp13b3d8IBTucioOi8+c2O+nRUI=; b=z2CZXb/Lb+K3yW/wRrrWR/mqdgo/zEpr4oDmd64777jiExbReH+rMo7sVfmdqxzLvECdwA vvZKtCLt9sUe0bgBrWWpF7FQBJbTfTo8TevIxhS9PAKxVcs6XQ5QUALVKzZ+X8A+ntrNY3 Md7g1SDMxc+L1ETudjue1KrzZZsIBD1KvVHArKoW8vym0qlMA1daUVXKgYdu0nr6OI/Bru Qgf+OPWKADVp14cFbiTsTb+ZfKg4n5Dkp8yF1RRq75BUeejfFPcEZLw08PJGIv2ommZRKO NOCsV2Dy13gGoYdlghD2yXO6WgJ9vjsatGimCpaRZrAWjQvj27M1nmsSSAtwaw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1785743304; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Oxsmz9g3eetR/C9jp13b3d8IBTucioOi8+c2O+nRUI=; b=lyFTuIiwI4u7T+9ZzOXDjuDCGkbrrGtHD1QeD+Czdf6YFM2wXqe5HW2/9zw6IFqCv5hp+H Otqd6ek7jc2OkLBQ== From: "tip-bot2 for Yury Norov" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] stop_machine: Make stop_one_cpu_nowait() return void Cc: Yury Norov , "Peter Zijlstra (Intel)" , Bradley Morgan , Shrikanth Hegde , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260729022355.325058-1-ynorov@nvidia.com> References: <20260729022355.325058-1-ynorov@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178574330247.1210945.7801496291690022947.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/core branch of tip: Commit-ID: 5186ef36909c792591fda7a1ae2afc168f60bc90 Gitweb: https://git.kernel.org/tip/5186ef36909c792591fda7a1ae2afc168= f60bc90 Author: Yury Norov AuthorDate: Tue, 28 Jul 2026 22:23:54 -04:00 Committer: Peter Zijlstra CommitterDate: Fri, 31 Jul 2026 12:35:26 +02:00 stop_machine: Make stop_one_cpu_nowait() return void No caller checks the return value from stop_one_cpu_nowait(). All callers require the callback to run and arrange for the target CPU's stopper to remain enabled while queuing the work. In particular, commit f0498d2a54e7 ("sched: Fix stop_one_cpu_nowait() vs hotplug") added preemption protection to the scheduler callers so that queuing must succeed once the target CPU has been observed online. Therefore, a failure is an unrecoverable violation rather than a condition individual callers can recover from. Diagnose it with WARN_ON_ONCE() in stop_one_cpu_nowait(). A check in the common helper covers current and future callers consistently, while individual checks would duplicate the same non-recoverable handling at every call site. Make the function return void because there is no longer a meaningful result for callers to consume. On UP, warn if the supplied CPU is not the current CPU because the work cannot be scheduled in that case. Signed-off-by: Yury Norov Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Bradley Morgan Reviewed-by: Shrikanth Hegde Link: https://patch.msgid.link/20260729022355.325058-1-ynorov@nvidia.com --- include/linux/stop_machine.h | 21 ++++++++++----------- kernel/stop_machine.c | 14 ++++++-------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 0101111..84e7fb6 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h @@ -2,6 +2,7 @@ #ifndef _LINUX_STOP_MACHINE #define _LINUX_STOP_MACHINE =20 +#include #include #include #include @@ -31,7 +32,7 @@ struct cpu_stop_work { =20 int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg); int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, = void *arg); -bool stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, +void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, struct cpu_stop_work *work_buf); void stop_machine_park(int cpu); void stop_machine_unpark(int cpu); @@ -68,19 +69,17 @@ static void stop_one_cpu_nowait_workfn(struct work_stru= ct *work) preempt_enable(); } =20 -static inline bool stop_one_cpu_nowait(unsigned int cpu, +static inline void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, struct cpu_stop_work *work_buf) { - if (cpu =3D=3D smp_processor_id()) { - INIT_WORK(&work_buf->work, stop_one_cpu_nowait_workfn); - work_buf->fn =3D fn; - work_buf->arg =3D arg; - schedule_work(&work_buf->work); - return true; - } - - return false; + if (WARN_ON_ONCE(cpu !=3D smp_processor_id())) + return; + + INIT_WORK(&work_buf->work, stop_one_cpu_nowait_workfn); + work_buf->fn =3D fn; + work_buf->arg =3D arg; + schedule_work(&work_buf->work); } =20 static inline void print_stop_info(const char *log_lvl, struct task_struct= *task) { } diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 773d8e9..d085ba1 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -7,6 +7,7 @@ * Copyright (C) 2010 SUSE Linux Products GmbH * Copyright (C) 2010 Tejun Heo */ +#include #include #include #include @@ -376,17 +377,14 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu= 2, cpu_stop_fn_t fn, void * * and will remain untouched until stopper starts executing @fn. * * CONTEXT: - * Don't care. - * - * RETURNS: - * true if cpu_stop_work was queued successfully and @fn will be called, - * false otherwise. + * Don't care, but the caller must ensure @cpu's stopper stays enabled + * until the work is queued, e.g. by preempt_disable(). */ -bool stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, - struct cpu_stop_work *work_buf) +void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, + struct cpu_stop_work *work_buf) { *work_buf =3D (struct cpu_stop_work){ .fn =3D fn, .arg =3D arg, .caller = =3D _RET_IP_, }; - return cpu_stop_queue_work(cpu, work_buf); + WARN_ON_ONCE(!cpu_stop_queue_work(cpu, work_buf)); } =20 static bool queue_stop_cpus_work(const struct cpumask *cpumask,