[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3bbe56ff1312c5afbdbe3de91c0ddb57d836f30f.camel@kernel.org>
Date: Thu, 21 Aug 2025 15:51:33 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Anna Schumaker <anna.schumaker@...cle.com>, Trond Myklebust
<trondmy@...nel.org>, Anna Schumaker <anna@...nel.org>, Chuck Lever
<chuck.lever@...cle.com>, NeilBrown <neil@...wn.name>, Olga Kornievskaia
<okorniev@...hat.com>, Dai Ngo <Dai.Ngo@...cle.com>, Tom Talpey
<tom@...pey.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 2/2] sunrpc: add a Kconfig option to redirect dfprintk()
output to trace buffer
On Thu, 2025-08-21 at 15:44 -0400, Anna Schumaker wrote:
> Hi Jeff,
>
> On 8/21/25 1:16 PM, Jeff Layton wrote:
> > 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: Jeff Layton <jlayton@...nel.org>
> > ---
> > include/linux/sunrpc/debug.h | 10 ++++++++--
> > net/sunrpc/Kconfig | 14 ++++++++++++++
> > 2 files changed, 22 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
> > index 99a6fa4a1d6af0b275546a53957f07c9a509f2ac..fd9f79fa534ef001b3ec5e6d7e4b1099843b64a4 100644
> > --- a/include/linux/sunrpc/debug.h
> > +++ b/include/linux/sunrpc/debug.h
> > @@ -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, ...) pr_default(fmt, ##__VA_ARGS__)
>
> This is the only reference I can find to "pr_default()" in my tree, and my compiler isn't
> very happy about it. Am I missing a patch somewhere?
>
> Thanks,
> Anna
>
No, my apologies. I had made a change in my test branch and didn't pick
it back into my send branch. That should be:
# define __sunrpc_printk(fmt, ...) printk(KERN_DEFAULT fmt, ##__VA_ARGS__)
I can resend if you are amenable to this patch.
> > +# 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)
> > diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig
> > index 2d8b67dac7b5b58a8a86c3022dd573746fb22547..a570e7adf270fb8976f751266bbffe39ef696c6a 100644
> > --- a/net/sunrpc/Kconfig
> > +++ b/net/sunrpc/Kconfig
> > @@ -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
> >
--
Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists