From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752547AbdHOMFY (ORCPT ); Tue, 15 Aug 2017 08:05:24 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:60917 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499AbdHOMFV (ORCPT ); Tue, 15 Aug 2017 08:05:21 -0400 From: "Rafael J. Wysocki" To: Sergey Senozhatsky Cc: Petr Mladek , Steven Rostedt , Jan Kara , Andrew Morton , Peter Zijlstra , Eric Biederman , Greg Kroah-Hartman , Jiri Slaby , Pavel Machek , Andreas Mohr , Tetsuo Handa , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC][PATCHv5 07/13] printk: register syscore notifier Date: Tue, 15 Aug 2017 13:56:56 +0200 Message-ID: <1616919.1QsxM0VBqp@aspire.rjw.lan> In-Reply-To: <20170815025625.1977-8-sergey.senozhatsky@gmail.com> References: <20170815025625.1977-1-sergey.senozhatsky@gmail.com> <20170815025625.1977-8-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, August 15, 2017 4:56:19 AM CEST Sergey Senozhatsky wrote: > We need to switch to emergency printk mode in kernel_kexec(). One > kernel_kexec() branch calls kernel_restart_prepare(), which updates > `system_state', however, the other one, when user requested to > ->preserve_context, does not and we are lacking the information > in printk about kexec being executed. Register a syscore notifier > so printk will be notified by syscore_suspend(). > > Signed-off-by: Sergey Senozhatsky > --- > kernel/printk/printk.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index d3f149fad85c..b14e35f94596 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -50,6 +50,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -2941,6 +2942,22 @@ static struct notifier_block printk_pm_nb = { > .notifier_call = printk_pm_notify, > }; > > +static int printk_syscore_suspend(void) > +{ > + printk_emergency_begin(); > + return 0; > +} Somebody looking at suspend/resume code paths only will be wondering why you need this, because we should be in the emergency mode already when it is called. It would be good to add a comment about the kexec context here. > + > +static void printk_syscore_resume(void) > +{ > + printk_emergency_end(); > +} This will turn the emergency mode off during resume before the notifier added by the previous patch AFAICS. Is this intentional? Thanks, Rafael