public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 00/12] dyndbg: add support for writing debug logs to trace
@ 2023-11-03 13:09 Łukasz Bartosik
  2023-11-03 13:10 ` [PATCH v1 01/12] dyndbg: add _DPRINTK_FLAGS_ENABLED Łukasz Bartosik
                   ` (12 more replies)
  0 siblings, 13 replies; 55+ messages in thread
From: Łukasz Bartosik @ 2023-11-03 13:09 UTC (permalink / raw)
  To: Jason Baron, Jim Cromie, Andrew Morton, Kees Cook,
	Douglas Anderson
  Cc: Guenter Roeck, Yaniv Tzoreff, Benson Leung, Steven Rostedt,
	Vincent Whitchurch, Pekka Paalanen, Sean Paul, Daniel Vetter,
	linux-kernel, upstream

Add support for writing debug logs to trace events and trace instances.
The rationale behing this feature is to be able to redirect debug logs
(per each callsite indivdually) to trace to aid in debugging. The debug
logs output to trace can be enabled with T flag. Additionally trace
destination can be provided to the T flag after ":". The trace destination
field is used to determine where debug logs will be written. Setting trace
destination value to 0 (default) enables output to prdbg and devdbg trace
events. Setting trace destination value to a value in range of [1..255]
enables output to trace instance identified by trace destination value.
For example when trace destination value is 2 then debug logs will
be written to <debugfs>/tracing/instances/dyndbg_inst_2 instance.

Usage examples:

localhost ~ # echo "module thunderbolt =pT:7" > 
				<debugfs>/dynamic_debug/control

This will enable output of debug logs to trace instance 
<debugfs>/tracing/instances/dyndbg_inst_7 and debug logs will
be written to the syslog also because p flag is set.

localhost ~ # echo "module thunderbolt =pT:7,l" > 
                                <debugfs>/dynamic_debug/control

When trace destination is followed by another flag then trace
destination has to be followed by ",".

localhost ~ # echo "module thunderbolt =pTl" > 
                                <debugfs>/dynamic_debug/control

When trace destination is not provided explicitly then its value
defaults to 0. In this case debug logs will be written to the prdbg
and devdbg trace events.

localhost ~ # echo "module thunderbolt =T:25" > 
                                <debugfs>/dynamic_debug/control

This will enable output of debug logs to trace instance
<debugfs>/tracing/instances/dyndbg_inst_25 with debug logs output
to syslog disabled.

Given trace instance will not be initialized until debug logs are
requested to be written to it and afer init it will persist until
reboot.

Please note that output of debug logs to syslog (p flag) and trace
(T flag) can be independently enabled/disabled for each callsite.



Jim I took the liberty and based my work on your patches you pointed me
to https://github.com/jimc/linux/tree/dd-kitchen-sink. I picked up
the commits relevant to trace from the dd-kitchen-sink branch.
The only changes I introduced in your commits were related to checkpatch
complains. There are two errors still left:

1)
ERROR: need consistent spacing around '*' (ctx:WxV)
140: FILE: lib/dynamic_debug.c:1070:
+				  va_list *args)

Which seems to be a false positive to me.

2)
ERROR: Macros with complex values should be enclosed in parentheses
62: FILE: include/trace/stages/stage3_trace_output.h:12:
+#define TP_printk_no_nl(fmt, args...) fmt, args

I have not figured out how to fix it.

Changes:
V1) Major rework after receiving feedback in 
https://lore.kernel.org/all/20230915154856.1896062-1-lb@semihalf.com/

Jim Cromie (7):
  dyndbg: add _DPRINTK_FLAGS_ENABLED
  dyndbg: add _DPRINTK_FLAGS_TRACE
  dyndbg: add write-events-to-tracefs code
  dyndbg: add 2 trace-events: pr_debug, dev_dbg
  tracefs: add TP_printk_no_nl - RFC
  trace: use TP_printk_no_nl in dyndbg:prdbg,devdbg
  dyndbg: repack struct _ddebug

