From nobody Mon Feb 9 10:33:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C09B3C77B7F for ; Tue, 16 May 2023 09:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbjEPJKr (ORCPT ); Tue, 16 May 2023 05:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231782AbjEPJKE (ORCPT ); Tue, 16 May 2023 05:10:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B9649EB; Tue, 16 May 2023 02:10:01 -0700 (PDT) Date: Tue, 16 May 2023 09:09:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684228196; 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=XhbS6Js/pR5XPdMOadQRXi/oWX0jfWyVYx38A9j697Q=; b=hrpIFZh+nbxdbPxfwYTeC+Ge+0FpS79FotRouxKRU3l4E3Bvosf8N9QMpCgstdD3e3k1AT XrsQ7ytgyVE2r80mz65hTHC3lEEm4ohiZ3P9y5BQeYd3MZ5AFlvMzoTpijtZHj5Zam85Ez so4Hvn2DiebBwg6r/QwjsET3Cl3QuS3DIR3hEmLdaV8F1CEsV6nqg1L13wqQIwS7AOfrYw 9WYl9jwi2fPi3e42adpigtpOOxeVIeMdfpNx5jwnpvIdwDnwwzH7gZmh5S32dubHlbGyxV OGHTCD54Ontdf7NEDogEGJG/zCoN4N7YuC1YInf66q4+u+S1T9Caa4WG4FWXlQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684228196; 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=XhbS6Js/pR5XPdMOadQRXi/oWX0jfWyVYx38A9j697Q=; b=SfubuBo09wbxMCZDy3FdMSM5O6whZ4RDyKZnM14WUXNt+iaM/2Cbr4228xkZqd8hs5zfTs XXCsMHBW5tP2sjAQ== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: smp/core] cpu/hotplug: Remove unused state functions Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , Michael Kelley , Oleksandr Natalenko , Helge Deller , "Guilherme G. Piccoli" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230512205256.972894276@linutronix.de> References: <20230512205256.972894276@linutronix.de> MIME-Version: 1.0 Message-ID: <168422819603.404.16882958545555269439.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the smp/core branch of tip: Commit-ID: bc088f9a0d5bdf12bb18980739336dfcc092e55b Gitweb: https://git.kernel.org/tip/bc088f9a0d5bdf12bb18980739336dfcc= 092e55b Author: Thomas Gleixner AuthorDate: Fri, 12 May 2023 23:07:41 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 15 May 2023 13:45:00 +02:00 cpu/hotplug: Remove unused state functions All users converted to the hotplug core mechanism. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Tested-by: Michael Kelley Tested-by: Oleksandr Natalenko Tested-by: Helge Deller # parisc Tested-by: Guilherme G. Piccoli # Steam Deck Link: https://lore.kernel.org/r/20230512205256.972894276@linutronix.de --- include/linux/cpu.h | 2 +- kernel/smpboot.c | 75 +-------------------------------------------- 2 files changed, 77 deletions(-) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 68f69e8..d321dbd 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -193,8 +193,6 @@ static inline void play_idle(unsigned long duration_us) } =20 #ifdef CONFIG_HOTPLUG_CPU -bool cpu_wait_death(unsigned int cpu, int seconds); -bool cpu_report_death(void); void cpuhp_report_idle_dead(void); #else static inline void cpuhp_report_idle_dead(void) { } diff --git a/kernel/smpboot.c b/kernel/smpboot.c index 1940f33..f47d8f3 100644 --- a/kernel/smpboot.c +++ b/kernel/smpboot.c @@ -325,78 +325,3 @@ void smpboot_unregister_percpu_thread(struct smp_hotpl= ug_thread *plug_thread) cpus_read_unlock(); } EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread); - -#ifndef CONFIG_HOTPLUG_CORE_SYNC -static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) =3D ATOMIC_INIT(CPU_POS= T_DEAD); - -#ifdef CONFIG_HOTPLUG_CPU -/* - * Wait for the specified CPU to exit the idle loop and die. - */ -bool cpu_wait_death(unsigned int cpu, int seconds) -{ - int jf_left =3D seconds * HZ; - int oldstate; - bool ret =3D true; - int sleep_jf =3D 1; - - might_sleep(); - - /* The outgoing CPU will normally get done quite quickly. */ - if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) =3D=3D CPU_DEAD) - goto update_state_early; - udelay(5); - - /* But if the outgoing CPU dawdles, wait increasingly long times. */ - while (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) !=3D CPU_DEAD) { - schedule_timeout_uninterruptible(sleep_jf); - jf_left -=3D sleep_jf; - if (jf_left <=3D 0) - break; - sleep_jf =3D DIV_ROUND_UP(sleep_jf * 11, 10); - } -update_state_early: - oldstate =3D atomic_read(&per_cpu(cpu_hotplug_state, cpu)); -update_state: - if (oldstate =3D=3D CPU_DEAD) { - /* Outgoing CPU died normally, update state. */ - smp_mb(); /* atomic_read() before update. */ - atomic_set(&per_cpu(cpu_hotplug_state, cpu), CPU_POST_DEAD); - } else { - /* Outgoing CPU still hasn't died, set state accordingly. */ - if (!atomic_try_cmpxchg(&per_cpu(cpu_hotplug_state, cpu), - &oldstate, CPU_BROKEN)) - goto update_state; - ret =3D false; - } - return ret; -} - -/* - * Called by the outgoing CPU to report its successful death. Return - * false if this report follows the surviving CPU's timing out. - * - * A separate "CPU_DEAD_FROZEN" is used when the surviving CPU - * timed out. This approach allows architectures to omit calls to - * cpu_check_up_prepare() and cpu_set_state_online() without defeating - * the next cpu_wait_death()'s polling loop. - */ -bool cpu_report_death(void) -{ - int oldstate; - int newstate; - int cpu =3D smp_processor_id(); - - oldstate =3D atomic_read(&per_cpu(cpu_hotplug_state, cpu)); - do { - if (oldstate !=3D CPU_BROKEN) - newstate =3D CPU_DEAD; - else - newstate =3D CPU_DEAD_FROZEN; - } while (!atomic_try_cmpxchg(&per_cpu(cpu_hotplug_state, cpu), - &oldstate, newstate)); - return newstate =3D=3D CPU_DEAD; -} - -#endif /* #ifdef CONFIG_HOTPLUG_CPU */ -#endif /* !CONFIG_HOTPLUG_CORE_SYNC */