Skip to contentSkip to conversation

Patch "net: Implement net_dbg_ratelimited() for CONFIG_DYNAMIC_DEBUG case" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message May 16, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

net: Implement net_dbg_ratelimited() for CONFIG_DYNAMIC_DEBUG case

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
net-implement-net_dbg_ratelimited-for-config_dynamic_debug-case.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon May 16 11:21:32 PDT 2016

From: Tim Bingham <[email protected]>
Date: Fri, 29 Apr 2016 13:30:23 -0400
Subject: net: Implement net_dbg_ratelimited() for CONFIG_DYNAMIC_DEBUG case

From: Tim Bingham <[email protected]>

[ Upstream commit 2c94b53738549d81dc7464a32117d1f5112c64d3 ]

Prior to commit d92cff89a0c8 ("net_dbg_ratelimited: turn into no-op when !DEBUG") the implementation of net_dbg_ratelimited() was buggy for both the DEBUG and CONFIG_DYNAMIC_DEBUG cases.

The bug was that net_ratelimit() was being called and, despite returning true, nothing was being printed to the console. This resulted in messages like the following -

"net_ratelimit: %d callbacks suppressed"

with no other output nearby.

After commit d92cff89a0c8 ("net_dbg_ratelimited: turn into no-op when !DEBUG") the bug is fixed for the DEBUG case. However, there's no output at all for CONFIG_DYNAMIC_DEBUG case.

This patch restores debug output (if enabled) for the CONFIG_DYNAMIC_DEBUG case.

Add a definition of net_dbg_ratelimited() for the CONFIG_DYNAMIC_DEBUG case. The implementation takes care to check that dynamic debugging is enabled before calling net_ratelimit().

Fixes d92cff89a0c8 ("net_dbg_ratelimited: turn into no-op when !DEBUG")
---
 include/linux/net.h |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
include/linux/net.h +9 -1
@@ -245,7 +245,15 @@ do {								\
 	net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
 #define net_info_ratelimited(fmt, ...)				\
 	net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
-#if defined(DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG)
+#define net_dbg_ratelimited(fmt, ...)					\
+do {									\
+	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);			\
+	if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&	\
+	    net_ratelimit())						\
+		__dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__);	\
+} while (0)
+#elif defined(DEBUG)
 #define net_dbg_ratelimited(fmt, ...)				\
 	net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
 #else

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

queue-4.4/net-implement-net_dbg_ratelimited-for-config_dynamic_debug-case.patch