Commit ec7d8e68 authored by Jeff Layton's avatar Jeff Layton Committed by Anna Schumaker
Browse files

sunrpc: add a Kconfig option to redirect dfprintk() output to trace buffer



We have a lot of old dprintk() call sites that aren't going anywhere
anytime soon. At the same time, turning them up is a serious burden on
the host due to the console locking overhead.

Add a new Kconfig option that redirects dfprintk() output to the trace
buffer. This is more efficient than logging to the console and allows
for proper interleaving of dprintk and static tracepoint events.

Since using trace_printk() causes scary warnings to pop at boot time,
this new option defaults to "n".

Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarAnna Schumaker <anna.schumaker@oracle.com>
parent 9082aae1
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -30,17 +30,23 @@ extern unsigned int nlm_debug;
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
# define ifdebug(fac)		if (unlikely(rpc_debug & RPCDBG_##fac))

# if IS_ENABLED(CONFIG_SUNRPC_DEBUG_TRACE)
#  define __sunrpc_printk(fmt, ...)	trace_printk(fmt, ##__VA_ARGS__)
# else
#  define __sunrpc_printk(fmt, ...)	printk(KERN_DEFAULT fmt, ##__VA_ARGS__)
# endif

# define dfprintk(fac, fmt, ...)					\
do {									\
	ifdebug(fac)							\
		printk(KERN_DEFAULT fmt, ##__VA_ARGS__);				\
		__sunrpc_printk(fmt, ##__VA_ARGS__);			\
} while (0)

# define dfprintk_rcu(fac, fmt, ...)					\
do {									\
	ifdebug(fac) {							\
		rcu_read_lock();					\
		printk(KERN_DEFAULT fmt, ##__VA_ARGS__);				\
		__sunrpc_printk(fmt, ##__VA_ARGS__);			\
		rcu_read_unlock();					\
	}								\
} while (0)
+14 −0
Original line number Diff line number Diff line
@@ -101,6 +101,20 @@ config SUNRPC_DEBUG

	  If unsure, say Y.

config SUNRPC_DEBUG_TRACE
	bool "RPC: Send dfprintk() output to the trace buffer"
	depends on SUNRPC_DEBUG && TRACING
	default n
	help
          dprintk() output can be voluminous, which can overwhelm the
          kernel's logging facility as it must be sent to the console.
          This option causes dprintk() output to go to the trace buffer
          instead of the kernel log.

          This will cause warnings about trace_printk() being used to be
          logged at boot time, so say N unless you are debugging a problem
          with sunrpc-based clients or services.

config SUNRPC_XPRT_RDMA
	tristate "RPC-over-RDMA transport"
	depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS