[PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

Subsystems: networking [general], rxrpc sockets (af_rxrpc), the rest

STALE3182d

8 messages, 3 authors, 2017-11-30 · open the first message on its own page

[PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: Joe Perches <joe@perches.com>
Date: 2017-11-30 16:21:21

When enabled, the current debug logging does not have a KERN_<LEVEL>.
Add KERN_DEBUG to the logging macros.

Miscellanea:

o Remove #define redundancy and neaten the macros a bit

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/rxrpc/ar-internal.h | 75 ++++++++++++++++++-------------------------------
 1 file changed, 28 insertions(+), 47 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 416688381eb7..d4b53b2339b3 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -1147,66 +1147,47 @@ static inline bool after_eq(u32 seq1, u32 seq2)
  */
 extern unsigned int rxrpc_debug;
 
-#define dbgprintk(FMT,...) \
-	printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
+#if defined(__KDEBUG) || defined(CONFIG_AF_RXRPC_DEBUG)
+#define dbgprintk(fmt, ...)						\
+	printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
+#else
+#define dbgprintk(fmt, ...)						\
+	no_printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
+#endif
 
-#define kenter(FMT,...)	dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
-#define kleave(FMT,...)	dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
-#define kdebug(FMT,...)	dbgprintk("    "FMT ,##__VA_ARGS__)
-#define kproto(FMT,...)	dbgprintk("### "FMT ,##__VA_ARGS__)
-#define knet(FMT,...)	dbgprintk("@@@ "FMT ,##__VA_ARGS__)
+#define kenter(fmt, ...)	dbgprintk("==> %s(" fmt ")", __func__, ##__VA_ARGS__)
+#define kleave(fmt, ...)	dbgprintk("<== %s()" fmt "", __func__, ##__VA_ARGS__)
+#define kdebug(fmt, ...)	dbgprintk("    " fmt, ##__VA_ARGS__)
+#define kproto(fmt, ...)	dbgprintk("### " fmt, ##__VA_ARGS__)
+#define knet(fmt, ...)		dbgprintk("@@@ " fmt, ##__VA_ARGS__)
 
+#if defined(__KDEBUG) || !defined(CONFIG_AF_RXRPC_DEBUG)
+#define _enter(fmt, ...)	kenter(fmt, ##__VA_ARGS__)
+#define _leave(fmt, ...)	kleave(fmt, ##__VA_ARGS__)
+#define _debug(fmt, ...)	kdebug(fmt, ##__VA_ARGS__)
+#define _proto(fmt, ...)	kproto(fmt, ##__VA_ARGS__)
+#define _net(fmt, ...)		knet(fmt, ##__VA_ARGS__)
 
-#if defined(__KDEBUG)
-#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
-#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
-#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
-#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
-#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
+#else
 
-#elif defined(CONFIG_AF_RXRPC_DEBUG)
 #define RXRPC_DEBUG_KENTER	0x01
 #define RXRPC_DEBUG_KLEAVE	0x02
 #define RXRPC_DEBUG_KDEBUG	0x04
 #define RXRPC_DEBUG_KPROTO	0x08
 #define RXRPC_DEBUG_KNET	0x10
 
-#define _enter(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KENTER))	\
-		kenter(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _leave(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KLEAVE))	\
-		kleave(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _debug(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KDEBUG))	\
-		kdebug(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _proto(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KPROTO))	\
-		kproto(FMT,##__VA_ARGS__);		\
+#define RXRPC_DEBUG(TYPE, type, fmt, ...)				\
+do {									\
+	if (unlikely(rxrpc_debug & RXRPC_DEBUG_##TYPE))			\
+		type(fmt, ##__VA_ARGS__);				\
 } while (0)
 
-#define _net(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KNET))	\
-		knet(FMT,##__VA_ARGS__);		\
-} while (0)
+#define _enter(fmt, ...)	RXRPC_DEBUG(KENTER, kenter, fmt, ##__VA_ARGS__)
+#define _leave(fmt, ...)	RXRPC_DEBUG(KLEAVE, kleave, fmt, ##__VA_ARGS__)
+#define _debug(fmt, ...)	RXRPC_DEBUG(KDEBUG, kdebug, fmt, ##__VA_ARGS__)
+#define _proto(fmt, ...)	RXRPC_DEBUG(KPROTO, kproto, fmt, ##__VA_ARGS__)
+#define _net(fmt, ...)		RXRPC_DEBUG(KNET, knet, fmt, ##__VA_ARGS__)
 
-#else
-#define _enter(FMT,...)	no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
-#define _leave(FMT,...)	no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
-#define _debug(FMT,...)	no_printk("    "FMT ,##__VA_ARGS__)
-#define _proto(FMT,...)	no_printk("### "FMT ,##__VA_ARGS__)
-#define _net(FMT,...)	no_printk("@@@ "FMT ,##__VA_ARGS__)
 #endif
 
 /*
-- 
2.15.0

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: David Miller <davem@davemloft.net>
Date: 2017-11-30 17:31:20

From: Joe Perches <joe@perches.com>
Date: Thu, 30 Nov 2017 08:21:14 -0800
When enabled, the current debug logging does not have a KERN_<LEVEL>.
Add KERN_DEBUG to the logging macros.

Miscellanea:

o Remove #define redundancy and neaten the macros a bit

Signed-off-by: Joe Perches <joe@perches.com>
Please also CC: the proper mailing list and maintainer for rxrpc.

The MAINTAINERS entry for rxrpc needs to include more than just
net/rxrpc/af_rxrpc.c, David please fix this up as I know Joe is going
to use the excuse that he didn't CC: you and the AFS list because of
this.

Thanks.

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: Joe Perches <joe@perches.com>
Date: 2017-11-30 18:06:58

On Thu, 2017-11-30 at 12:31 -0500, David Miller wrote:
From: Joe Perches <joe@perches.com>
Date: Thu, 30 Nov 2017 08:21:14 -0800
quoted
When enabled, the current debug logging does not have a KERN_<LEVEL>.
Add KERN_DEBUG to the logging macros.

Miscellanea:

o Remove #define redundancy and neaten the macros a bit

Signed-off-by: Joe Perches <joe@perches.com>
Please also CC: the proper mailing list and maintainer for rxrpc.

The MAINTAINERS entry for rxrpc needs to include more than just
net/rxrpc/af_rxrpc.c, David please fix this up as I know Joe is going
to use the excuse that he didn't CC: you and the AFS list because of
this.
There is no listed rxrpc maintainer.

David Howells entry is:

AFS FILESYSTEM & AF_RXRPC SOCKET DOMAIN
M:	David Howells [off-list ref]
L:	linux-afs@lists.infradead.org
S:	Supported
F:	fs/afs/
F:	include/net/af_rxrpc.h
F:	net/rxrpc/af_rxrpc.c
W:	https://www.infradead.org/~dhowells/kafs/

which seems pretty specific to AFS and its rxrpc kernel interface.

Excuse is probably the wrong word here David.
Rationale maybe...

cheers, Joe

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: David Miller <davem@davemloft.net>
Date: 2017-11-30 18:13:25

From: Joe Perches <joe@perches.com>
Date: Thu, 30 Nov 2017 10:06:51 -0800
Excuse is probably the wrong word here David.
Rationale maybe...
I guess you turn a blind eye to the hundreds of the rxrpc patches
David has posted here over the past few months....

That's all I'm saying.  If you see reality is disconnected from
what is in the MAINTAINERS file, please don't just ignore it.

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: Joe Perches <joe@perches.com>
Date: 2017-11-30 18:18:31

On Thu, 2017-11-30 at 13:13 -0500, David Miller wrote:
From: Joe Perches <joe@perches.com>
Date: Thu, 30 Nov 2017 10:06:51 -0800
quoted
Excuse is probably the wrong word here David.
Rationale maybe...
I guess you turn a blind eye to the hundreds of the rxrpc patches
David has posted here over the past few months....
Again with the slights.  You should stop it.
_Nobody_ reads everything on lkml.
That's all I'm saying.  If you see reality is disconnected from
what is in the MAINTAINERS file, please don't just ignore it.
What I notice I generally don't ignore.

cheers, Joe

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: David Miller <davem@davemloft.net>
Date: 2017-11-30 18:22:00

From: Joe Perches <joe@perches.com>
Date: Thu, 30 Nov 2017 10:18:24 -0800
_Nobody_ reads everything on lkml.
True, in fact I don't read lkml at all.  That wasn't the point I was
trying to make.

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: David Howells <dhowells@redhat.com>
Date: 2017-11-30 19:34:54

Joe Perches [off-list ref] wrote:
There is no listed rxrpc maintainer.
There's a script in the kernel called get_maintainer.pl which you might find
of use:

	warthog>./scripts/get_maintainer.pl net/rxrpc/
	"David S. Miller" [off-list ref] (maintainer:NETWORKING [GENERAL],commit_signer:23/74=31%)
	David Howells [off-list ref] (commit_signer:64/74=86%,authored:60/74=81%)
	netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
	linux-kernel@vger.kernel.org (open list)

It would seem a good idea to cc me, as the one with the largest "authored"
also.

David

Re: [PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level

From: Joe Perches <joe@perches.com>
Date: 2017-11-30 19:46:11

On Thu, 2017-11-30 at 19:34 +0000, David Howells wrote:
Joe Perches [off-list ref] wrote:
quoted
There is no listed rxrpc maintainer.
There's a script in the kernel called get_maintainer.pl which you might find
of use:
Yeah, I've heard of it.  I also wrote it btw.
	warthog>./scripts/get_maintainer.pl net/rxrpc/
	"David S. Miller" [off-list ref] (maintainer:NETWORKING [GENERAL],commit_signer:23/74=31%)
	David Howells [off-list ref] (commit_signer:64/74=86%,authored:60/74=81%)
	netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
	linux-kernel@vger.kernel.org (open list)
The script I use to send patches does not cc
patch authors as, based on my history
sending patches, most to many of them do not
want to see patches.
It would seem a good idea to cc me, as the one with the largest "authored"
also.
Perhaps a better idea would be to have an
rxrpc section in the MAINTAINERS file.

cheers, Joe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help