[11/21] drivers: base: Print a warning instead of panic() when register_cpu() fails
Message ID | E1r5R3W-00CszU-GM@rmk-PC.armlinux.org.uk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp630802vqb; Tue, 21 Nov 2023 05:47:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkT+JdLJx/ZRUcUJerBhsMixiEIZ2G6f1avY3sgHZKjASqRHfhJEClJfgRyieED6nTqNE5 X-Received: by 2002:a17:902:7442:b0:1cc:e823:c8cc with SMTP id e2-20020a170902744200b001cce823c8ccmr7438106plt.41.1700574473211; Tue, 21 Nov 2023 05:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700574473; cv=none; d=google.com; s=arc-20160816; b=k07vV9yiGNM8F1vCcWAUTVhPCxXsVPk5tRfCOReWRoWNzwvlBOB3Sj2/SFikAT31+w VHJkWKaz44GEpXyjERqQcjGymlAvpQfhDatknpuA8o7dyWu4yuljXiIa7P19bD5c5i4R uVz5LSEnkFjbkUVSHPjbbBQkZyoNNxgJIcBChQjYDIJXJ1C57IxC5qiv+G2qxu49xV7T lcNLcvnc6T7mQcUPpq0AQuzyRyXfGRySLu9Y/c6kyk80S642hXyL3obL6PNmQm1uSiJb kkBNJSgrgsASoZBufrep8DY84vlcP6ZAHLc0UStE8ULnsUDey+OntdZE6bs4WdLBnhol UzWA== 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=OkDhpe8Fjqhy+RwbS5GO6YsrbQf6HnPLrJyOGiqcGrs=; fh=l8EFpk7Ei3L85Td2A01hBrINexzBkrfns5u14IZj5lo=; b=NzjYp8mFBEg0dWH8MH//soWgfiLEHz5PRtuKbRa/bqzLxA1vS6N1zOy4PihEmu/wa+ VSj5NHRzvwx2tKR26jIv2Xf3lMDRUPuIJJVADnbri9Vuc8RpDa5XC3yaIF/fwF5Z0/Mm R4nchydLWKQ5HhDMUXThWGJpKoS0eDqC/rvqpoN6nA2M9GvFECoV333ZwdY6GPSGl6gg V0H8RzCyIN6VwYQsK+nNLs3511zcZ+fy12FqQ1pjlakxFuR53j54HwZMiQKXeciwFLRp QbeZXXEXdfelMmiL8wzG2IULYGa5zjqlb9hr5QwnGqQByX3b01TjhcvPFbAT8HGfRoDC OzyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uR0WCwzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o18-20020a170902d4d200b001cf75b042fesi85571plg.52.2023.11.21.05.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 05:47:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uR0WCwzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 0C784803E78F; Tue, 21 Nov 2023 05:45:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234474AbjKUNpS (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Tue, 21 Nov 2023 08:45:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbjKUNo4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Nov 2023 08:44:56 -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 B45641719; Tue, 21 Nov 2023 05:44:52 -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=OkDhpe8Fjqhy+RwbS5GO6YsrbQf6HnPLrJyOGiqcGrs=; b=uR0WCwzcX0Tghl5H8yimLbqsQM yEr4C9gly46wqpaUIHGVKbiccXUi2NW8qB5k6JnTqH/O9Rsi0Yl1odaX14EER7zTlt7WxWUTkX9lY LbS1YdCd4s8DozBLUITh/wK6QEtwSF+iis8PrEC/edX9bdlUaXzmwOxwqrc91BOEgT21goKImrNFh PNPnR+SX+0QWSViOV2aVj1z6nyA8guj+7rda0ZRznfMOhsmpQi08zlAGz6oLgFQDvaKW0wy2ng0/l KVZb37PuuFrS5G+iPFgYd+J+djBIW5utxZpbotE0ysEaD4MWMv5+FH0NVVw0L8BmoKYhWQxXTegIi SeObvE8w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50550 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 1r5R3U-00078z-1k; Tue, 21 Nov 2023 13:44:44 +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 1r5R3W-00CszU-GM; Tue, 21 Nov 2023 13:44:46 +0000 In-Reply-To: <ZVyz/Ve5pPu8AWoA@shell.armlinux.org.uk> References: <ZVyz/Ve5pPu8AWoA@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 11/21] drivers: base: Print a warning instead of panic() when register_cpu() fails MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: <E1r5R3W-00CszU-GM@rmk-PC.armlinux.org.uk> Sender: Russell King <rmk@armlinux.org.uk> Date: Tue, 21 Nov 2023 13:44:46 +0000 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: <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 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 05:45:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783181578451751695 X-GMAIL-MSGID: 1783181578451751695 |
Series |
Initial cleanups for vCPU hotplug
|
|
Commit Message
Russell King (Oracle)
Nov. 21, 2023, 1:44 p.m. UTC
From: James Morse <james.morse@arm.com> loongarch, mips, parisc, riscv and sh all print a warning if register_cpu() returns an error. Architectures that use GENERIC_CPU_DEVICES call panic() instead. Errors in this path indicate something is wrong with the firmware description of the platform, but the kernel is able to keep running. Downgrade this to a warning to make it easier to debug this issue. This will allow architectures that switching over to GENERIC_CPU_DEVICES to drop their warning, but keep the existing behaviour. Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Shaoqin Huang <shahuang@redhat.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> --- drivers/base/cpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Comments
On Tue, 21 Nov 2023 13:44:46 +0000 Russell King <rmk+kernel@armlinux.org.uk> wrote: > From: James Morse <james.morse@arm.com> > > loongarch, mips, parisc, riscv and sh all print a warning if > register_cpu() returns an error. Architectures that use > GENERIC_CPU_DEVICES call panic() instead. > > Errors in this path indicate something is wrong with the firmware > description of the platform, but the kernel is able to keep running. > > Downgrade this to a warning to make it easier to debug this issue. > > This will allow architectures that switching over to GENERIC_CPU_DEVICES > to drop their warning, but keep the existing behaviour. > > Signed-off-by: James Morse <james.morse@arm.com> > Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> > Reviewed-by: Shaoqin Huang <shahuang@redhat.com> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
On 11/22/23 00:44, Russell King (Oracle) wrote: > From: James Morse <james.morse@arm.com> > > loongarch, mips, parisc, riscv and sh all print a warning if > register_cpu() returns an error. Architectures that use > GENERIC_CPU_DEVICES call panic() instead. > > Errors in this path indicate something is wrong with the firmware > description of the platform, but the kernel is able to keep running. > > Downgrade this to a warning to make it easier to debug this issue. > > This will allow architectures that switching over to GENERIC_CPU_DEVICES > to drop their warning, but keep the existing behaviour. > > Signed-off-by: James Morse <james.morse@arm.com> > Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> > Reviewed-by: Shaoqin Huang <shahuang@redhat.com> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> > --- > drivers/base/cpu.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > Reviewed-by: Gavin Shan <gshan@redhat.com>
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 221ffbeb1c9b..82b6a76125f5 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num) static void __init cpu_dev_register_generic(void) { - int i; + int i, ret; if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES)) return; for_each_present_cpu(i) { - if (arch_register_cpu(i)) - panic("Failed to register CPU device"); + ret = arch_register_cpu(i); + if (ret) + pr_warn("register_cpu %d failed (%d)\n", i, ret); } }