From nobody Thu Apr 2 02:40:40 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 36DEB369234 for ; Tue, 31 Mar 2026 02:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774923298; cv=none; b=DbHFiurAVjKXJFbRVfrVTXJwuS+D4kguFO8swym/Xc1hNfo70Fhp8rCtxafFMsvmGeDo1lZ0LFD5cy74pUVQqXKBTRtPgQvg1G2FokSWNGlJq5eAnnYrXmUDT/zw28k9xzvMvknhHBYox/X4LTE5D2RLisiy4L+5SObG/CZV9ZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774923298; c=relaxed/simple; bh=jVIM7EIFyMMrxh4UN+c1WxZeiLXcm6oRhS6lRuk9LUk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IE1CISkWJ3hWSYQZ+1Z34UI0sMxpu8l7qvkCOGTXIYykvJkU7f9X3+3WQ6uHycyPlG8Gn1xAz5mX7JJ+9XTe5I6JwEh1qy0wQevB0XmQmy4n9dv1bHFPUEDNJcbDGQOsgxY+iHg5LxsirT2KHKco/a5wWmULJqvgNq49P0bVn9A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TcYesPFj; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TcYesPFj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774923296; x=1806459296; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jVIM7EIFyMMrxh4UN+c1WxZeiLXcm6oRhS6lRuk9LUk=; b=TcYesPFjTPVAgPfMs5RDmxkxNwpZqNQwCbg6YZTNU6mrXAjRXiEQZnnX J8yJzwAfzccSiYTXG6xgaTq5EB3WOw30P35k+MckzBh0occ+5faM6yExU 89ay9/SBIgVc7qAMMDnGbHlo6W/mPJl92s06etZl9VtT/3aAysMsLl37d K7CAkbFi41YoigNtBiJUCnM13AElAT2EAgiYuV1GVZwBv1NFT6jRFqXvf JETSewQsnNHKNN9YU+QE/rEwDr7HfLcdB29lrGkMaLFZiS0+eKrJb8GUc PoHUSKrJs5b197yUEOgcjnO3vTpdyIiJUOKWt+9aL8K29bdfMWUpURKB5 A==; X-CSE-ConnectionGUID: X1UW6qbgRAm4aJL2AwhSnA== X-CSE-MsgGUID: aWIxYLDYQtuME6cLqGzUYQ== X-IronPort-AV: E=McAfee;i="6800,10657,11744"; a="93508052" X-IronPort-AV: E=Sophos;i="6.23,151,1770624000"; d="scan'208";a="93508052" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2026 19:07:40 -0700 X-CSE-ConnectionGUID: TdGIrLcjSuCgOcur/XqCzg== X-CSE-MsgGUID: VD/FogoKSquGYn7STjBRkw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,151,1770624000"; d="scan'208";a="221358669" Received: from chang-linux-3.sc.intel.com (HELO chang-linux-3) ([172.25.66.172]) by fmviesa006.fm.intel.com with ESMTP; 30 Mar 2026 19:07:34 -0700 From: "Chang S. Bae" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, peterz@infradead.org, david.kaplan@amd.com, chang.seok.bae@intel.com Subject: [PATCH v2 01/11] stop_machine: Clarify @cpus == NULL semantics Date: Tue, 31 Mar 2026 01:42:39 +0000 Message-ID: <20260331014251.86353-2-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260331014251.86353-1-chang.seok.bae@intel.com> References: <20260331014251.86353-1-chang.seok.bae@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The stop-machine API description currently mentions that @cpus =3D=3D NULL means running on "each cpu_online_mask". Previously, it was described as "any cpu_online_mask" before commit: fc6f89dc707 ("stop_machine: Improve kernel-doc function-header comments") In fact, multi_cpu_stop() selects the first CPU in cpu_online_mask when @cpus is NULL. Right now cpumask_any() is defined as cpumask_first(). So the previous description was closer but apparently it was not clear enough either. Fix those comments for clarity. Signed-off-by: Chang S. Bae --- V1 -> V2: New patch Considering stop_machine_nmi_cpuslocked() and its another cpumask, I could realize this nullptr implication is not clear enough. Then, it ended up with this fix. I also considered just saying CPU0, but still 'cpumask_first(cpu_online_mas= k)' are there. So, leave it like that, instead of converting them aggressively. --- include/linux/stop_machine.h | 6 ++++-- kernel/stop_machine.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 72820503514c..c753dd53e79d 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h @@ -99,7 +99,8 @@ static inline void print_stop_info(const char *log_lvl, s= truct task_struct *task * stop_machine: freeze the machine on all CPUs and run this function * @fn: the function to run * @data: the data ptr to pass to @fn() - * @cpus: the cpus to run @fn() on (NULL =3D run on each online CPU) + * @cpus: the CPUs to run @fn() on. If NULL, @fn() runs on a single + * (arbitrary) CPU from cpu_online_mask. * * Description: This causes a thread to be scheduled on every CPU, which * will run with interrupts disabled. Each CPU specified by @cpus will @@ -133,7 +134,8 @@ int stop_machine(cpu_stop_fn_t fn, void *data, const st= ruct cpumask *cpus); * stop_machine_cpuslocked: freeze the machine on all CPUs and run this fu= nction * @fn: the function to run * @data: the data ptr to pass to @fn() - * @cpus: the cpus to run @fn() on (NULL =3D run on each online CPU) + * @cpus: the CPUs to run @fn() on. If NULL, @fn() runs on a single + * (arbitrary) CPU from cpu_online_mask. * * Same as above. Avoids nested calls to cpus_read_lock(). * diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 3fe6b0c99f3d..822cf56fdc81 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -655,9 +655,11 @@ EXPORT_SYMBOL_GPL(stop_core_cpuslocked); =20 /** * stop_machine_from_inactive_cpu - stop_machine() from inactive CPU + * * @fn: the function to run * @data: the data ptr for the @fn() - * @cpus: the cpus to run the @fn() on (NULL =3D any online cpu) + * @cpus: the CPUs to run the @fn() on. If NULL, @fn() runs on a single + * (arbitrary) CPU from cpu_online_mask. * * This is identical to stop_machine() but can be called from a CPU which * is not active. The local CPU is in the process of hotplug (so no other --=20 2.51.0