From patchwork Tue May 16 09:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 94556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp283904vqo; Tue, 16 May 2023 02:12:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5M3G3iWeN5GY2cFH48UicA3z9Tc5o3f9egxkBQlmFTfAx1e+KFr+b/qXvQeL5Re8knRrlB X-Received: by 2002:a17:90a:c090:b0:24b:347b:2a0f with SMTP id o16-20020a17090ac09000b0024b347b2a0fmr35279874pjs.40.1684228326524; Tue, 16 May 2023 02:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228326; cv=none; d=google.com; s=arc-20160816; b=JZYSvQ5Cc+PBCs+LcFkkQ9tIHP4IZwV/74K7Pp46rgqZ1bGvmdzM7CmgVkue3TH3Cv HznKVa5V+1HCM/LRf3rr9stMX18WWM1mNq4WH+B7JJ3kKozZZw5LaACrS8uUFW2pAL72 im8Ttxd201TS2gq56UdUKXH34UAAMJvgWmP/yRsOW7ubqwCP+w5gjf+rWCFnlYXSHBix gJSluzUuzHOOkprtGYU1RsmkoFYBilG/WxbIrrOCpI+JNaYHI/794W2SLNkSQIEt/Jru mu5bUDW9HC5dEXyF8sno7oZqiI0N08l9Qfb32J2TKM6+ClTIgO0CLsMeP4aZmz0sMiOg KJVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=XhbS6Js/pR5XPdMOadQRXi/oWX0jfWyVYx38A9j697Q=; b=lOfcVKisMRjqX+hrwt2eOmT5n3fvkuIbyEmZfWyvO6/0p+cPtuoFXAxZEfEwE7Jmiq lEfOnitk0aVyZRzjiOExr/62Kp5gXQ9ZMS3fuQ0Y+FEp9vYJ7Wic9q0hllmJL9rVoDYR GqXOBuA9VBssN3qYGvFEY57F7BeGmU0JnS8YhjvL5YQkbw9YAgnQKtJrboIaA7qETCnT 44KC+UZDHCY3UYYkN9a6sf22Pg6b/lQl8WkwAUB/KRLUBYHLXT00LQXDiZTUAYnDgNXH 0JtvkayH9kkSMV1v2zxJ6aO2oD6fyewwcf3XTTIWu1wOSydo14gxRWakG3iQUfk+fi/4 2cSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hrpIFZh+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=SfubuBo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a2-20020a17090a480200b0025027e0ad3dsi1342347pjh.81.2023.05.16.02.11.49; Tue, 16 May 2023 02:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hrpIFZh+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=SfubuBo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231649AbjEPJKr (ORCPT + 99 others); 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765724867085100789?= X-GMAIL-MSGID: =?utf-8?q?1766041402028996634?= The following commit has been merged into the smp/core branch of tip: Commit-ID: bc088f9a0d5bdf12bb18980739336dfcc092e55b Gitweb: https://git.kernel.org/tip/bc088f9a0d5bdf12bb18980739336dfcc092e55b 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) } #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_hotplug_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) = ATOMIC_INIT(CPU_POST_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 = seconds * HZ; - int oldstate; - bool ret = true; - int sleep_jf = 1; - - might_sleep(); - - /* The outgoing CPU will normally get done quite quickly. */ - if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == 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)) != CPU_DEAD) { - schedule_timeout_uninterruptible(sleep_jf); - jf_left -= sleep_jf; - if (jf_left <= 0) - break; - sleep_jf = DIV_ROUND_UP(sleep_jf * 11, 10); - } -update_state_early: - oldstate = atomic_read(&per_cpu(cpu_hotplug_state, cpu)); -update_state: - if (oldstate == 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 = 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 = smp_processor_id(); - - oldstate = atomic_read(&per_cpu(cpu_hotplug_state, cpu)); - do { - if (oldstate != CPU_BROKEN) - newstate = CPU_DEAD; - else - newstate = CPU_DEAD_FROZEN; - } while (!atomic_try_cmpxchg(&per_cpu(cpu_hotplug_state, cpu), - &oldstate, newstate)); - return newstate == CPU_DEAD; -} - -#endif /* #ifdef CONFIG_HOTPLUG_CPU */ -#endif /* !CONFIG_HOTPLUG_CORE_SYNC */