From nobody Fri Dec 19 05:04:30 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB8AAC001DB for ; Sat, 2 Sep 2023 16:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234790AbjIBQ5n (ORCPT ); Sat, 2 Sep 2023 12:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbjIBQ5l (ORCPT ); Sat, 2 Sep 2023 12:57:41 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DBDE4B; Sat, 2 Sep 2023 09:57:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vAo+LFd8P1VYayE/TRtQa6KVzenEdB+YZHq1dQ5Nrf4=; b=YGl8zWLC5Fw7FoYB9JWESmEblh qaI2lzebLVQH5vC7Q0xhTBTyew0TOU/ZOYoE5rirY33nUgucZWm9wm3HCqb5V2uRJP1yodAYc+LZw KTiunZr1Yk48zQZ0QyyRHS6xNScTwBzj0VF7IRXUiwtdiffK9yz7x6h7ZGsZUqn09kE1oUDY3/55J F2A/auH2OK0cw2TBDPKkdOfKWIw8xT18+uf3CQl9mqYS02vX0lGHDwyCc1FYW89RsSTh7rA8WmZu6 6PxfkKf22KHyfYmm/bNLaPkc5Chn8vSFLn96/50WPy+DXlbUw6Es5sRtgMoPMBw868RAiS9rqS0YY aQe2567Q==; Received: from [179.232.147.2] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qcTwC-001Q7M-Mp; Sat, 02 Sep 2023 18:57:33 +0200 From: "Guilherme G. Piccoli" To: linux-alpha@vger.kernel.org, mattst88@gmail.com Cc: linux-kernel@vger.kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, "Guilherme G. Piccoli" , Ivan Kokshaysky , Richard Henderson , Petr Mladek Subject: [PATCH v5] alpha: Clean-up the panic notifier code Date: Sat, 2 Sep 2023 13:44:15 -0300 Message-ID: <20230902165725.3504046-1-gpiccoli@igalia.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The alpha panic notifier has some code issues, not following the conventions of other notifiers. Also, it might halt the machine but still it is set to run as early as possible, which doesn't seem to be a good idea. So, let's clean the code and set the notifier to run as the latest, following the same approach other architectures are doing - also, remove the unnecessary include of a header already included indirectly. Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Richard Henderson Reviewed-by: Petr Mladek Signed-off-by: Guilherme G. Piccoli --- V5: rebased against v6.5, build-tested using defconfig. V4: https://lore.kernel.org/lkml/20230220212245.153554-1-gpiccoli@igalia.co= m/ Hi Matt, apologies for the annoyance. Seems that this one was never picked-= up; let me know if there's anything missing. Thanks in advance, Guilherme arch/alpha/kernel/setup.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 3d7473531ab1..07afd2bf18d7 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -41,19 +41,11 @@ #include #include #endif -#include #include #include #include #include =20 -static int alpha_panic_event(struct notifier_block *, unsigned long, void = *); -static struct notifier_block alpha_panic_block =3D { - alpha_panic_event, - NULL, - INT_MAX /* try to do it first */ -}; - #include #include #include @@ -434,6 +426,21 @@ static const struct sysrq_key_op srm_sysrq_reboot_op = =3D { }; #endif =20 +static int alpha_panic_event(struct notifier_block *this, + unsigned long event, void *ptr) +{ + /* If we are using SRM and serial console, just hard halt here. */ + if (alpha_using_srm && srmcons_output) + __halt(); + + return NOTIFY_DONE; +} + +static struct notifier_block alpha_panic_block =3D { + .notifier_call =3D alpha_panic_event, + .priority =3D INT_MIN, /* may not return, do it last */ +}; + void __init setup_arch(char **cmdline_p) { @@ -1426,19 +1433,6 @@ const struct seq_operations cpuinfo_op =3D { .show =3D show_cpuinfo, }; =20 - -static int -alpha_panic_event(struct notifier_block *this, unsigned long event, void *= ptr) -{ -#if 1 - /* FIXME FIXME FIXME */ - /* If we are using SRM and serial console, just hard halt here. */ - if (alpha_using_srm && srmcons_output) - __halt(); -#endif - return NOTIFY_DONE; -} - static __init int add_pcspkr(void) { struct platform_device *pd; --=20 2.41.0