Skip to contentSkip to conversation

+ printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Oct 30, 2013 Printk

lore
Share & tools
lore
#0 lore raw

Subject: + printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 30 Oct 2013 16:02:44 -0700

The patch titled
Subject: printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages
has been added to the -mm tree. Its filename is
printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Joe Perches <[email protected]>
Subject: printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages

pr_debug_ratelimited should be coded similarly to dev_dbg_ratelimited to reduce the "callbacks suppressed" messages.

Add #include <linux/dynamic_debug.h> to printk.h. Unfortunately, this new #include must be after the prototype/declaration of function printk.

It may be better to split out these _ratelimited declarations into a separate file one day.

Any use of these pr_<foo>_ratelimited functions must also have another specific #include <ratelimited.h>. Most users have this done indirectly via #include <linux/kernel.h>

printk.h may not #include <linux/ratelimit.h> as it causes circular dependencies and compilation failures.

---

 include/linux/printk.h |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/linux/printk.h renamed from include/linux/printk.h~printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages +15 -1
diff -puN include/linux/printk.h~printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages include/linux/printk.h
@@ -233,6 +233,8 @@ extern asmlinkage void dump_stack(void)
 	no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #endif
 
+#include <linux/dynamic_debug.h>
+
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(CONFIG_DYNAMIC_DEBUG)
 /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
@@ -343,7 +345,19 @@ extern asmlinkage void dump_stack(void)
 #endif
 
 /* If you are writing a driver, please use dev_dbg instead */
-#if defined(DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG)
+/* descriptor check is first to prevent flooding with "callbacks suppressed" */
+#define pr_debug_ratelimited(fmt, ...)					\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);			\
+	if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&	\
+	    __ratelimit(&_rs))						\
+		__dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__);	\
+} while (0)
+#elif defined(DEBUG)
 #define pr_debug_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else

_

Patches currently in -mm which might be from [email protected] are

kernel-timerc-convert-kmalloc_nodegfp_zero-to-kzalloc_node.patch ksm-remove-redundant-__gfp_zero-from-kcalloc.patch printk-report-console-names-during-cut-over.patch kernel-printk-printkc-convert-to-pr_foo.patch vsprintf-check-real-user-group-id-for-%pk.patch printk-pr_debug_ratelimited-check-state-first-to-reduce-callbacks-suppressed-messages.patch get_maintainerpl-incomplete-output.patch checkpatch-report-missing-spaces-around-trigraphs-with-strict.patch checkpatch-extend-camelcase-types-and-ignore-existing-camelcase-uses-in-a-patch.patch checkpatch-update-seq_foo-tests.patch checkpatch-find-camelcase-definitions-of-struct-union-enum.patch checkpatch-add-test-for-defines-of-arch_has_foo.patch checkpatch-add-rules-to-check-init-attribute-and-const-defects.patch checkpatch-make-the-memory-barrier-test-noisier.patch checkpatchpl-check-for-the-fsf-mailing-address.patch checkpatch-add-check-for-sscanf-without-return-use.patch checkpatch-add-check-for-sscanf-without-return-use-v2.patch drivers-rtc-rtc-puv3c-use-dev_dbg-instead-of-pr_debug.patch drivers-rtc-rtc-pl030c-use-devm_kzalloc-instead-of-kmalloc.patch kernel-modulec-use-pr_foo.patch
linux-next.patch
seq_file-introduce-seq_setwidth-and-seq_pad.patch seq_file-remove-%n-usage-from-seq_file-users.patch vsprintf-ignore-%n-again.patch