Łukasz Bartosik (5):
  dyndbg: move flags field to a new structure
  dyndbg: add trace destination field to _ddebug
  dyndbg: add processing of T(race) flag argument
  dyndbg: write debug logs to trace instance
  dyndbg: add trace support for hexdump

 .../admin-guide/dynamic-debug-howto.rst       |   5 +-
 MAINTAINERS                                   |   1 +
 include/linux/dynamic_debug.h                 |  57 ++-
 include/trace/events/dyndbg.h                 |  54 +++
 include/trace/stages/stage3_trace_output.h    |   3 +
 include/trace/stages/stage7_class_define.h    |   3 +
 lib/Kconfig.debug                             |   1 +
 lib/dynamic_debug.c                           | 414 +++++++++++++++---
 8 files changed, 465 insertions(+), 73 deletions(-)
 create mode 100644 include/trace/events/dyndbg.h

-- 
2.42.0.869.gea05f2083d-goog


^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2023-11-27 22:47 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-03 13:09 [PATCH v1 00/12] dyndbg: add support for writing debug logs to trace Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 01/12] dyndbg: add _DPRINTK_FLAGS_ENABLED Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 02/12] dyndbg: add _DPRINTK_FLAGS_TRACE Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 03/12] dyndbg: add write-events-to-tracefs code Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 04/12] dyndbg: add 2 trace-events: pr_debug, dev_dbg Łukasz Bartosik
2023-11-04  3:26   ` jim.cromie
2023-11-06 23:55   ` Steven Rostedt
2023-11-10 14:50     ` Łukasz Bartosik
2023-11-10 19:20       ` jim.cromie
2023-11-12 16:28         ` Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 05/12] tracefs: add TP_printk_no_nl - RFC Łukasz Bartosik
2023-11-04  3:40   ` jim.cromie
2023-11-07  1:40     ` Steven Rostedt
2023-11-03 13:10 ` [PATCH v1 06/12] trace: use TP_printk_no_nl in dyndbg:prdbg,devdbg Łukasz Bartosik
2023-11-07  0:45   ` Steven Rostedt
2023-11-10 14:51     ` Łukasz Bartosik
2023-11-10 19:21       ` jim.cromie
2023-11-03 13:10 ` [PATCH v1 07/12] dyndbg: repack struct _ddebug Łukasz Bartosik
2023-11-04  1:49   ` jim.cromie
2023-11-10 14:51     ` Łukasz Bartosik
2023-11-10 21:00       ` jim.cromie
2023-11-12 16:28         ` Łukasz Bartosik
2023-11-24 14:38           ` Łukasz Bartosik
2023-11-26  6:00             ` jim.cromie
2023-11-27 22:46               ` Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 08/12] dyndbg: move flags field to a new structure Łukasz Bartosik
2023-11-03 20:57   ` kernel test robot
2023-11-03 13:10 ` [PATCH v1 09/12] dyndbg: add trace destination field to _ddebug Łukasz Bartosik
2023-11-04  1:39   ` jim.cromie
2023-11-10 14:51     ` Łukasz Bartosik
2023-11-10 19:37       ` jim.cromie
2023-11-12 16:29         ` Łukasz Bartosik
2023-11-13 19:49           ` jim.cromie
2023-11-03 13:10 ` [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument Łukasz Bartosik
2023-11-03 18:03   ` kernel test robot
2023-11-04  3:05   ` jim.cromie
2023-11-10 14:52     ` Łukasz Bartosik
2023-11-10 19:51       ` jim.cromie
2023-11-12 16:29         ` Łukasz Bartosik
2023-11-13 19:14           ` jim.cromie
2023-11-04  4:33   ` kernel test robot
2023-11-03 13:10 ` [PATCH v1 11/12] dyndbg: write debug logs to trace instance Łukasz Bartosik
2023-11-04 21:48   ` jim.cromie
2023-11-10 14:53     ` Łukasz Bartosik
2023-11-10 20:02       ` jim.cromie
2023-11-12 16:31         ` Łukasz Bartosik
2023-11-13 18:59           ` jim.cromie
2023-11-13 23:44             ` Łukasz Bartosik
2023-11-14  1:08               ` jim.cromie
2023-11-14  7:44                 ` Łukasz Bartosik
2023-11-14 15:40                   ` jim.cromie
2023-11-14 22:09                     ` Łukasz Bartosik
2023-11-03 13:10 ` [PATCH v1 12/12] dyndbg: add trace support for hexdump Łukasz Bartosik
2023-11-04  1:25 ` [PATCH v1 00/12] dyndbg: add support for writing debug logs to trace jim.cromie
2023-11-10 14:49   ` Łukasz Bartosik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox