Re: tty_init_dev: 24 callbacks suppressed

From: Markus Trippelsdorf
Date: Thu Oct 04 2012 - 07:51:51 EST


On 2012.10.04 at 13:23 +0200, Markus Trippelsdorf wrote:
> On 2012.10.04 at 11:20 +0200, Borislav Petkov wrote:
> > Hi,
> >
> > I'm seeing this on today's Linus tree:
> >
> > [ 24.048278] tty_init_dev: 24 callbacks suppressed
> > [ 45.630349] tty_init_dev: 3 callbacks suppressed
> >
> > It is either from that WARN_RATELIMIT thing or the printk_ratelimited
> > further below in tty_init_dev but I don't know for sure because the
> > actual text message from both printk's doesn't come out in dmesg - only
> > that something got suppressed.
> >
> > And it quiets down later, after the machine has finished booting. Still,
> > this doesn't tell me anything about any issue. So what's up?
>
> I'm seeing the same thing.
> This can be fixed by a slightly modified version of:
> https://patchwork.kernel.org/patch/1339221/

My first patch was wrong. This one should be correct:

diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index e11ccb4..d8de255 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -46,20 +46,17 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#define WARN_ON_RATELIMIT(condition, state) \
WARN_ON((condition) && __ratelimit(state))

-#define __WARN_RATELIMIT(condition, state, format...) \
-({ \
- int rtn = 0; \
- if (unlikely(__ratelimit(state))) \
- rtn = WARN(condition, format); \
- rtn; \
-})
-
-#define WARN_RATELIMIT(condition, format...) \
+#define WARN_RATELIMIT(condition, fmt, ...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
- __WARN_RATELIMIT(condition, &_rs, format); \
+ int rtn = !!(condition); \
+ \
+ if (unlikely(rtn && __ratelimit(&_rs))) \
+ WARN(rtn, fmt, ##__VA_ARGS__); \
+ \
+ rtn; \
})

#else
@@ -67,15 +64,9 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#define WARN_ON_RATELIMIT(condition, state) \
WARN_ON(condition)

-#define __WARN_RATELIMIT(condition, state, format...) \
-({ \
- int rtn = WARN(condition, format); \
- rtn; \
-})
-
-#define WARN_RATELIMIT(condition, format...) \
+#define WARN_RATELIMIT(condition, fmt, ...) \
({ \
- int rtn = WARN(condition, format); \
+ int rtn = WARN(condition, fmt, ##__VA_ARGS__); \
rtn; \
})

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