From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Guilherme G. Piccoli" Subject: [PATCH 10/30] alpha: Clean-up the panic notifier code Date: Wed, 27 Apr 2022 19:49:04 -0300 Message-ID: <20220427224924.592546-11-gpiccoli@igalia.com> References: <20220427224924.592546-1-gpiccoli@igalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GAmiLDUjFV6bT3GHHEdjgDw+5jPw5GID/18Xc+UlvRs=; b=E/fx0wCCqd1EGJ AMlR4e2hXUTbf9kmIk8gpej/+p0ldJk7j02BQo8akqJJwxqhu7MsjTAIQF+QS7rxYKre1hTRnCL5Y UDF9g+6V2bUmVZwvDlhDycHCqjtRo9xML36V9DnqV1wmUrCBMR8PqfWMWXAta6LGGPKHgNiUeMQE7 Xq9guAwVSHpWXflb078MCqgZpZi8H5A3uSvArbgxnKclTT7GHK4WYs+t47v1iKbjiirLq536VL7Em r4gi8QSm3p6arYCkWGP/520UduBnE0YHgc0a+Cdg/NylAnKeP28FMb/Kc2+ScbWhzokh9/4ODTRui DK73cK+D83gFyZVNlqaQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: 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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BexKVXcxuZt34azQ5Muv1vJV6tgwpIcW3JsMthwMxfs=; b=BRT/sKLpYXau/Ji4ZqRLBh2wLe Ez82oN0tPhCaeccxvStT4dM/VXWT0UOTgVT7srxju4FTp1lIxHZgITVU09FPE0hwYIbUj79K3InFF c3u/lCG1AZZtsXeU+SEcK9u0pYYem+Sajrhv7s+jR5UPYROYW2E4rHsCktC7o7MuiSwumDe0KTw8O uv2vnGx/4l5xRolhC4zk2RH1ShfOhYp0567tBrYlkHX5Tuh9PS21K9iN1pNYOoy8D+KSBJrTAnUOx BdTF6VrcFln7xzJle98w0XT7WzPU38wHtKJVV73Cz5eypbAomXnD5JiFGfsNH5tWiuiFJ1HH5bqlk bHcrf8AQ==; In-Reply-To: <20220427224924.592546-1-gpiccoli@igalia.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+glud-user-mode-linux-devel=m.gmane-mx.org@lists.infradead.org To: akpm@linux-foundation.org, bhe@redhat.com, pmladek@suse.com, kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, coresight@lists.linaro.org, linuxppc-dev@lists.ozlabs.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-leds@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-pm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, netdev@vger.kernel.org, openipmi-developer@lists.sourceforge.net, rcu@vger.kernel.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org, kernel-dev@igalia.com, gpiccoli@igalia.com, kernel@gpiccoli.net, halves@canonical.com, fabiomirmar@gmail.com, alejandro.j.jimenez@oracle.com, andriy.shevchenko@linux.intel.com, arnd@arndb.de, bp@alien8. 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. This patch cleans the code, and set the notifier to run as the latest, following the same approach other architectures are doing. Also, we remove the unnecessary include of a header already included indirectly. Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Richard Henderson Signed-off-by: Guilherme G. Piccoli --- 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 b4fbbba30aa2..d88bdf852753 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 -static int alpha_panic_event(struct notifier_block *, unsigned long, void *); -static struct notifier_block alpha_panic_block = { - alpha_panic_event, - NULL, - INT_MAX /* try to do it first */ -}; - #include #include #include @@ -435,6 +427,21 @@ static const struct sysrq_key_op srm_sysrq_reboot_op = { }; #endif +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 = { + .notifier_call = alpha_panic_event, + .priority = INT_MIN, /* may not return, do it last */ +}; + void __init setup_arch(char **cmdline_p) { @@ -1427,19 +1434,6 @@ const struct seq_operations cpuinfo_op = { .show = show_cpuinfo, }; - -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; -- 2.36.0