Message ID | 20230913163823.7880-26-james.morse@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp1216385vqx; Wed, 13 Sep 2023 09:45:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3HirM+AeonT0GFT0ptZ5+c9P4HVbOvWcfBoVLcbOr/kHudnkwclKEhLDv5jVud2WV4xwW X-Received: by 2002:a05:6358:99a0:b0:135:acfd:8786 with SMTP id j32-20020a05635899a000b00135acfd8786mr3448630rwb.3.1694623526161; Wed, 13 Sep 2023 09:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694623526; cv=none; d=google.com; s=arc-20160816; b=SeQVPr/P5ZrzXzaJTw87a5inSYqKLp1m+kyfuwi9TZOLBBzW+OCXz8yZa4q9lIk2zf Vr9iPW2wGXwWuIkdsFXg6GfRNH+5czsqCRxAymeCkXlLa9JQj+F4x/yjyt+VbE8hH+ss slU7bIKkMjFwedqnPsAXakIW2hQfJB9aJkdj7bS3qoQTnb487NABVWcm57VVDjg+8Q1F vOWIhKIHV9XKQbyJKGmGFdQbcivrsy7AS0m4r1WSNsTHKS0tRFwWCJYeqO2M6RRmRCOy RH/OytGiygOLh8y4E1MSId4A7TEeANaoRT8tMmPdfpfe/Qf4GBUankscCY4Bwrp0SF4r K1ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=p0QGy4Oj5aMzY+SoJ+ZbElJmr1QMj/WdF5qjVHzyVcI=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=F/de04Ha0MT0kqFfoqEfOTy6khwwzVrv63an0LQJgjUMA6CRIWX71LXiA0EWcE1dNa wTBm5adyXlwobjI30yuj34wAHgQ9JDcaTSfrJneCHQGAN0nfkUMbXaXxpmOU084Xx3w1 ORJdVonvkmx6T+shKh4k1iB00fGCpt91XRqReiWtvhsI+9rc6pN5GXMY4wOZB7ipAGPu IZx+Oo72mDCvPhTCEOrCkhqlm3DdEBo7d/79jK//NEdgj0GP8r5Rf4FkzH45rgOsKKDD 1Q9g5UqGINPdK5ziiq5+OyOaVx2jtV+G9Q4TZJVMLkwvGsd7w8YEDc4JO4JtD+3W3iix 2zuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id v202-20020a6361d3000000b0057777451a91si5871004pgb.581.2023.09.13.09.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:45:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 8AD4F827D0F2; Wed, 13 Sep 2023 09:41:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231222AbjIMQlX (ORCPT <rfc822;pwkd43@gmail.com> + 35 others); Wed, 13 Sep 2023 12:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230458AbjIMQki (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Sep 2023 12:40:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76661270B; Wed, 13 Sep 2023 09:39:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6EFCDC15; Wed, 13 Sep 2023 09:40:20 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C0403F5A1; Wed, 13 Sep 2023 09:39:41 -0700 (PDT) From: James Morse <james.morse@arm.com> To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev Cc: x86@kernel.org, Salil Mehta <salil.mehta@huawei.com>, Russell King <linux@armlinux.org.uk>, Jean-Philippe Brucker <jean-philippe@linaro.org>, jianyong.wu@arm.com, justin.he@arm.com Subject: [RFC PATCH v2 25/35] LoongArch: Use the __weak version of arch_unregister_cpu() Date: Wed, 13 Sep 2023 16:38:13 +0000 Message-Id: <20230913163823.7880-26-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230913163823.7880-1-james.morse@arm.com> References: <20230913163823.7880-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:41:27 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776941558694031470 X-GMAIL-MSGID: 1776941558694031470 |
Series |
ACPI/arm64: add support for virtual cpuhotplug
|
|
Commit Message
James Morse
Sept. 13, 2023, 4:38 p.m. UTC
LoongArch provides its own arch_unregister_cpu(). This clears the
hotpluggable flag, then unregisters the CPU.
It isn't necessary to clear the hotpluggable flag when unregistering
a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices
pointer, meaning cpu_is_hotpluggable() will return false, as
get_cpu_device() has returned NULL.
Remove arch_unregister_cpu() and use the __weak version.
Signed-off-by: James Morse <james.morse@arm.com>
---
arch/loongarch/kernel/topology.c | 9 ---------
1 file changed, 9 deletions(-)
Comments
On Wed, 13 Sep 2023 16:38:13 +0000 James Morse <james.morse@arm.com> wrote: > LoongArch provides its own arch_unregister_cpu(). This clears the > hotpluggable flag, then unregisters the CPU. > > It isn't necessary to clear the hotpluggable flag when unregistering > a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices > pointer, meaning cpu_is_hotpluggable() will return false, as > get_cpu_device() has returned NULL. Thought that looked odd earlier but didn't care enough to dig. Seem unlikely state would persist for an unregistered cpu. Great to see confirmation. > > Remove arch_unregister_cpu() and use the __weak version. > > Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > arch/loongarch/kernel/topology.c | 9 --------- > 1 file changed, 9 deletions(-) > > diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c > index 8e4441c1ff39..5a75e2cc0848 100644 > --- a/arch/loongarch/kernel/topology.c > +++ b/arch/loongarch/kernel/topology.c > @@ -16,13 +16,4 @@ int arch_register_cpu(int cpu) > return register_cpu(c, cpu); > } > EXPORT_SYMBOL(arch_register_cpu); > - > -void arch_unregister_cpu(int cpu) > -{ > - struct cpu *c = &per_cpu(cpu_devices, cpu); > - > - c->hotpluggable = 0; > - unregister_cpu(c); > -} > -EXPORT_SYMBOL(arch_unregister_cpu); > #endif
On 9/14/23 02:38, James Morse wrote: > LoongArch provides its own arch_unregister_cpu(). This clears the > hotpluggable flag, then unregisters the CPU. > > It isn't necessary to clear the hotpluggable flag when unregistering > a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices > pointer, meaning cpu_is_hotpluggable() will return false, as > get_cpu_device() has returned NULL. > > Remove arch_unregister_cpu() and use the __weak version. > > Signed-off-by: James Morse <james.morse@arm.com> > --- > arch/loongarch/kernel/topology.c | 9 --------- > 1 file changed, 9 deletions(-) > I think arch/x86/kernel/topology.c::arch_unregister_cpu() can be dropped either. Reviewed-by: Gavin Shan <gshan@redhat.com> > diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c > index 8e4441c1ff39..5a75e2cc0848 100644 > --- a/arch/loongarch/kernel/topology.c > +++ b/arch/loongarch/kernel/topology.c > @@ -16,13 +16,4 @@ int arch_register_cpu(int cpu) > return register_cpu(c, cpu); > } > EXPORT_SYMBOL(arch_register_cpu); > - > -void arch_unregister_cpu(int cpu) > -{ > - struct cpu *c = &per_cpu(cpu_devices, cpu); > - > - c->hotpluggable = 0; > - unregister_cpu(c); > -} > -EXPORT_SYMBOL(arch_unregister_cpu); > #endif Thanks, Gavin
On Thu, Sep 14, 2023 at 03:41:11PM +0100, Jonathan Cameron wrote: > On Wed, 13 Sep 2023 16:38:13 +0000 > James Morse <james.morse@arm.com> wrote: > > > LoongArch provides its own arch_unregister_cpu(). This clears the > > hotpluggable flag, then unregisters the CPU. > > > > It isn't necessary to clear the hotpluggable flag when unregistering > > a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices > > pointer, meaning cpu_is_hotpluggable() will return false, as > > get_cpu_device() has returned NULL. > > Thought that looked odd earlier but didn't care enough to dig. > Seem unlikely state would persist for an unregistered cpu. > Great to see confirmation. Would it make sense to move this immedaitely after "LoongArch: Switch over to GENERIC_CPU_DEVICES" ?
diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c index 8e4441c1ff39..5a75e2cc0848 100644 --- a/arch/loongarch/kernel/topology.c +++ b/arch/loongarch/kernel/topology.c @@ -16,13 +16,4 @@ int arch_register_cpu(int cpu) return register_cpu(c, cpu); } EXPORT_SYMBOL(arch_register_cpu); - -void arch_unregister_cpu(int cpu) -{ - struct cpu *c = &per_cpu(cpu_devices, cpu); - - c->hotpluggable = 0; - unregister_cpu(c); -} -EXPORT_SYMBOL(arch_unregister_cpu); #endif