Message ID | E1r0JLL-00CTxD-Gc@rmk-PC.armlinux.org.uk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp140272vqo; Tue, 7 Nov 2023 02:31:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmTucExecufkeCLDHyG0RTP1I07yFtEtNLqYUNJ/ne4f47rsrI//bKpEY0nHcOGrl85YEk X-Received: by 2002:a05:6830:1094:b0:6c0:9e24:6eab with SMTP id y20-20020a056830109400b006c09e246eabmr34034173oto.33.1699353071479; Tue, 07 Nov 2023 02:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699353071; cv=none; d=google.com; s=arc-20160816; b=ZDcuv2DYgO0gq0WsNkbO/FGxyQ0MPga0xYs0rds3YzoGLxN76XsLEEEA/iP7+oMoV0 Wjxu93Gb5rdyws5OBRcfDQrs/VsB1cZFK1SK8NB0N1REtgRM72BCRvWacqP5IBMIb66n FPyu1key/jbC2gRgW25zfxmg2/DjZFd2+WirHJT5w508GqEdJU4PQ7S41XJbTfngnnEG 75rvmTyMZ/p9JILwfhyMVqA+vl/k5VtszgrVHVMCT760eD9nabdsvCdRIaH/cXJqcRhW VJNy6aes2tdmOZmjGLa/W1MoOmriSqk8G2AIfQyMQJKZ2oeg68Ku4iocGC5O4alhzXts /Meg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=SNsUqv3mHEJC05AIRv8JP1Jps5pzoeiw8iuzzTO88jM=; fh=l8EFpk7Ei3L85Td2A01hBrINexzBkrfns5u14IZj5lo=; b=ZRiWN+sr/e3KBq7Wq556Os+tBuvC+3tPh9wP7lrZyIKP+P2FTv5DYxEMNT9P3M+m+9 my+jmbF1+9vgGtkx+hdSBjIJMCxLc2z+19qpmgDQV7NBmQWyEQTOFOIuue5aTyNu9cuw Sh5a6ZyIp6vyVSijzr8PpEMDxCHn2BtIUqrY2IfVFz3B4z4qgWG77Vo3Vor27KpPb1fA P9RBePjluRmdgdGoT9cG6ljO1mKLIDtMfvWdlkk+yiNVEcojVMUbVZYjtmVBxhrhjyU1 84kkg9SeRCvHpZ86KPMZ4pwKKQUrGY70GIAq9eamfWOTFxdFBaN/XVhDkGqa2rsQ6S5c Sw/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=gaYb0AGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id w8-20020a056a0014c800b006bf317c9397si10559269pfu.244.2023.11.07.02.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:31:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=gaYb0AGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id BFD8D80ACCE9; Tue, 7 Nov 2023 02:31:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234071AbjKGKab (ORCPT <rfc822;lhua1029@gmail.com> + 32 others); Tue, 7 Nov 2023 05:30:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233956AbjKGKaT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 7 Nov 2023 05:30:19 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215B310E0; Tue, 7 Nov 2023 02:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SNsUqv3mHEJC05AIRv8JP1Jps5pzoeiw8iuzzTO88jM=; b=gaYb0AGpNaGyoeAwB30k2zFAeu QtE/mEgx2bN+6/cRgeApfIsEGJb5BL+f4bWGno6vbNHXGoTsCsxHtO0KnvHEuiHfneaXcVDdgwQiW YFfzzRt7XVvbgHS3f6+K+sKJzN4D6hyQXJnEsqD4fn1yKl5PoIpHkx3vrfiWVoCl248NoqIfc9bdM +lapY16Nh7cPph9APkox+294r9ekgPv7okr3Udzy0ho27B/UyD7w5g/JQ8wTyEc8jRbp5pzJj48zv KxlKag3ePeznKBc6qDe594xO56tMzv/1jI3u5/9/ONDwx/tUUqNCSI10JpZOAbpICTK9NFkA6zXK7 lxjWydMQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41354 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <rmk@armlinux.org.uk>) id 1r0JLP-0000FP-2Y; Tue, 07 Nov 2023 10:30:04 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from <rmk@rmk-PC.armlinux.org.uk>) id 1r0JLL-00CTxD-Gc; Tue, 07 Nov 2023 10:29:59 +0000 In-Reply-To: <ZUoRY33AAHMc5ThW@shell.armlinux.org.uk> References: <ZUoRY33AAHMc5ThW@shell.armlinux.org.uk> From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> 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, x86@kernel.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta <salil.mehta@huawei.com>, Jean-Philippe Brucker <jean-philippe@linaro.org>, jianyong.wu@arm.com, justin.he@arm.com, James Morse <james.morse@arm.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu> Subject: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu() MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: <E1r0JLL-00CTxD-Gc@rmk-PC.armlinux.org.uk> Sender: Russell King <rmk@armlinux.org.uk> Date: Tue, 07 Nov 2023 10:29:59 +0000 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 07 Nov 2023 02:31:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781900846045042940 X-GMAIL-MSGID: 1781900846045042940 |
Series |
Initial cleanups for vCPU hotplug
|
|
Commit Message
Russell King (Oracle)
Nov. 7, 2023, 10:29 a.m. UTC
From: James Morse <james.morse@arm.com> Add arch_unregister_cpu() to allow the ACPI machinery to call unregister_cpu(). This is enough for arm64, riscv and loongarch, but needs to be overridden by x86 and ia64 who need to do more work. CC: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: James Morse <james.morse@arm.com> --- Changes since v1: * Added CONFIG_HOTPLUG_CPU ifdeffery around unregister_cpu Changes since RFC v2: * Move earlier in the series --- drivers/base/cpu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Comments
On 11/7/23 18:29, Russell King (Oracle) wrote: > From: James Morse <james.morse@arm.com> > > Add arch_unregister_cpu() to allow the ACPI machinery to call > unregister_cpu(). This is enough for arm64, riscv and loongarch, but > needs to be overridden by x86 and ia64 who need to do more work. > > CC: Jean-Philippe Brucker <jean-philippe@linaro.org> > Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Shaoqin Huang <shahuang@redhat.com> > --- > Changes since v1: > * Added CONFIG_HOTPLUG_CPU ifdeffery around unregister_cpu > Changes since RFC v2: > * Move earlier in the series > --- > drivers/base/cpu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 579064fda97b..58bb86091b34 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -531,7 +531,14 @@ int __weak arch_register_cpu(int cpu) > { > return register_cpu(&per_cpu(cpu_devices, cpu), cpu); > } > -#endif > + > +#ifdef CONFIG_HOTPLUG_CPU > +void __weak arch_unregister_cpu(int num) > +{ > + unregister_cpu(&per_cpu(cpu_devices, num)); > +} > +#endif /* CONFIG_HOTPLUG_CPU */ > +#endif /* CONFIG_GENERIC_CPU_DEVICES */ > > static void __init cpu_dev_register_generic(void) > {
On 11/7/23 20:29, Russell King (Oracle) wrote: > From: James Morse <james.morse@arm.com> > > Add arch_unregister_cpu() to allow the ACPI machinery to call > unregister_cpu(). This is enough for arm64, riscv and loongarch, but > needs to be overridden by x86 and ia64 who need to do more work. > > CC: Jean-Philippe Brucker <jean-philippe@linaro.org> > Signed-off-by: James Morse <james.morse@arm.com> > --- > Changes since v1: > * Added CONFIG_HOTPLUG_CPU ifdeffery around unregister_cpu > Changes since RFC v2: > * Move earlier in the series > --- > drivers/base/cpu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > Reviewed-by: Gavin Shan <gshan@redhat.com>
On Tue, Nov 07, 2023 at 10:29:59AM +0000, Russell King wrote: > From: James Morse <james.morse@arm.com> > > Add arch_unregister_cpu() to allow the ACPI machinery to call > unregister_cpu(). This is enough for arm64, riscv and loongarch, but > needs to be overridden by x86 and ia64 who need to do more work. > > CC: Jean-Philippe Brucker <jean-philippe@linaro.org> > Signed-off-by: James Morse <james.morse@arm.com> > --- > Changes since v1: > * Added CONFIG_HOTPLUG_CPU ifdeffery around unregister_cpu > Changes since RFC v2: > * Move earlier in the series > --- > drivers/base/cpu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 579064fda97b..58bb86091b34 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -531,7 +531,14 @@ int __weak arch_register_cpu(int cpu) > { > return register_cpu(&per_cpu(cpu_devices, cpu), cpu); > } > -#endif > + > +#ifdef CONFIG_HOTPLUG_CPU > +void __weak arch_unregister_cpu(int num) > +{ > + unregister_cpu(&per_cpu(cpu_devices, num)); > +} > +#endif /* CONFIG_HOTPLUG_CPU */ I have previously asked the question whether we should provide a stub weak function for the !HOTPLUG_CPU case for this, which would alleviate the concerns around if (IS_ENABLED()) in some of the later hotplug vCPU patches... which failed to get _any_ responses. So, I'm now going to deem the comment I received about if (IS_ENABLED()) potentially causing issues to be unimportant, and thus there's no need for a stub weak function. If we start getting compile errors, then we can address the issue at that point. So far, however, the kernel build bot has not identified that this as an issue... and it's been chewing on this entire patch set for well over a month now.
> > + > > +#ifdef CONFIG_HOTPLUG_CPU > > +void __weak arch_unregister_cpu(int num) > > +{ > > + unregister_cpu(&per_cpu(cpu_devices, num)); > > +} > > +#endif /* CONFIG_HOTPLUG_CPU */ > > I have previously asked the question whether we should provide a > stub weak function for the !HOTPLUG_CPU case for this, which would > alleviate the concerns around if (IS_ENABLED()) in some of the later > hotplug vCPU patches... which failed to get _any_ responses. > > So, I'm now going to deem the comment I received about if (IS_ENABLED()) > potentially causing issues to be unimportant, and thus there's no > need for a stub weak function. If we start getting compile errors, > then we can address the issue at that point. So far, however, the > kernel build bot has not identified that this as an issue... and it's > been chewing on this entire patch set for well over a month now. > Make sense to fix this only if it's a real problem. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 579064fda97b..58bb86091b34 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -531,7 +531,14 @@ int __weak arch_register_cpu(int cpu) { return register_cpu(&per_cpu(cpu_devices, cpu), cpu); } -#endif + +#ifdef CONFIG_HOTPLUG_CPU +void __weak arch_unregister_cpu(int num) +{ + unregister_cpu(&per_cpu(cpu_devices, num)); +} +#endif /* CONFIG_HOTPLUG_CPU */ +#endif /* CONFIG_GENERIC_CPU_DEVICES */ static void __init cpu_dev_register_generic(void) {