On Mon, 22 Feb 2016 21:54:17 -0600
Josh Poimboeuf <[email protected]> wrote:

> The traceoff_on_warning option doesn't have any effect on s390, powerpc,
> arm64, parisc, and sh because there are two different types of WARN
> implementations:
> 
> 1) The above mentioned architectures treat WARN() as a special case of a
>    BUG() exception.  They handle warnings in report_bug() in lib/bug.c.
> 
> 2) All other architectures just call warn_slowpath_*() directly.  Their
>    warnings are handled in warn_slowpath_common() in kernel/panic.c.
> 
> Support traceoff_on_warning on all architectures and prevent any future
> divergence by using a single common function to emit the warning.
> 
> Also remove the '()' from '%pS()', because the parentheses look funky:
> 
>   [   45.607629] WARNING: at /root/warn_mod/warn_mod.c:17 
> .init_dummy+0x20/0x40 [warn_mod]()

Note, the "()" were to denote that it's a function. But as it is a "pS"
and not a "ps" which adds the offset, it does make it look funky.

> 
> Reported-by: Chunyu Hu <[email protected]>
> Signed-off-by: Josh Poimboeuf <[email protected]>
> ---
> Based on linux-next/master.
> 
>  include/asm-generic/bug.h |  7 +++++++
>  kernel/panic.c            | 44 +++++++++++++++++++++++++-------------------
>  lib/bug.c                 | 27 +++------------------------
>  3 files changed, 35 insertions(+), 43 deletions(-)
> 
> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index 630dd23..b67a0f9 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -81,6 +81,13 @@ extern void warn_slowpath_null(const char *file, const int 
> line);
>       do { printk(arg); __WARN_TAINT(taint); } while (0)
>  #endif
>  
> +struct warn_args {
> +     const char *fmt;
> +     va_list args;
> +};

Just a nit. Nothing using warn_args outside of panic.c, thus you don't
need to declare it here. Either add a comment about what these args are
for, or simply do:

/* Used internally by panic */
struct warn_args;


Other than that, the rest looks fine to me.

-- Steve

> +void __warn(const char *file, int line, void *caller, unsigned taint,
> +         struct pt_regs *regs, struct warn_args *args);
> +
>  #ifndef WARN_ON
>  #define WARN_ON(condition) ({                                                
> \
>       int __ret_warn_on = !!(condition);                              \

Reply via email to