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


Groups > linux.kernel > #1540404

Re: [RFC][PATCHv5 5/7] printk: report lost messages in printk safe/nmi contexts

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCHv5 5/7] printk: report lost messages in printk safe/nmi contexts
Date 2016-12-12 17:00 +0100
Message-ID <sNBbc-6b6-13@gated-at.bofh.it> (permalink)
References <sJA41-4xo-5@gated-at.bofh.it> <sJA42-4xo-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 2016-12-01 22:55:44, Sergey Senozhatsky wrote:
> Account lost messages in pritk-safe and printk-safe-nmi
> contexts and report those numbers during printk_safe_flush().
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
> --- a/kernel/printk/printk_safe.c
> +++ b/kernel/printk/printk_safe.c
> @@ -211,6 +242,9 @@ static void __printk_safe_flush(struct irq_work *work)
>  	if (atomic_cmpxchg(&s->len, len, 0) != len)
>  		goto more;
>  
> +	report_nmi_message_lost();
> +	report_safe_message_lost();

The great thing about this solution is that we print this message
in the right order (after the messages that fit into the buffer).

But not really because we report lost messages from both buffers
and from all CPUs here.

The perfect solution would be to remember the number of lost messages
in struct printk_safe_seq_buf. Then we might bump the value directly
in printk_safe_log_store() instead of returning the ugly -ENOSPC.
Also we could use an universal message (no "NMI" or "printk-safe")
because it could be printed right after flushing the messages
that fit the buffer.

This solution is good enough and still better than the previous one, so

Reviewed-by: Petr Mladek <pmladek@suse.com>


But if you would want to change it to the "perfect" one, it would be
appreciated ;-) It will be even more straightforward and less code.
In this, case I would do the change in an earlier patch to make
it more straightforward. But we could also do this later
(in another patchset).

Best Regards,
Petr

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


Thread

[RFC][PATCHv5 0/7] printk: use printk_safe to handle printk() recursive calls Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-01 15:00 +0100
  [RFC][PATCHv5 4/7] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-01 15:00 +0100
    Re: [RFC][PATCHv5 4/7] printk: always use deferred printk when flush  printk_safe lines Petr Mladek <pmladek@suse.com> - 2016-12-12 16:30 +0100
  [RFC][PATCHv5 5/7] printk: report lost messages in printk safe/nmi contexts Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-01 15:00 +0100
    Re: [RFC][PATCHv5 5/7] printk: report lost messages in printk  safe/nmi contexts Petr Mladek <pmladek@suse.com> - 2016-12-12 17:00 +0100
      Re: [RFC][PATCHv5 5/7] printk: report lost messages in printk  safe/nmi contexts Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-12-13 03:00 +0100
        Re: [RFC][PATCHv5 5/7] printk: report lost messages in printk  safe/nmi contexts Petr Mladek <pmladek@suse.com> - 2016-12-14 12:00 +0100
  [RFC][PATCHv5 2/7] printk: rename nmi.c and exported api Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-01 15:00 +0100

csiph-web