Subject: Re: [PATCH 1/2] CPUFREQ: powernow-k8: Forgot to use printk instead of WARN_ONCE in last patch

From: Ingo Molnar <[email-masked]>
Date: Thu, 5 Feb 2009 13:42:34 +0100

* Thomas Renninger <[email-masked]> wrote:

> Looking at WARN() again:
> #ifndef __WARN
> #ifndef __ASSEMBLY__
> extern void warn_slowpath(const char *file, const int line,
>                 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
> #define WANT_WARN_ON_SLOWPATH
> #endif
> #define __WARN()                warn_slowpath(__FILE__, __LINE__, NULL)
> #define __WARN_printf(arg...)   warn_slowpath(__FILE__, __LINE__, arg)
> #else
> #define __WARN_printf(arg...)   do { printk(arg); __WARN(); } while (0)
> #endif
> 
> WARN_ONCE does throw a backtrace (warn_slowpath does) or I missed
> something...
> Thus WARN_ONCE makes a big difference to printk_once() (which does not
> exist? but would be neat...) and prints out the backtrace, right?

yes, correct. We use WARN()/WARN_ONCE() in places where an error is 
surprising and where we want to print a backtrace too.

In this case you are right to point out that it's not a kernel bug but a 
BIOS environment bug, and that the text itself uniquely identifies the place 
it comes from. So using a printk is perfectly fine.

There's a few cleanups necessary with the printk solution too though, see my 
previous mail for the details.

printk_once() would be nice indeed - it's a frequent construct.

	Ingo