Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1712126

Re: [RFC][PATCHv5 07/13] printk: register syscore notifier

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject Re: [RFC][PATCHv5 07/13] printk: register syscore notifier
Date 2017-08-15 14:10 +0200
Message-ID <ueIPw-19O-27@gated-at.bofh.it> (permalink)
References <ueAff-3Y4-3@gated-at.bofh.it> <ueAoW-4hM-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <sergey.senozhatsky@gmail.com>
> ---
>  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 <linux/sched/task_stack.h>
>  #include <linux/kthread.h>
>  #include <linux/suspend.h>
> +#include <linux/syscore_ops.h>
>  
>  #include <linux/uaccess.h>
>  #include <asm/sections.h>
> @@ -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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCHv5 00/13] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:00 +0200
  [RFC][PATCHv5 12/13] printk: do not cond_resched() when we can offload Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 10/13] printk: force printk_kthread to offload printing Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 04/13] printk: add enforce_emergency parameter Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 07/13] printk: register syscore notifier Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
    Re: [RFC][PATCHv5 07/13] printk: register syscore notifier "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-15 14:10 +0200
      Re: [RFC][PATCHv5 07/13] printk: register syscore notifier Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-16 09:00 +0200
        Re: [RFC][PATCHv5 07/13] printk: register syscore notifier "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-16 15:10 +0200
  [RFC][PATCHv5 11/13] printk: always offload printing from user-space processes Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 05/13] printk: enable printk offloading Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 01/13] printk: move printk_pending out of per-cpu Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 02/13] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 08/13] printk: set watchdog_thresh as maximum value for atomic_print_limit Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 03/13] printk: add sync printk_emergency API Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 09/13] printk: add auto-emergency enforcement mechanism Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 13/13] printk: move offloading logic to per-cpu Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
  [RFC][PATCHv5 06/13] printk: register PM notifier Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-15 05:10 +0200
    Re: [RFC][PATCHv5 06/13] printk: register PM notifier "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-15 14:00 +0200
      Re: [RFC][PATCHv5 06/13] printk: register PM notifier Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-16 09:40 +0200
        Re: [RFC][PATCHv5 06/13] printk: register PM notifier "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-16 15:10 +0200
          Re: [RFC][PATCHv5 06/13] printk: register PM notifier Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-17 08:00 +0200
            Re: [RFC][PATCHv5 06/13] printk: register PM notifier "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-17 18:00 +0200
              Re: [RFC][PATCHv5 06/13] printk: register PM notifier Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-18 01:20 +0200
  Re: [RFC][PATCHv5 00/13] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-23 10:40 +0200

csiph-web