lkml.org 
[lkml]   [2017]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Support resetting WARN*_ONCE
On Tue, 17 Oct 2017 14:40:17 -0700 Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
>
> I like _ONCE warnings because it's guaranteed that they don't
> flood the log.
>
> During testing I find it useful to reset the state of the once warnings,
> so that I can rerun tests and see if they trigger again, or can
> guarantee that a test run always hits the same warnings.
>
> This patch adds a debugfs interface to reset all the _ONCE
> warnings so that they appear again:
>
> echo 1 > /sys/kernel/debug/clear_warn_once
>
> This is implemented by putting all the warning booleans into
> a special section, and clearing it.

Seems useful. Can we document the new interface please?

I'm not sure where :( If it was in /proc/sys/kernel then we'd have a
Documentation file. But debugfs?

> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -27,6 +27,7 @@
> #include <linux/console.h>
> #include <linux/bug.h>
> #include <linux/ratelimit.h>
> +#include <linux/debugfs.h>
>
> #define PANIC_TIMER_STEP 100
> #define PANIC_BLINK_SPD 18
> @@ -587,6 +588,32 @@ void warn_slowpath_null(const char *file, int line)
> EXPORT_SYMBOL(warn_slowpath_null);
> #endif
>
> +#ifdef CONFIG_BUG
> +
> +/* Support resetting WARN*_ONCE state */
> +
> +static int clear_warn_once_set(void *data, u64 val)
> +{
> + memset(__start_once, 0, __end_once - __start_once);

Suggest we include asm/sections.h explicitly, rather than by luck.

> + return 0;
> +}

\
 
 \ /
  Last update: 2017-10-17 23:55    [W:0.041 / U:4.572 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site