lkml.org 
[lkml]   [2020]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 2/3] printk: add console_verbose_{start,end}
Date
On 2020-03-15, Eugeniu Rosca <roscaeugeniu@gmail.com> wrote:
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 1e6108b8d15f..14755ef7b017 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -3,6 +3,7 @@
> #define __KERNEL_PRINTK__
>
> #include <stdarg.h>
> +#include <linux/atomic.h>
> #include <linux/init.h>
> #include <linux/kern_levels.h>
> #include <linux/linkage.h>
> @@ -77,6 +78,15 @@ static inline void console_verbose(void)
> console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
> }
>
> +#ifdef CONFIG_PRINTK
> +extern atomic_t ignore_loglevel;
> +static inline void console_verbose_start(void) { atomic_inc(&ignore_loglevel); }
> +static inline void console_verbose_end(void) { atomic_dec(&ignore_loglevel); }

To be compatible with console_verbose() semantics, this should also
respect console_loglevel=0. Perhaps by updating
suppress_message_printing() to be something like:

static bool suppress_message_printing(int level)
{
return (!console_loglevel ||
(level >= console_loglevel && !ignore_loglevel));
}

John Ogness

\
 
 \ /
  Last update: 2020-03-18 17:01    [W:0.130 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site