lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a8e1da0803111737k32efe341pc752d1a679fee46b@mail.gmail.com>
Date:	Wed, 12 Mar 2008 08:37:27 +0800
From:	"Dave Young" <hidave.darkstar@...il.com>
To:	"Marcin Slusarz" <marcin.slusarz@...il.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH] [2/3] add WARN_ON_SECS macro

On Wed, Mar 12, 2008 at 3:20 AM, Marcin Slusarz
<marcin.slusarz@...il.com> wrote:
>
> On Mon, Mar 10, 2008 at 02:34:37PM +0800, Dave Young wrote:
>  > Add WARN_ON_SECS macro for some serious case which need repeat the
>  > warnings, but with some ratelimit.
>  >
>  > Signed-off-by: Dave Young <hidave.darkstar@...il.com>
>  >
>  > ---
>  > include/asm-generic/bug.h |    8 ++++++++
>  > 1 file changed, 8 insertions(+)
>  >
>  > diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
>  > --- linux/include/asm-generic/bug.h   2008-03-10 13:27:03.000000000 +0800
>  > +++ linux.new/include/asm-generic/bug.h       2008-03-10 13:27:14.000000000 +0800
>  > @@ -3,6 +3,7 @@
>  >
>  >  #include <linux/compiler.h>
>  >
>  > +
>  >  #ifdef CONFIG_BUG
>  >
>  >  #ifdef CONFIG_GENERIC_BUG
>  > @@ -75,6 +76,13 @@ extern void warn_on_slowpath(const char
>  >       unlikely(__ret_warn_once);                              \
>  >  })
>  >
>  > +#define WARN_ON_SECS(condition, secs) ({                     \
>  > +     int __ret_warn_on = !!(condition);                      \
>  > +     if (unlikely(__ret_warn_on))                            \
>  > +             if (__ratelimit(secs * HZ, 1))                  \
>  > +                     WARN_ON(condition);                     \
>  > +})
>  > +
>  >  #ifdef CONFIG_SMP
>  >  # define WARN_ON_SMP(x)                      WARN_ON(x)
>  >  #else
>
>  Do you really want to check the condition twice?

Thanks, WARN_ON(1) will be better.

>
>  Marcin
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