Received: by 2002:ab3:689a:0:b0:1da:d01c:d2b2 with SMTP id t26csp822ltj; Fri, 19 Aug 2022 15:42:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR4GJWwmWgwrm0/XsFYqUwBjQsc4lUJWmVTyaTdZ5c1mBSDyNyjp4NG45JIdYa9sFhPKOahu X-Received: by 2002:a17:906:58c9:b0:730:bc01:fd5f with SMTP id e9-20020a17090658c900b00730bc01fd5fmr5950109ejs.504.1660948925191; Fri, 19 Aug 2022 15:42:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660948925; cv=none; d=google.com; s=arc-20160816; b=mIu7aM+HxMpo73mZHVegkGPODxMcIy5v3WMCtKXl0vri9/Yfib5agsR9IhCw4aBbDZ Lw7r6ExY3kZSkBOrT2uB+2X6brzf7eha8ALNkalTBcgaEJ9RXchqnokr+xe3NSrAsCxN PiAWcOBTJEtzpGpzPVx23FE/j4mnQIeJnAq4/AdlKpWZ44Qz/32TvoJm79DMWzel9Nud 8M5I7trmBjJkSvRPi5niMisADdbgUOwX/XxVLhZ4P5i6+NS9XQFulYnPnxZwBGrphotM eJTUvdgGPhD9o6sSEwD8a4YdAayqCE+1pjV4i+96qqGKNNqnQv/VDfjFobedXmjr7F1/ GmzA== 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 :dkim-signature; bh=I7PX0cg9hYhaVm6PvmjCfqAqk9/uhuAJh0bXjru0KJ8=; b=f64m9ZJGJ5gl99soR8uydAcOZZO0c6H9TD0FaQU65GVIXClQ2b9pS6kHzpkG5AnrlO qZebPdShbsfwR3ktpfAsj/pYrya/sA5fABNt3AbqmqACy0lfkyfhziAprcPg6C6nQs8J MzG8MsRZuMPWNmeAFs6Cw7SozdSaotea7Q42RQHRC3g9zoTmxk+lWC5f7JbnyK0YBGWs NMZFBP83VCq9H1lfbMCxrmTJm1m9xg6IHOSH9UlgBJtu9/YFrG+VVvkNucf2jj8YDrgn xXwcHjEZJKyMMsqEc/O+lq0AIvVtpGzk1i/mJl6NTkYbrpDqSkVMhUR6OtqtMdBi1kBP FYKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=apxqB5qm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tj2-20020a170907c24200b00738399b2bc9si3329097ejc.166.2022.08.19.15.41.39; Fri, 19 Aug 2022 15:42:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=apxqB5qm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241413AbiHSWVn (ORCPT + 99 others); Fri, 19 Aug 2022 18:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241296AbiHSWVl (ORCPT ); Fri, 19 Aug 2022 18:21:41 -0400 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D519D9D7B; Fri, 19 Aug 2022 15:21:40 -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: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=I7PX0cg9hYhaVm6PvmjCfqAqk9/uhuAJh0bXjru0KJ8=; b=apxqB5qmqlzzY5vxuVHk/oybLg LGISEVYytiLSHzQM1NRBWL9ge/1BR3a5d4xyO3rwazWkQf6rO2OS/n67HAwdwBeLdPfOO/5+ptmdA nchEn0YnVSqzWI5LYJNJK99CREIoOfURPC5OxlOLbxBjzRqQBhWocnTVkl+50cp4hx2RdCPpm05KJ kQ0gUbNDHLN2x4iyxKfxMIsc6UVssvkUQWUb7CBWr3lNyq23EXMGdsgyAbCl6t5yNi3gsN1Pa8ZaO 6yXzHFVJTNoduFjBMFPFWJoF5WZJ0C44LC+4711S5JBo2OioK7T+35306PeO7vksSE6XS9+9PuVVj ZSO7++KA==; Received: from [179.232.144.59] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1oPAMu-00Cb1Q-Tz; Sat, 20 Aug 2022 00:21:33 +0200 From: "Guilherme G. Piccoli" To: akpm@linux-foundation.org, bhe@redhat.com, pmladek@suse.com, kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, kernel-dev@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.de, corbet@lwn.net, d.hatayama@jp.fujitsu.com, dave.hansen@linux.intel.com, dyoung@redhat.com, feng.tang@intel.com, gregkh@linuxfoundation.org, mikelley@microsoft.com, hidehiro.kawai.ez@hitachi.com, jgross@suse.com, john.ogness@linutronix.de, keescook@chromium.org, luto@kernel.org, mhiramat@kernel.org, mingo@redhat.com, paulmck@kernel.org, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, stern@rowland.harvard.edu, tglx@linutronix.de, vgoyal@redhat.com, vkuznets@redhat.com, will@kernel.org, xuqiang36@huawei.com, "Guilherme G. Piccoli" , linux-um@lists.infradead.org, Anton Ivanov , Johannes Berg , Richard Weinberger Subject: [PATCH V3 04/11] um: Improve panic notifiers consistency and ordering Date: Fri, 19 Aug 2022 19:17:24 -0300 Message-Id: <20220819221731.480795-5-gpiccoli@igalia.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819221731.480795-1-gpiccoli@igalia.com> References: <20220819221731.480795-1-gpiccoli@igalia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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: X-Mailing-List: linux-kernel@vger.kernel.org Currently the panic notifiers from user mode linux don't follow the convention for most of the other notifiers present in the kernel (indentation, priority setting, numeric return). More important, the priorities could be improved, since it's a special case (userspace), hence we could run the notifiers earlier; user mode linux shouldn't care much with other panic notifiers but the ordering among the mconsole and arch notifier is important, given that the arch one effectively triggers a core dump. Fix that by running the mconsole notifier as the first panic notifier, followed by the architecture one (that coredumps). Cc: Anton Ivanov Cc: Johannes Berg Cc: Richard Weinberger Signed-off-by: Guilherme G. Piccoli V3: - No changes. V2: - Kept the notifier header to avoid implicit usage - thanks Johannes for the suggestion! --- arch/um/drivers/mconsole_kern.c | 7 +++---- arch/um/kernel/um_arch.c | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 8ca67a692683..69af3ce8407a 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -846,13 +846,12 @@ static int notify_panic(struct notifier_block *self, unsigned long unused1, mconsole_notify(notify_socket, MCONSOLE_PANIC, message, strlen(message) + 1); - return 0; + return NOTIFY_DONE; } static struct notifier_block panic_exit_notifier = { - .notifier_call = notify_panic, - .next = NULL, - .priority = 1 + .notifier_call = notify_panic, + .priority = INT_MAX, /* run as soon as possible */ }; static int add_notifier(void) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index e0de60e503b9..ae272878f692 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -247,13 +247,13 @@ static int panic_exit(struct notifier_block *self, unsigned long unused1, bust_spinlocks(0); uml_exitcode = 1; os_dump_core(); - return 0; + + return NOTIFY_DONE; } static struct notifier_block panic_exit_notifier = { - .notifier_call = panic_exit, - .next = NULL, - .priority = 0 + .notifier_call = panic_exit, + .priority = INT_MAX - 1, /* run as 2nd notifier, won't return */ }; void uml_finishsetup(void) -- 2.37.2