From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: <jbaron@akamai.com>, <rostedt@goodmis.org>, <mingo@redhat.com>
Cc: <kernel@axis.com>, <corbet@lwn.net>, <pmladek@suse.com>,
<sergey.senozhatsky@gmail.com>, <john.ogness@linutronix.de>,
<linux-kernel@vger.kernel.org>,
Vincent Whitchurch <vincent.whitchurch@axis.com>
Subject: [PATCH v3 0/2] Dynamic debug trace support
Date: Tue, 25 Aug 2020 17:33:36 +0200 [thread overview]
Message-ID: <20200825153338.17061-1-vincent.whitchurch@axis.com> (raw)
v3:
- Split flag rename to a separate patch
- Rename event to printk:dyndbg
v2:
- Remove stack buffer and use code similar to __ftrace_trace_stack()
- Use an event with the same class as printk:console
Vincent Whitchurch (2):
dynamic debug: split enable and printk flags
dynamic debug: allow printing to trace event
.../admin-guide/dynamic-debug-howto.rst | 1 +
include/linux/dynamic_debug.h | 11 +-
include/trace/events/printk.h | 12 +-
lib/dynamic_debug.c | 161 ++++++++++++++----
4 files changed, 151 insertions(+), 34 deletions(-)
Range-diff:
-: ------------ > 1: 2564b3dbbb04 dynamic debug: split enable and printk flags
1: 7bd3fb553503 ! 2: 90291c35d751 dynamic debug: allow printing to trace event
@@ Commit message
debug do it.
Add an "x" flag to make the dynamic debug call site print to a new
- printk:dynamic trace event. The trace event can be emitted instead of
- or in addition to the printk().
+ printk:dyndbg trace event. The trace event can be emitted instead of or
+ in addition to the printk().
The print buffer is statically allocated and managed using code borrowed
from __ftrace_trace_stack() and is limited to 256 bytes (four of these
@@ Documentation/admin-guide/dynamic-debug-howto.rst: of the characters::
The flags are::
p enables the pr_debug() callsite.
-+ x enables trace to the printk:dynamic event
++ x enables trace to the printk:dyndbg event
f Include the function name in the printed message
l Include line number in the printed message
m Include module name in the printed message
## include/linux/dynamic_debug.h ##
@@ include/linux/dynamic_debug.h: struct _ddebug {
- * writes commands to <debugfs>/dynamic_debug/control
- */
- #define _DPRINTK_FLAGS_NONE 0
--#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
-+#define _DPRINTK_FLAGS_PRINTK (1<<0) /* printk() a message using the format */
- #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4)
+-#define _DPRINTK_FLAGS_ENABLE _DPRINTK_FLAGS_PRINTK
+#define _DPRINTK_FLAGS_TRACE (1<<5)
-+#define _DPRINTK_FLAGS_PRINT (_DPRINTK_FLAGS_PRINTK | \
++#define _DPRINTK_FLAGS_ENABLE (_DPRINTK_FLAGS_PRINTK | \
+ _DPRINTK_FLAGS_TRACE)
#if defined DEBUG
--#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
-+#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINTK
+ #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINTK
#else
- #define _DPRINTK_FLAGS_DEFAULT 0
- #endif
## include/trace/events/printk.h ##
@@
@@ include/trace/events/printk.h: TRACE_EVENT(console,
+ TP_ARGS(text, len)
+);
+
-+DEFINE_EVENT(printk, dynamic,
++DEFINE_EVENT(printk, dyndbg,
+ TP_PROTO(const char *text, size_t len),
+ TP_ARGS(text, len)
+);
@@ lib/dynamic_debug.c
#include <rdma/ib_verbs.h>
-@@ lib/dynamic_debug.c: static inline const char *trim_prefix(const char *path)
- }
-
- static struct { unsigned flag:8; char opt_char; } opt_array[] = {
-- { _DPRINTK_FLAGS_PRINT, 'p' },
-+ { _DPRINTK_FLAGS_PRINTK, 'p' },
- { _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
+@@ lib/dynamic_debug.c: static struct { unsigned flag:8; char opt_char; } opt_array[] = {
{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
{ _DPRINTK_FLAGS_INCL_LINENO, 'l' },
{ _DPRINTK_FLAGS_INCL_TID, 't' },
@@ lib/dynamic_debug.c: static char *dynamic_emit_prefix(const struct _ddebug *desc
+ buf = this_cpu_ptr(dynamic_trace_bufs.bufs) + bufidx;
+
+ len = vscnprintf(buf->buf, sizeof(buf->buf), fmt, args);
-+ trace_dynamic(buf->buf, len);
++ trace_dyndbg(buf->buf, len);
+
+out:
+ /* As above. */
--
2.28.0
next reply other threads:[~2020-08-25 15:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 15:33 Vincent Whitchurch [this message]
2020-08-25 15:33 ` [PATCH v3 1/2] dynamic debug: split enable and printk flags Vincent Whitchurch
2020-08-25 15:33 ` [PATCH v3 2/2] dynamic debug: allow printing to trace event Vincent Whitchurch
2020-08-25 15:53 ` Joe Perches
2020-08-26 19:32 ` Steven Rostedt
2020-08-26 19:53 ` Joe Perches
2020-09-02 12:17 ` Vincent Whitchurch
2023-12-26 16:57 ` Guilherme G. Piccoli
2023-12-27 8:29 ` Vincent Whitchurch
2023-12-27 13:06 ` Guilherme G. Piccoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200825153338.17061-1-vincent.whitchurch@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=corbet@lwn.net \
--cc=jbaron@akamai.com \
--cc=john.ogness@linutronix.de \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).