Re: [PATCH] Support resetting WARN*_ONCE
From: Michael Ellerman
Date: Fri Nov 03 2017 - 05:40:02 EST
Andi Kleen <andi@xxxxxxxxxxxxxx> writes:
> diff --git a/kernel/panic.c b/kernel/panic.c
> index bdd18afa19a4..b2d872fa16de 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -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);
> + return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(clear_warn_once_fops,
> + NULL,
> + clear_warn_once_set,
> + "%lld\n");
> +
> +static __init int register_warn_debugfs(void)
> +{
> + /* Don't care about failure */
> + debugfs_create_file("clear_warn_once", 0644, NULL,
^
Wouldn't 0200 be more appropriate if it's only writable?
Otherwise it appears readable, but cat'ing it gives you an error.
cheers