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: 94554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp283866vqo; Tue, 16 May 2023 02:12:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6qvGfPkYsWiR7XUiAH3v/RZIwKSwsHDNrv3mOEJIpV6MZ3OHugzpYd0VMlEzUyrWbiQOay X-Received: by 2002:a17:90a:4214:b0:250:6c4d:e406 with SMTP id o20-20020a17090a421400b002506c4de406mr29828402pjg.22.1684228320455; Tue, 16 May 2023 02:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228320; cv=none; d=google.com; s=arc-20160816; b=c6LEaRKMNmS7S/JYWfPJqIwz/GBeh1YuyWarjs3vcOkpRjjT4mcLtlZnTnxEkVP8+c 7wIoQJk8dQNXjnxTDRebQHhb2xMM8esqiKGcGXbytZ4brTZbfym4lM658EVwNcNtM/+T hTRPiCwWjJ6F/zruH1888+eQjCQIHyx4cvXnXluPaXEqeWl6HM1ZIJCY/Ks5+75M21Lj eV1/wByiYbxga39hRAl33BX42iIEebBWpFZiX7kt486BlTWwixuhj9aiQ60viH2GBNMN kciN85awaQEWQOqw1IHQyJ2Ue30pPJtAhtnWcKaCxAcUmiFie1N3jN8c6ylZrCkvUrWS litA== 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=7Sa2180BiRObjiZ9fPuEKFG9tozXWYnkG/1s3K005DQ=; b=O4wOOXCA+R8AfwKyHCU/CeKdA9kOjx0pu3aKWK6+TtL537uzR3pGjnYfCASLw+SmKG kR2TfI4/oDa2wvVLwLb70TP4MWjTrEriyzbRoaiOjolHrXqbWLYse0U0FBP6QtutBQo2 Rd8b6h38Frog2skQtl8s0WFUawFuZaSlyzsEnxskV+5v6eCQ5Kc5zeP4zFyTXeiOjedW 1qG4xXwyhahPPxUACPJ8aCSaU38Gy4BeqDH5aDS93vIhslBOvbyMuCRgi3dy9Ut9Znlr 4j53nr45V0uy3Qxtk413xHOtV6rQnbeQP2STFtHjX9y2DtOWfPKO2lZeP4+QKPA2+WGB 1DXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wy1slCFW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 mi13-20020a17090b4b4d00b00247828153aasi1429188pjb.65.2023.05.16.02.11.40; Tue, 16 May 2023 02:12: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=Wy1slCFW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S231462AbjEPJKk (ORCPT + 99 others); Tue, 16 May 2023 05:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbjEPJKE (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 299034C0A; 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=7Sa2180BiRObjiZ9fPuEKFG9tozXWYnkG/1s3K005DQ=; b=Wy1slCFWqaJOyltK4VSAOqxwaTu74jz+ru2WI57GeW+kTZTVfzjVMWU63+Lqg49Cy2CLp5 b5u31OYOPMvhp6Cvt4tYzCayopeS1+ZrL90Jg3tDjuN/CbRDesT1U4hfbS22EAiuF7U0aH +8oxM2uBXMnBJ+/Rveu3GbRnB0kUa88oMsGjnjHsD5oC+VpAUym8/d8j2Eot91uMklTc96 qTpu2peR0tdtZW/Km8HYnZIaW74RObTcN3Hy83O+ZGMswtVBfufPvPF/BxAr+7WjnO6VfG bbZhpKLxNL1Bcauhklq2uuZEFA7Pf3G+dmabpDE63gO9JOibx5cJxVrHpXBufg== 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=7Sa2180BiRObjiZ9fPuEKFG9tozXWYnkG/1s3K005DQ=; b=bCZ6BqhmUQpbR8Nq+2Mm16yt5eX3dDmfCa7LQA6YWryzW9i6kEP5TUe4obO6WAvgWFQNIB 5QFT4Ye5EIahnGCg== 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] riscv: Switch to hotplug core state synchronization Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , Palmer Dabbelt , Michael Kelley , Oleksandr Natalenko , Helge Deller , "Guilherme G. Piccoli" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230512205256.916055844@linutronix.de> References: <20230512205256.916055844@linutronix.de> MIME-Version: 1.0 Message-ID: <168422819629.404.6986084551117973584.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?1765724202094964494?= X-GMAIL-MSGID: =?utf-8?q?1766041395294863796?= The following commit has been merged into the smp/core branch of tip: Commit-ID: 72b11aa7f8f93449141544cecb21b2963416902d Gitweb: https://git.kernel.org/tip/72b11aa7f8f93449141544cecb21b2963416902d Author: Thomas Gleixner AuthorDate: Fri, 12 May 2023 23:07:40 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 15 May 2023 13:44:59 +02:00 riscv: Switch to hotplug core state synchronization Switch to the CPU hotplug core state tracking and synchronization mechanim. No functional change intended. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Palmer Dabbelt 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.916055844@linutronix.de --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/smp.h | 2 +- arch/riscv/kernel/cpu-hotplug.c | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 348c0fa..13f0584 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -122,6 +122,7 @@ config RISCV select HAVE_RSEQ select HAVE_STACKPROTECTOR select HAVE_SYSCALL_TRACEPOINTS + select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU select IRQ_DOMAIN select IRQ_FORCED_THREADING select KASAN_VMALLOC if KASAN diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h index c4b7701..0d55584 100644 --- a/arch/riscv/include/asm/smp.h +++ b/arch/riscv/include/asm/smp.h @@ -70,7 +70,7 @@ asmlinkage void smp_callin(void); #if defined CONFIG_HOTPLUG_CPU int __cpu_disable(void); -void __cpu_die(unsigned int cpu); +static inline void __cpu_die(unsigned int cpu) { } #endif /* CONFIG_HOTPLUG_CPU */ #else diff --git a/arch/riscv/kernel/cpu-hotplug.c b/arch/riscv/kernel/cpu-hotplug.c index a941adc..457a18e 100644 --- a/arch/riscv/kernel/cpu-hotplug.c +++ b/arch/riscv/kernel/cpu-hotplug.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -49,17 +50,15 @@ int __cpu_disable(void) return ret; } +#ifdef CONFIG_HOTPLUG_CPU /* - * Called on the thread which is asking for a CPU to be shutdown. + * Called on the thread which is asking for a CPU to be shutdown, if the + * CPU reported dead to the hotplug core. */ -void __cpu_die(unsigned int cpu) +void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu) { int ret = 0; - if (!cpu_wait_death(cpu, 5)) { - pr_err("CPU %u: didn't die\n", cpu); - return; - } pr_notice("CPU%u: off\n", cpu); /* Verify from the firmware if the cpu is really stopped*/ @@ -76,9 +75,10 @@ void __noreturn arch_cpu_idle_dead(void) { idle_task_exit(); - (void)cpu_report_death(); + cpuhp_ap_report_dead(); cpu_ops[smp_processor_id()]->cpu_stop(); /* It should never reach here */ BUG(); } +#endif