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: 94564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp284316vqo; Tue, 16 May 2023 02:13:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jKF9saEoi+xxoiTZgmqh3jtrAwsFta8N0zs1sXy/ZSyPGUoxCtIGh2h4/Y44WkFwp8ZED X-Received: by 2002:a05:6a00:14c5:b0:64b:7c1d:518e with SMTP id w5-20020a056a0014c500b0064b7c1d518emr13020313pfu.31.1684228380959; Tue, 16 May 2023 02:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228380; cv=none; d=google.com; s=arc-20160816; b=QizHE44LnwAglf5aN2Bs8O/mQyb7AIgzaVcbRVnHfy2uYSU/7XYQFbv8TfULA29ZQ9 ugI08M5b5pT9V5lW+zRe0zgp5OxLyzgpnbw6cC5N/nmIfr0V+8ZSAzIZ8e3zNCy5c3qr mRgPvQNVWfw0OVcX4c3bV4o+kgJZFR065CjdVkmpXdUnCA1HeSboYRPrL+D7M4j6ry5I fY6FRPLFmIXG5cpk6P/SAismA7gXi0R/Sx+suaN9WXCj6ddYjOcFv9BHXED5NZimBYI7 fTKZPXKxv/VdPtkywMaLEFTbHza142gl7qP74vT5tfQwfMrBFy7uWGhrWFzihyCJ9tRw RAHg== 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=Aq1btvN9d0MAUDyJ5Gi2Ip0mjSeLNcjqgDqJuoKzm74=; b=Knr0EzosirKV3v5v3hXjCMsbqOgTXGg621+Ki9YJ2lUut7c0nSULLYsiMVdqFhI2aX QYgKPm1s/f3d3uEzebKUjcov1fCmtb9IN+kYk53JcrIvIaSV4J0XKocKA4Gnr1jd3ee/ g3r80STupI2q9GXv9HJeohS+1U4nhCiGsOkwzp8+x53HHs4HbUbBJUrgv4p4nzMnVqDu jsizRnjNXuyNwGrqEtTMha9GLbR8zpqhU+mWMIxzbe+dkkX3QbBzRY7k2HxNM5vJ+2X6 YwddRRsh0sS/caq7GUOyeImt8pVvJi+ba0wVKSVQWAslLhCV59mm37HvIbef1Rz+/IKm 8JPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rZ553C1i; dkim=neutral (no key) header.i=@linutronix.de; 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 t20-20020aa79474000000b00640f04eb325si19388778pfq.229.2023.05.16.02.12.45; Tue, 16 May 2023 02:13:00 -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=rZ553C1i; dkim=neutral (no key) header.i=@linutronix.de; 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 S231679AbjEPJLB (ORCPT + 99 others); Tue, 16 May 2023 05:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbjEPJKF (ORCPT ); Tue, 16 May 2023 05:10:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2971A49DC; 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=1684228197; 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=Aq1btvN9d0MAUDyJ5Gi2Ip0mjSeLNcjqgDqJuoKzm74=; b=rZ553C1iYe3bPWp7ellLHUTCo2OrKmGvEbEHZEudtRk9Ryvrc8aJM8oU2orndv5VdJy7ZE XHlGpZa2bO1gzGJPwBjgc0BQKCqTDevBzthOuj8lSkcMyS7/AtheDPZj0ImvI3Mpa9eBJz nEVTlw7B1JXgVK2stC91fhRrCxY4m5Rxrw2dP1Nr7PojeXFhq/sm9Gt5nz2pftI+rOdScr fu48+0FdonT5rEmzj6qtErp2KOeSFyffXDUbAQEfrC3QA0Sqi0VO5UhGuC7x2fm/ZMoeHV OQclth+pbZwp+4byz5ymw6e8z13TgMM5Q5EAuxp2TeILl/5Z8AvhtqOUkL7Utw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684228197; 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=Aq1btvN9d0MAUDyJ5Gi2Ip0mjSeLNcjqgDqJuoKzm74=; b=oAHTE1wefMCFBxxC8s7MEn2AkHFzTZSazljqkddRR4VN8uTsgzXieOI8kEmhtpK4xGzNzm Kd87047oBIF2yDAw== 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] MIPS: SMP_CPS: Switch to hotplug core state synchronization 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.803238859@linutronix.de> References: <20230512205256.803238859@linutronix.de> MIME-Version: 1.0 Message-ID: <168422819681.404.15261877381438452850.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?1765724853776744362?= X-GMAIL-MSGID: =?utf-8?q?1766041458674585069?= The following commit has been merged into the smp/core branch of tip: Commit-ID: c8d2bcc467c8a1a85983c24e0331cf19fe94668f Gitweb: https://git.kernel.org/tip/c8d2bcc467c8a1a85983c24e0331cf19fe94668f Author: Thomas Gleixner AuthorDate: Fri, 12 May 2023 23:07:37 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 15 May 2023 13:44:58 +02:00 MIPS: SMP_CPS: Switch to hotplug core state synchronization Switch to the CPU hotplug core state tracking and synchronization mechanim. This unfortunately requires to add dead reporting to the non CPS platforms as CPS is the only user, but it allows an overall consolidation of this functionality. No functional change intended. 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.803238859@linutronix.de --- arch/mips/Kconfig | 1 + arch/mips/cavium-octeon/smp.c | 1 + arch/mips/include/asm/smp-ops.h | 1 + arch/mips/kernel/smp-bmips.c | 1 + arch/mips/kernel/smp-cps.c | 14 +++++--------- arch/mips/kernel/smp.c | 8 ++++++++ arch/mips/loongson64/smp.c | 1 + 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c2f5498..30e90a2 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2285,6 +2285,7 @@ config MIPS_CPS select MIPS_CM select MIPS_CPS_PM if HOTPLUG_CPU select SMP + select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU select SYNC_R4K if (CEVT_R4K || CSRC_R4K) select SYS_SUPPORTS_HOTPLUG_CPU select SYS_SUPPORTS_SCHED_SMT if CPU_MIPSR6 diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c index 4212584..33c0968 100644 --- a/arch/mips/cavium-octeon/smp.c +++ b/arch/mips/cavium-octeon/smp.c @@ -345,6 +345,7 @@ void play_dead(void) int cpu = cpu_number_map(cvmx_get_core_num()); idle_task_exit(); + cpuhp_ap_report_dead(); octeon_processor_boot = 0xff; per_cpu(cpu_state, cpu) = CPU_DEAD; diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h index 0145bbf..5719ff4 100644 --- a/arch/mips/include/asm/smp-ops.h +++ b/arch/mips/include/asm/smp-ops.h @@ -33,6 +33,7 @@ struct plat_smp_ops { #ifdef CONFIG_HOTPLUG_CPU int (*cpu_disable)(void); void (*cpu_die)(unsigned int cpu); + void (*cleanup_dead_cpu)(unsigned cpu); #endif #ifdef CONFIG_KEXEC void (*kexec_nonboot_cpu)(void); diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index 15466d4..c074ecc 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -392,6 +392,7 @@ static void bmips_cpu_die(unsigned int cpu) void __ref play_dead(void) { idle_task_exit(); + cpuhp_ap_report_dead(); /* flush data cache */ _dma_cache_wback_inv(0, ~0); diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c index 62f677b..d7fdbec 100644 --- a/arch/mips/kernel/smp-cps.c +++ b/arch/mips/kernel/smp-cps.c @@ -503,8 +503,7 @@ void play_dead(void) } } - /* This CPU has chosen its way out */ - (void)cpu_report_death(); + cpuhp_ap_report_dead(); cps_shutdown_this_cpu(cpu_death); @@ -527,7 +526,9 @@ static void wait_for_sibling_halt(void *ptr_cpu) } while (!(halted & TCHALT_H)); } -static void cps_cpu_die(unsigned int cpu) +static void cps_cpu_die(unsigned int cpu) { } + +static void cps_cleanup_dead_cpu(unsigned cpu) { unsigned core = cpu_core(&cpu_data[cpu]); unsigned int vpe_id = cpu_vpe_id(&cpu_data[cpu]); @@ -535,12 +536,6 @@ static void cps_cpu_die(unsigned int cpu) unsigned stat; int err; - /* Wait for the cpu to choose its way out */ - if (!cpu_wait_death(cpu, 5)) { - pr_err("CPU%u: didn't offline\n", cpu); - return; - } - /* * Now wait for the CPU to actually offline. Without doing this that * offlining may race with one or more of: @@ -624,6 +619,7 @@ static const struct plat_smp_ops cps_smp_ops = { #ifdef CONFIG_HOTPLUG_CPU .cpu_disable = cps_cpu_disable, .cpu_die = cps_cpu_die, + .cleanup_dead_cpu = cps_cleanup_dead_cpu, #endif #ifdef CONFIG_KEXEC .kexec_nonboot_cpu = cps_kexec_nonboot_cpu, diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 1d93b85..90c71d8 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -690,6 +690,14 @@ void flush_tlb_one(unsigned long vaddr) EXPORT_SYMBOL(flush_tlb_page); EXPORT_SYMBOL(flush_tlb_one); +#ifdef CONFIG_HOTPLUG_CORE_SYNC_DEAD +void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu) +{ + if (mp_ops->cleanup_dead_cpu) + mp_ops->cleanup_dead_cpu(cpu); +} +#endif + #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST static void tick_broadcast_callee(void *info) diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c index b0e8bb9..cdecd7a 100644 --- a/arch/mips/loongson64/smp.c +++ b/arch/mips/loongson64/smp.c @@ -775,6 +775,7 @@ void play_dead(void) void (*play_dead_at_ckseg1)(int *); idle_task_exit(); + cpuhp_ap_report_dead(); prid_imp = read_c0_prid() & PRID_IMP_MASK; prid_rev = read_c0_prid() & PRID_REV_MASK;