2023-11-03 13:12:23

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 00/12] dyndbg: add support for writing debug logs to trace

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/[email protected]/

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


2023-11-03 13:12:28

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 08/12] dyndbg: move flags field to a new structure

Add a new structure ctrl and place it in 4 padding bytes
of _ddebug struct. Move flags field to the ctrl struct
and create setter and getter for the flags field. Add unused
fields to explicitly emphasise size of each bitfield.
This step prepares for addition of a trace_dst field.

Layout of _ddebug struct after addition of ctrl is:

struct _ddebug {
union {
struct static_key_true dd_key_true; /* 0 16 */
struct static_key_false dd_key_false; /* 0 16 */
} key; /* 0 16 */
union {
struct static_key_true dd_key_true; /* 0 16 */
struct static_key_false dd_key_false; /* 0 16 */
};

const char * modname; /* 16 8 */
const char * function; /* 24 8 */
const char * filename; /* 32 8 */
const char * format; /* 40 8 */
unsigned int lineno:18; /* 48: 0 4 */
unsigned int class_id:6; /* 48:18 4 */
unsigned int unused:8; /* 48:24 4 */
struct dd_ctrl ctrl; /* 52 4 */

/* size: 56, cachelines: 1, members: 9 */
/* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Łukasz Bartosik <[email protected]>
---
include/linux/dynamic_debug.h | 9 +++++--
lib/dynamic_debug.c | 44 ++++++++++++++++++++++-------------
2 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index b9237e4ecd1b..684766289bfc 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -32,6 +32,8 @@ struct _ddebug {
#define CLS_BITS 6
unsigned int class_id:CLS_BITS;
#define _DPRINTK_CLASS_DFLT ((1 << CLS_BITS) - 1)
+ unsigned int unused:8;
+
/*
* The flags field controls the behaviour at the callsite.
* The bits here are changed dynamically when the user
@@ -58,7 +60,10 @@ struct _ddebug {
#else
#define _DPRINTK_FLAGS_DEFAULT 0
#endif
- unsigned int flags:8;
+ struct {
+ unsigned int flags:8;
+ unsigned unused:24;
+ } ctrl;
} __attribute__((aligned(8)));

enum class_map_type {
@@ -171,7 +176,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
.filename = __FILE__, \
.format = (fmt), \
.lineno = __LINE__, \
- .flags = _DPRINTK_FLAGS_DEFAULT, \
+ .ctrl = { .flags = _DPRINTK_FLAGS_DEFAULT }, \
.class_id = cls, \
_DPRINTK_KEY_INIT \
}; \
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 1ed3c4f16f69..ca87adf327df 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -80,6 +80,16 @@ module_param(verbose, int, 0644);
MODULE_PARM_DESC(verbose, " dynamic_debug/control processing "
"( 0 = off (default), 1 = module add/rm, 2 = >control summary, 3 = parsing, 4 = per-site changes)");

+static inline unsigned int get_flags(const struct _ddebug *desc)
+{
+ return desc->ctrl.flags;
+}
+
+static inline void set_flags(struct _ddebug *desc, unsigned int val)
+{
+ desc->ctrl.flags = val;
+}
+
/* Return the path relative to source root */
static inline const char *trim_prefix(const char *path)
{
@@ -247,11 +257,11 @@ static int ddebug_change(const struct ddebug_query *query,

nfound++;

- newflags = (dp->flags & modifiers->mask) | modifiers->flags;
- if (newflags == dp->flags)
+ newflags = (get_flags(dp) & modifiers->mask) | modifiers->flags;
+ if (newflags == get_flags(dp))
continue;
#ifdef CONFIG_JUMP_LABEL
- if (dp->flags & _DPRINTK_FLAGS_ENABLED) {
+ if (get_flags(dp) & _DPRINTK_FLAGS_ENABLED) {
if (!(newflags & _DPRINTK_FLAGS_ENABLED))
static_branch_disable(&dp->key.dd_key_true);
} else if (newflags & _DPRINTK_FLAGS_ENABLED) {
@@ -261,9 +271,9 @@ static int ddebug_change(const struct ddebug_query *query,
v4pr_info("changed %s:%d [%s]%s %s => %s\n",
trim_prefix(dp->filename), dp->lineno,
dt->mod_name, dp->function,
- ddebug_describe_flags(dp->flags, &fbuf),
+ ddebug_describe_flags(get_flags(dp), &fbuf),
ddebug_describe_flags(newflags, &nbuf));
- dp->flags = newflags;
+ set_flags(dp, newflags);
}
}
mutex_unlock(&ddebug_lock);
@@ -824,10 +834,11 @@ static int remaining(int wrote)

static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
{
+ unsigned int flags = get_flags(desc);
int pos_after_tid;
int pos = 0;

- if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
+ if (flags & _DPRINTK_FLAGS_INCL_TID) {
if (in_interrupt())
pos += snprintf(buf + pos, remaining(pos), "<intr> ");
else
@@ -835,16 +846,16 @@ static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
task_pid_vnr(current));
}
pos_after_tid = pos;
- if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME)
+ if (flags & _DPRINTK_FLAGS_INCL_MODNAME)
pos += snprintf(buf + pos, remaining(pos), "%s:",
desc->modname);
- if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
+ if (flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
pos += snprintf(buf + pos, remaining(pos), "%s:",
desc->function);
- if (desc->flags & _DPRINTK_FLAGS_INCL_SOURCENAME)
+ if (flags & _DPRINTK_FLAGS_INCL_SOURCENAME)
pos += snprintf(buf + pos, remaining(pos), "%s:",
trim_prefix(desc->filename));
- if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
+ if (flags & _DPRINTK_FLAGS_INCL_LINENO)
pos += snprintf(buf + pos, remaining(pos), "%d:",
desc->lineno);
if (pos - pos_after_tid)
@@ -857,7 +868,7 @@ static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)

static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
{
- if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY))
+ if (unlikely(get_flags(desc) & _DPRINTK_FLAGS_INCL_ANY))
return __dynamic_emit_prefix(desc, buf);
return buf;
}
@@ -917,7 +928,8 @@ static void ddebug_trace(struct _ddebug *desc, const struct device *dev,
__printf(2, 3)
static void ddebug_printk(struct _ddebug *desc, const char *fmt, ...)
{
- if (desc->flags & _DPRINTK_FLAGS_TRACE) {
+
+ if (get_flags(desc) & _DPRINTK_FLAGS_TRACE) {
va_list args;

va_start(args, fmt);
@@ -929,7 +941,7 @@ static void ddebug_printk(struct _ddebug *desc, const char *fmt, ...)
va_end(args);
}

- if (desc->flags & _DPRINTK_FLAGS_PRINTK) {
+ if (get_flags(desc) & _DPRINTK_FLAGS_PRINTK) {
va_list args;

va_start(args, fmt);
@@ -943,7 +955,7 @@ static void ddebug_dev_printk(struct _ddebug *desc, const struct device *dev,
const char *fmt, ...)
{

- if (desc->flags & _DPRINTK_FLAGS_TRACE) {
+ if (get_flags(desc) & _DPRINTK_FLAGS_TRACE) {
va_list args;

va_start(args, fmt);
@@ -951,7 +963,7 @@ static void ddebug_dev_printk(struct _ddebug *desc, const struct device *dev,
va_end(args);
}

- if (desc->flags & _DPRINTK_FLAGS_PRINTK) {
+ if (get_flags(desc) & _DPRINTK_FLAGS_PRINTK) {
va_list args;

va_start(args, fmt);
@@ -1247,7 +1259,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
seq_printf(m, "%s:%u [%s]%s =%s \"",
trim_prefix(dp->filename), dp->lineno,
iter->table->mod_name, dp->function,
- ddebug_describe_flags(dp->flags, &flags));
+ ddebug_describe_flags(get_flags(dp), &flags));
seq_escape_str(m, dp->format, ESCAPE_SPACE, "\t\r\n\"");
seq_puts(m, "\"");

--
2.42.0.869.gea05f2083d-goog

2023-11-03 13:12:29

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 06/12] trace: use TP_printk_no_nl in dyndbg:prdbg,devdbg

From: Jim Cromie <[email protected]>

Recently added dyndbg events: prdbg, devdbg have code to strip the
trailing newline, if its there. Drop that trimming (minimally), and
use the new TP_printk_no_nl macro instead. Also converting to a
vstring is deferred for now.

This use is slightly premature/overkill, since some pr_debugs do not
have the expected trailing newline. While those lacks are arguably
bugs, this doesn't fix them.

Signed-off-by: Jim Cromie <[email protected]>
---
include/trace/events/dyndbg.h | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/include/trace/events/dyndbg.h b/include/trace/events/dyndbg.h
index ccc5bcb070f9..91dcdbe059c0 100644
--- a/include/trace/events/dyndbg.h
+++ b/include/trace/events/dyndbg.h
@@ -20,20 +20,10 @@ TRACE_EVENT(prdbg,

TP_fast_assign(
__entry->desc = desc;
- /*
- * Each trace entry is printed in a new line.
- * If the msg finishes with '\n', cut it off
- * to avoid blank lines in the trace.
- */
- if (len > 0 && (text[len - 1] == '\n'))
- len -= 1;
-
memcpy(__get_str(msg), text, len);
- __get_str(msg)[len] = 0;
),

- TP_printk("%s.%s %s", __entry->desc->modname,
- __entry->desc->function, __get_str(msg))
+ TP_printk_no_nl("%s", __get_str(msg))
);

/* capture dev_dbg() callsite descriptor, device, and message */
@@ -52,20 +42,10 @@ TRACE_EVENT(devdbg,
TP_fast_assign(
__entry->desc = desc;
__entry->dev = (struct device *) dev;
- /*
- * Each trace entry is printed in a new line.
- * If the msg finishes with '\n', cut it off
- * to avoid blank lines in the trace.
- */
- if (len > 0 && (text[len - 1] == '\n'))
- len -= 1;
-
memcpy(__get_str(msg), text, len);
- __get_str(msg)[len] = 0;
),

- TP_printk("%s.%s %s", __entry->desc->modname,
- __entry->desc->function, __get_str(msg))
+ TP_printk_no_nl("%s", __get_str(msg))
);

#endif /* _TRACE_DYNDBG_H */
--
2.42.0.869.gea05f2083d-goog

2023-11-03 13:12:29

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument

Add processing of argument provided to T(race) flag.
The argument value determines destination of debug logs:

0 - debug logs will be written to prdbg and devdbg trace events
[1..255] - debug logs will be written to trace instance

A user can provide trace destination by folowing T flag with
":" and trace destination value in range [0..255], for example:

echo "module thunderbolt =pT:7" > /sys/kernel/debug/dynamic_debug/control
echo "module thunderbolt =lT:7,p" > /sys/kernel/debug/dynamic_debug/control

When T flag with argument is followed by other flags then the next flag has
to be preceded with ",".

When no value is provided trace destination defaults to 0, for example:

echo "module thunderbolt =T" > /sys/kernel/debug/dynamic_debug/control
echo "module thunderbolt =lTp" > /sys/kernel/debug/dynamic_debug/control

Signed-off-by: Łukasz Bartosik <[email protected]>
---
lib/dynamic_debug.c | 105 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 90 insertions(+), 15 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 3218ab078a76..c5cd28e74a02 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -71,6 +71,7 @@ struct ddebug_iter {
struct flag_settings {
unsigned int flags;
unsigned int mask;
+ unsigned int trace_dst;
};

static DEFINE_MUTEX(ddebug_lock);
@@ -111,9 +112,67 @@ static inline const char *trim_prefix(const char *path)
return path + skip;
}

-static const struct { unsigned flag:8; char opt_char; } opt_array[] = {
+typedef const char* (*read_flag_args_f)(const char *, struct flag_settings *);
+typedef char* (*show_flag_args_f)(struct dd_ctrl *, char *);
+
+/*
+ * Maximum number of characters representing value
+ * of flag T argument in human readable form - ":255,"
+ */
+#define FLAG_T_ARGS_LEN 5
+
+static const
+char *read_T_args(const char *str, struct flag_settings *modifiers)
+{
+ char *end, args[FLAG_T_ARGS_LEN];
+ int len;
+
+ if (*(str+1) != ':')
+ return str;
+
+ str += 2;
+ end = strchr(str, ',');
+ if (end && *(end + 1) == '\0')
+ return NULL;
+
+ if (end)
+ len = end - str;
+ else
+ len = strlen(str);
+
+ if (len > FLAG_T_ARGS_LEN - 1)
+ return NULL;
+
+ memcpy(args, str, len);
+ args[len] = '\0';
+ if (kstrtouint(args, 10, &modifiers->trace_dst) < 0)
+ return NULL;
+
+ if (modifiers->trace_dst > TRACE_DST_MAX)
+ return NULL;
+
+ return end ? end : str + len;
+}
+
+char *show_T_args(struct dd_ctrl *ctrl, char *p)
+{
+ int n;
+
+ n = snprintf(p, FLAG_T_ARGS_LEN, ":%u", ctrl->trace_dst);
+ WARN_ONCE(n < 0, "printing T flag args value failed\n");
+
+ return n < 0 ? p : p + n;
+}
+
+static const struct
+{
+ unsigned flag:8;
+ char opt_char;
+ read_flag_args_f read_args;
+ show_flag_args_f show_args;
+} opt_array[] = {
{ _DPRINTK_FLAGS_PRINTK, 'p' },
- { _DPRINTK_FLAGS_TRACE, 'T' },
+ { _DPRINTK_FLAGS_TRACE, 'T', read_T_args, show_T_args},
{ _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
{ _DPRINTK_FLAGS_INCL_SOURCENAME, 's' },
@@ -122,22 +181,30 @@ static const struct { unsigned flag:8; char opt_char; } opt_array[] = {
{ _DPRINTK_FLAGS_NONE, '_' },
};

-struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; };
+struct ctrlbuf { char buf[ARRAY_SIZE(opt_array)+FLAG_T_ARGS_LEN+1]; };

/* format a string into buf[] which describes the _ddebug's flags */
-static char *ddebug_describe_flags(unsigned int flags, struct flagsbuf *fb)
+static char *ddebug_describe_ctrl(struct dd_ctrl *ctrl, struct ctrlbuf *cb)
{
- char *p = fb->buf;
+ show_flag_args_f show_args = NULL;
+ char *p = cb->buf;
int i;

for (i = 0; i < ARRAY_SIZE(opt_array); ++i)
- if (flags & opt_array[i].flag)
+ if (ctrl->flags & opt_array[i].flag) {
+ if (show_args)
+ *p++ = ',';
*p++ = opt_array[i].opt_char;
- if (p == fb->buf)
+ show_args = opt_array[i].show_args;
+ if (show_args)
+ p = show_args(ctrl, p);
+ }
+
+ if (p == cb->buf)
*p++ = '_';
*p = '\0';

- return fb->buf;
+ return cb->buf;
}

#define vnpr_info(lvl, fmt, ...) \
@@ -202,7 +269,7 @@ static int ddebug_change(const struct ddebug_query *query,
struct ddebug_table *dt;
unsigned int nfound = 0;
struct dd_ctrl nctrl = {0};
- struct flagsbuf fbuf, nbuf;
+ struct ctrlbuf cbuf, nbuf;
struct ddebug_class_map *map = NULL;
int __outvar valid_class;

@@ -268,7 +335,8 @@ static int ddebug_change(const struct ddebug_query *query,
nfound++;

nctrl.flags = (get_flags(dp) & modifiers->mask) | modifiers->flags;
- if (!memcmp(&nctrl, get_ctrl(dp), sizeof(struct dd_ctrl)))
+ nctrl.trace_dst = modifiers->trace_dst;
+ if (!memcmp(&nctrl, get_ctrl(dp), sizeof(nctrl)))
continue;
#ifdef CONFIG_JUMP_LABEL
if (get_flags(dp) & _DPRINTK_FLAGS_ENABLED) {
@@ -281,8 +349,8 @@ static int ddebug_change(const struct ddebug_query *query,
v4pr_info("changed %s:%d [%s]%s %s => %s\n",
trim_prefix(dp->filename), dp->lineno,
dt->mod_name, dp->function,
- ddebug_describe_flags(get_flags(dp), &fbuf),
- ddebug_describe_flags(nctrl.flags, &nbuf));
+ ddebug_describe_ctrl(&dp->ctrl, &cbuf),
+ ddebug_describe_ctrl(&nctrl, &nbuf));
set_ctrl(dp, &nctrl);
}
}
@@ -507,6 +575,7 @@ static int ddebug_parse_query(char *words[], int nwords,
*/
static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
{
+ read_flag_args_f read_args;
int op, i;

switch (*str) {
@@ -525,6 +594,12 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
if (*str == opt_array[i].opt_char) {
modifiers->flags |= opt_array[i].flag;
+ read_args = opt_array[i].read_args;
+ if (read_args) {
+ str = read_args(str, modifiers);
+ if (!str)
+ return -EINVAL;
+ }
break;
}
}
@@ -533,7 +608,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
return -EINVAL;
}
}
- v3pr_info("flags=0x%x\n", modifiers->flags);
+ v3pr_info("flags=0x%x, trace dest=0x%x\n", modifiers->flags, modifiers->trace_dst);

/* calculate final flags, mask based upon op */
switch (op) {
@@ -1257,7 +1332,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
{
struct ddebug_iter *iter = m->private;
struct _ddebug *dp = p;
- struct flagsbuf flags;
+ struct ctrlbuf cbuf;
char const *class;

if (p == SEQ_START_TOKEN) {
@@ -1269,7 +1344,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
seq_printf(m, "%s:%u [%s]%s =%s \"",
trim_prefix(dp->filename), dp->lineno,
iter->table->mod_name, dp->function,
- ddebug_describe_flags(get_flags(dp), &flags));
+ ddebug_describe_ctrl(&dp->ctrl, &cbuf));
seq_escape_str(m, dp->format, ESCAPE_SPACE, "\t\r\n\"");
seq_puts(m, "\"");

--
2.42.0.869.gea05f2083d-goog

2023-11-03 13:12:29

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 04/12] dyndbg: add 2 trace-events: pr_debug, dev_dbg

From: Jim Cromie <[email protected]>

ddebug_trace() currently issues a single printk:console event.
Replace that event by adding include/trace/events/dyndbg.h,
which defines 2 new trace-events: dyndbg:prdbg & dyndbg:devdbg.

These events get the _ddebug descriptor, so they can access the whole
callsite record: file, line, function, flags. This allows the
addition of a dynamic prefix later.

So ddebug_trace() gets 2 new args: the descriptor and the device.
And its callers: ddebug_printk(), ddebug_dev_printk() upgrade their
flags param to pass the descriptor itself, and thus also the flags.

Signed-off-by: Jim Cromie <[email protected]>
---
MAINTAINERS | 1 +
include/trace/events/dyndbg.h | 74 +++++++++++++++++++++++++++++++++++
lib/dynamic_debug.c | 73 +++++++++++++++++-----------------
3 files changed, 112 insertions(+), 36 deletions(-)
create mode 100644 include/trace/events/dyndbg.h

diff --git a/MAINTAINERS b/MAINTAINERS
index dd5de540ec0b..fd02dc86f1fd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7320,6 +7320,7 @@ M: Jason Baron <[email protected]>
M: Jim Cromie <[email protected]>
S: Maintained
F: include/linux/dynamic_debug.h
+F: include/trace/events/dyndbg.h
F: lib/dynamic_debug.c
F: lib/test_dynamic_debug.c

diff --git a/include/trace/events/dyndbg.h b/include/trace/events/dyndbg.h
new file mode 100644
index 000000000000..ccc5bcb070f9
--- /dev/null
+++ b/include/trace/events/dyndbg.h
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM dyndbg
+
+#if !defined(_TRACE_DYNDBG_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_DYNDBG_H
+
+#include <linux/tracepoint.h>
+
+/* capture pr_debug() callsite descriptor and message */
+TRACE_EVENT(prdbg,
+ TP_PROTO(const struct _ddebug *desc, const char *text, size_t len),
+
+ TP_ARGS(desc, text, len),
+
+ TP_STRUCT__entry(
+ __field(const struct _ddebug *, desc)
+ __dynamic_array(char, msg, len + 1)
+ ),
+
+ TP_fast_assign(
+ __entry->desc = desc;
+ /*
+ * Each trace entry is printed in a new line.
+ * If the msg finishes with '\n', cut it off
+ * to avoid blank lines in the trace.
+ */
+ if (len > 0 && (text[len - 1] == '\n'))
+ len -= 1;
+
+ memcpy(__get_str(msg), text, len);
+ __get_str(msg)[len] = 0;
+ ),
+
+ TP_printk("%s.%s %s", __entry->desc->modname,
+ __entry->desc->function, __get_str(msg))
+);
+
+/* capture dev_dbg() callsite descriptor, device, and message */
+TRACE_EVENT(devdbg,
+ TP_PROTO(const struct _ddebug *desc, const struct device *dev,
+ const char *text, size_t len),
+
+ TP_ARGS(desc, dev, text, len),
+
+ TP_STRUCT__entry(
+ __field(const struct _ddebug *, desc)
+ __field(const struct device *, dev)
+ __dynamic_array(char, msg, len + 1)
+ ),
+
+ TP_fast_assign(
+ __entry->desc = desc;
+ __entry->dev = (struct device *) dev;
+ /*
+ * Each trace entry is printed in a new line.
+ * If the msg finishes with '\n', cut it off
+ * to avoid blank lines in the trace.
+ */
+ if (len > 0 && (text[len - 1] == '\n'))
+ len -= 1;
+
+ memcpy(__get_str(msg), text, len);
+ __get_str(msg)[len] = 0;
+ ),
+
+ TP_printk("%s.%s %s", __entry->desc->modname,
+ __entry->desc->function, __get_str(msg))
+);
+
+#endif /* _TRACE_DYNDBG_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 016f33c20251..1ed3c4f16f69 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -36,7 +36,9 @@
#include <linux/sched.h>
#include <linux/device.h>
#include <linux/netdevice.h>
-#include <trace/events/printk.h>
+
+#define CREATE_TRACE_POINTS
+#include <trace/events/dyndbg.h>

#include <rdma/ib_verbs.h>

@@ -878,7 +880,9 @@ struct ddebug_trace_bufs {
static DEFINE_PER_CPU(struct ddebug_trace_bufs, ddebug_trace_bufs);
static DEFINE_PER_CPU(int, ddebug_trace_reserve);

-static void ddebug_trace(const char *fmt, va_list args)
+__printf(3, 0)
+static void ddebug_trace(struct _ddebug *desc, const struct device *dev,
+ const char *fmt, va_list args)
{
struct ddebug_trace_buf *buf;
int bufidx;
@@ -897,7 +901,11 @@ static void ddebug_trace(const char *fmt, va_list args)
buf = this_cpu_ptr(ddebug_trace_bufs.bufs) + bufidx;

len = vscnprintf(buf->buf, sizeof(buf->buf), fmt, args);
- trace_console(buf->buf, len);
+
+ if (!dev)
+ trace_prdbg(desc, buf->buf, len);
+ else
+ trace_devdbg(desc, dev, buf->buf, len);

out:
/* As above. */
@@ -907,9 +915,9 @@ static void ddebug_trace(const char *fmt, va_list args)
}

__printf(2, 3)
-static void ddebug_printk(unsigned int flags, const char *fmt, ...)
+static void ddebug_printk(struct _ddebug *desc, const char *fmt, ...)
{
- if (flags & _DPRINTK_FLAGS_TRACE) {
+ if (desc->flags & _DPRINTK_FLAGS_TRACE) {
va_list args;

va_start(args, fmt);
@@ -917,11 +925,11 @@ static void ddebug_printk(unsigned int flags, const char *fmt, ...)
* All callers include the KERN_DEBUG prefix to keep the
* vprintk case simple; strip it out for tracing.
*/
- ddebug_trace(fmt + strlen(KERN_DEBUG), args);
+ ddebug_trace(desc, NULL, fmt + strlen(KERN_DEBUG), args);
va_end(args);
}

- if (flags & _DPRINTK_FLAGS_PRINTK) {
+ if (desc->flags & _DPRINTK_FLAGS_PRINTK) {
va_list args;

va_start(args, fmt);
@@ -931,19 +939,19 @@ static void ddebug_printk(unsigned int flags, const char *fmt, ...)
}

__printf(3, 4)
-static void ddebug_dev_printk(unsigned int flags, const struct device *dev,
+static void ddebug_dev_printk(struct _ddebug *desc, const struct device *dev,
const char *fmt, ...)
{

- if (flags & _DPRINTK_FLAGS_TRACE) {
+ if (desc->flags & _DPRINTK_FLAGS_TRACE) {
va_list args;

va_start(args, fmt);
- ddebug_trace(fmt, args);
+ ddebug_trace(desc, dev, fmt, args);
va_end(args);
}

- if (flags & _DPRINTK_FLAGS_PRINTK) {
+ if (desc->flags & _DPRINTK_FLAGS_PRINTK) {
va_list args;

va_start(args, fmt);
@@ -966,7 +974,7 @@ void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
vaf.fmt = fmt;
vaf.va = &args;

- ddebug_printk(descriptor->flags, KERN_DEBUG "%s%pV",
+ ddebug_printk(descriptor, KERN_DEBUG "%s%pV",
dynamic_emit_prefix(descriptor, buf), &vaf);

va_end(args);
@@ -977,7 +985,6 @@ void __dynamic_dev_dbg(struct _ddebug *descriptor,
const struct device *dev, const char *fmt, ...)
{
struct va_format vaf;
- unsigned int flags;
va_list args;

BUG_ON(!descriptor);
@@ -987,15 +994,14 @@ void __dynamic_dev_dbg(struct _ddebug *descriptor,

vaf.fmt = fmt;
vaf.va = &args;
- flags = descriptor->flags;

if (!dev) {
- ddebug_printk(flags, KERN_DEBUG "(NULL device *): %pV",
- &vaf);
+ ddebug_printk(descriptor, KERN_DEBUG "(NULL device *): %pV",
+ &vaf);
} else {
char buf[PREFIX_SIZE] = "";

- ddebug_dev_printk(flags, dev, "%s%s %s: %pV",
+ ddebug_dev_printk(descriptor, dev, "%s%s %s: %pV",
dynamic_emit_prefix(descriptor, buf),
dev_driver_string(dev), dev_name(dev),
&vaf);
@@ -1011,7 +1017,6 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
const struct net_device *dev, const char *fmt, ...)
{
struct va_format vaf;
- unsigned int flags;
va_list args;

BUG_ON(!descriptor);
@@ -1021,24 +1026,22 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,

vaf.fmt = fmt;
vaf.va = &args;
- flags = descriptor->flags;

if (dev && dev->dev.parent) {
char buf[PREFIX_SIZE] = "";

- ddebug_dev_printk(flags, dev->dev.parent,
- "%s%s %s %s%s: %pV",
- dynamic_emit_prefix(descriptor, buf),
- dev_driver_string(dev->dev.parent),
- dev_name(dev->dev.parent),
- netdev_name(dev), netdev_reg_state(dev),
- &vaf);
+ ddebug_dev_printk(descriptor, dev->dev.parent,
+ "%s%s %s %s%s: %pV",
+ dynamic_emit_prefix(descriptor, buf),
+ dev_driver_string(dev->dev.parent),
+ dev_name(dev->dev.parent),
+ netdev_name(dev), netdev_reg_state(dev),
+ &vaf);
} else if (dev) {
- ddebug_printk(flags, KERN_DEBUG "%s%s: %pV",
- netdev_name(dev), netdev_reg_state(dev), &vaf);
+ ddebug_dev_printk(descriptor, &dev->dev, KERN_DEBUG "%s%s: %pV",
+ netdev_name(dev), netdev_reg_state(dev), &vaf);
} else {
- ddebug_printk(flags, KERN_DEBUG "(NULL net_device): %pV",
- &vaf);
+ ddebug_printk(descriptor, KERN_DEBUG "(NULL net_device): %pV", &vaf);
}

va_end(args);
@@ -1054,18 +1057,16 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
{
struct va_format vaf;
va_list args;
- unsigned int flags;

va_start(args, fmt);

vaf.fmt = fmt;
vaf.va = &args;
- flags = descriptor->flags;

if (ibdev && ibdev->dev.parent) {
char buf[PREFIX_SIZE] = "";

- ddebug_dev_printk(flags, ibdev->dev.parent,
+ ddebug_dev_printk(descriptor, ibdev->dev.parent,
"%s%s %s %s: %pV",
dynamic_emit_prefix(descriptor, buf),
dev_driver_string(ibdev->dev.parent),
@@ -1073,10 +1074,10 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
dev_name(&ibdev->dev),
&vaf);
} else if (ibdev) {
- ddebug_printk(flags, KERN_DEBUG "%s: %pV",
- dev_name(&ibdev->dev), &vaf);
+ ddebug_dev_printk(descriptor, &ibdev->dev, KERN_DEBUG "%s: %pV",
+ dev_name(&ibdev->dev), &vaf);
} else {
- ddebug_printk(flags, KERN_DEBUG "(NULL ip_device): %pV", &vaf);
+ ddebug_printk(descriptor, KERN_DEBUG "(NULL ip_device): %pV", &vaf);
}

va_end(args);
--
2.42.0.869.gea05f2083d-goog

2023-11-03 13:12:31

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 07/12] dyndbg: repack struct _ddebug

From: Jim Cromie <[email protected]>

Move the JUMP_LABEL to the top of the struct, since theyre both
align(8) and this closes a pahole (unfortunately trading for padding,
but still).

Signed-off-by: Jim Cromie <[email protected]>
---
include/linux/dynamic_debug.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 497130816e9c..b9237e4ecd1b 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -14,6 +14,12 @@
* the special section is treated as an array of these.
*/
struct _ddebug {
+#ifdef CONFIG_JUMP_LABEL
+ union {
+ struct static_key_true dd_key_true;
+ struct static_key_false dd_key_false;
+ } key;
+#endif
/*
* These fields are used to drive the user interface
* for selecting and displaying debug callsites.
@@ -53,12 +59,6 @@ struct _ddebug {
#define _DPRINTK_FLAGS_DEFAULT 0
#endif
unsigned int flags:8;
-#ifdef CONFIG_JUMP_LABEL
- union {
- struct static_key_true dd_key_true;
- struct static_key_false dd_key_false;
- } key;
-#endif
} __attribute__((aligned(8)));

enum class_map_type {
--
2.42.0.869.gea05f2083d-goog

2023-11-03 13:12:41

by Łukasz Bartosik

[permalink] [raw]
Subject: [PATCH v1 12/12] dyndbg: add trace support for hexdump

Add support for writing hexdump debug logs to trace.

Signed-off-by: Łukasz Bartosik <[email protected]>
---
include/linux/dynamic_debug.h | 16 ++++++++++------
lib/dynamic_debug.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 3084302876b4..e01b529dcd09 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -298,12 +298,16 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
_dynamic_func_call(fmt, __dynamic_ibdev_dbg, \
dev, fmt, ##__VA_ARGS__)

-#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
- groupsize, buf, len, ascii) \
- _dynamic_func_call_no_desc(__builtin_constant_p(prefix_str) ? prefix_str : "hexdump", \
- print_hex_dump, \
- KERN_DEBUG, prefix_str, prefix_type, \
- rowsize, groupsize, buf, len, ascii)
+void _print_hex_dump(struct _ddebug *descriptor, const char *level,
+ const char *prefix_str, int prefix_type, int rowsize,
+ int groupsize, const void *buf, size_t len, bool ascii);
+
+#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
+ groupsize, buf, len, ascii) \
+ _dynamic_func_call(__builtin_constant_p(prefix_str) ? prefix_str : "hexdump", \
+ _print_hex_dump, \
+ KERN_DEBUG, prefix_str, prefix_type, \
+ rowsize, groupsize, buf, len, ascii)

/* for test only, generally expect drm.debug style macro wrappers */
#define __pr_debug_cls(cls, fmt, ...) do { \
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 541d9d522b3b..fb2c6e2909bb 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1128,6 +1128,41 @@ static void ddebug_dev_printk(struct _ddebug *desc, const struct device *dev,
}
}

+void _print_hex_dump(struct _ddebug *descriptor, const char *level,
+ const char *prefix_str, int prefix_type, int rowsize,
+ int groupsize, const void *buf, size_t len, bool ascii)
+{
+ const u8 *ptr = buf;
+ int i, linelen, remaining = len;
+ unsigned char linebuf[32 * 3 + 2 + 32 + 1];
+
+ if (rowsize != 16 && rowsize != 32)
+ rowsize = 16;
+
+ for (i = 0; i < len; i += rowsize) {
+ linelen = min(remaining, rowsize);
+ remaining -= rowsize;
+
+ hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize,
+ linebuf, sizeof(linebuf), ascii);
+
+ switch (prefix_type) {
+ case DUMP_PREFIX_ADDRESS:
+ ddebug_printk(descriptor, "%s%s%p: %s\n",
+ level, prefix_str, ptr + i, linebuf);
+ break;
+ case DUMP_PREFIX_OFFSET:
+ ddebug_printk(descriptor, "%s%s%.8x: %s\n",
+ level, prefix_str, i, linebuf);
+ break;
+ default:
+ ddebug_printk(descriptor, "%s%s%s\n",
+ level, prefix_str, linebuf);
+ break;
+ }
+ }
+}
+
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
{
va_list args;
--
2.42.0.869.gea05f2083d-goog

2023-11-03 18:04:48

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument

Hi Łukasz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.6 next-20231103]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/ukasz-Bartosik/dyndbg-add-_DPRINTK_FLAGS_ENABLED/20231103-212105
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20231103131011.1316396-11-lb%40semihalf.com
patch subject: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument
config: loongarch-randconfig-002-20231103 (https://download.01.org/0day-ci/archive/20231104/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231104/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> lib/dynamic_debug.c:157:7: warning: no previous prototype for 'show_T_args' [-Wmissing-prototypes]
157 | char *show_T_args(struct dd_ctrl *ctrl, char *p)
| ^~~~~~~~~~~


vim +/show_T_args +157 lib/dynamic_debug.c

156
> 157 char *show_T_args(struct dd_ctrl *ctrl, char *p)
158 {
159 int n;
160
161 n = snprintf(p, FLAG_T_ARGS_LEN, ":%u", ctrl->trace_dst);
162 WARN_ONCE(n < 0, "printing T flag args value failed\n");
163
164 return n < 0 ? p : p + n;
165 }
166

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-11-03 21:00:44

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 08/12] dyndbg: move flags field to a new structure

Hi Łukasz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.6 next-20231103]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/ukasz-Bartosik/dyndbg-add-_DPRINTK_FLAGS_ENABLED/20231103-212105
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20231103131011.1316396-9-lb%40semihalf.com
patch subject: [PATCH v1 08/12] dyndbg: move flags field to a new structure
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231104/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231104/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:5,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:6,
from mm/page_alloc.c:19:
mm/page_alloc.c: In function 'zone_pcp_init':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:231:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
231 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:256:9: note: in expansion of macro '__dynamic_func_call_cls'
256 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:258:9: note: in expansion of macro '_dynamic_func_call_cls'
258 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:277:9: note: in expansion of macro '_dynamic_func_call'
277 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:579:9: note: in expansion of macro 'dynamic_pr_debug'
579 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
mm/page_alloc.c:5691:17: note: in expansion of macro 'pr_debug'
5691 | pr_debug(" %s zone: %lu pages, LIFO batch:%u\n", zone->name,
| ^~~~~~~~
mm/page_alloc.c: In function 'alloc_contig_dump_pages':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
mm/page_alloc.c:6250:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
6250 | if (DYNAMIC_DEBUG_BRANCH(descriptor)) {
| ^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:564,
from include/asm-generic/bug.h:22:
>> mm/page_alloc.c:6248:39: warning: variable 'descriptor' set but not used [-Wunused-but-set-variable]
6248 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, "migrate failure");
| ^~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
mm/page_alloc.c:6248:9: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
6248 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, "migrate failure");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from fs/btrfs/delayed-ref.c:6:
fs/btrfs/delayed-ref.c: In function 'btrfs_check_delayed_seq':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/delayed-ref.c:519:17: note: in expansion of macro 'btrfs_debug'
519 | btrfs_debug(fs_info,
| ^~~~~~~~~~~
In file included from include/linux/printk.h:564,
from include/asm-generic/bug.h:22,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:17,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/linux/rculist.h:11:
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug322' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/delayed-ref.c:519:17: note: in expansion of macro 'btrfs_debug'
519 | btrfs_debug(fs_info,
| ^~~~~~~~~~~
--
In file included from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from fs/btrfs/relocation.c:6:
fs/btrfs/relocation.c: In function 'create_reloc_root':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:833:17: note: in expansion of macro 'btrfs_abort_transaction'
833 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:564,
from include/asm-generic/bug.h:22,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:17,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/linux/rculist.h:11:
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug320' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:833:17: note: in expansion of macro 'btrfs_abort_transaction'
833 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/relocation.c: In function 'replace_file_extents':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1167:25: note: in expansion of macro 'btrfs_abort_transaction'
1167 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug322' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1167:25: note: in expansion of macro 'btrfs_abort_transaction'
1167 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1178:25: note: in expansion of macro 'btrfs_abort_transaction'
1178 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug324' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1178:25: note: in expansion of macro 'btrfs_abort_transaction'
1178 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/relocation.c: In function 'replace_path':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1390:25: note: in expansion of macro 'btrfs_abort_transaction'
1390 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug326' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1390:25: note: in expansion of macro 'btrfs_abort_transaction'
1390 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1399:25: note: in expansion of macro 'btrfs_abort_transaction'
1399 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug328' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1399:25: note: in expansion of macro 'btrfs_abort_transaction'
1399 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1409:25: note: in expansion of macro 'btrfs_abort_transaction'
1409 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug330' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1409:25: note: in expansion of macro 'btrfs_abort_transaction'
1409 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1419:25: note: in expansion of macro 'btrfs_abort_transaction'
1419 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug332' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1419:25: note: in expansion of macro 'btrfs_abort_transaction'
1419 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/relocation.c: In function 'merge_reloc_root':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1843:25: note: in expansion of macro 'btrfs_abort_transaction'
1843 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug336' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1843:25: note: in expansion of macro 'btrfs_abort_transaction'
1843 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/relocation.c: In function 'prepare_to_merge':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1914:25: note: in expansion of macro 'btrfs_abort_transaction'
1914 | btrfs_abort_transaction(trans, (int)PTR_ERR(root));
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug338' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1914:25: note: in expansion of macro 'btrfs_abort_transaction'
1914 | btrfs_abort_transaction(trans, (int)PTR_ERR(root));
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1947:25: note: in expansion of macro 'btrfs_abort_transaction'
1947 | btrfs_abort_transaction(trans, -EUCLEAN);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug340' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1947:25: note: in expansion of macro 'btrfs_abort_transaction'
1947 | btrfs_abort_transaction(trans, -EUCLEAN);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1969:25: note: in expansion of macro 'btrfs_abort_transaction'
1969 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug342' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:1969:25: note: in expansion of macro 'btrfs_abort_transaction'
1969 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/relocation.c: In function 'do_relocation':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:2532:33: note: in expansion of macro 'btrfs_abort_transaction'
2532 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug344' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:2532:33: note: in expansion of macro 'btrfs_abort_transaction'
2532 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/relocation.c: In function 'delete_orphan_inode':
include/linux/dynamic_debug.h:213:28: error: 'struct _ddebug' has no member named 'flags'
213 | unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED)
| ^
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/dynamic_debug.h:240:13: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
240 | if (DYNAMIC_DEBUG_BRANCH(id)) \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:3868:17: note: in expansion of macro 'btrfs_abort_transaction'
3868 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:180:45: warning: variable '__UNIQUE_ID_ddebug353' set but not used [-Wunused-but-set-variable]
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~~~~~~
include/linux/dynamic_debug.h:173:31: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_CLS'
173 | __section("__dyndbg") name = { \
| ^~~~
include/linux/dynamic_debug.h:266:9: note: in expansion of macro '__dynamic_func_call_cls_no_desc'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:29: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/compiler_types.h:75:22: note: in expansion of macro '___PASTE'
75 | #define __PASTE(a,b) ___PASTE(a,b)
| ^~~~~~~~
include/linux/compiler.h:180:37: note: in expansion of macro '__PASTE'
180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
| ^~~~~~~
include/linux/dynamic_debug.h:266:41: note: in expansion of macro '__UNIQUE_ID'
266 | __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call_cls_no_desc'
269 | _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/messages.h:110:9: note: in expansion of macro '_dynamic_func_call_no_desc'
110 | _dynamic_func_call_no_desc(fmt, btrfs_printk, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/transaction.h:222:25: note: in expansion of macro 'btrfs_debug'
222 | btrfs_debug((trans)->fs_info, \
| ^~~~~~~~~~~
fs/btrfs/relocation.c:3868:17: note: in expansion of macro 'btrfs_abort_transaction'
3868 | btrfs_abort_transaction(trans, ret);
| ^~~~~~~~~~~~~~~~~~~~~~~
..


vim +/descriptor +6248 mm/page_alloc.c

e95d372c4cd46b6 Kefeng Wang 2023-05-16 6243
8df995f6bde01de Alexandre Ghiti 2019-05-13 6244 #ifdef CONFIG_CONTIG_ALLOC
a1394bddf9b60e9 Minchan Kim 2021-04-29 6245 /* Usage: See admin-guide/dynamic-debug-howto.rst */
a1394bddf9b60e9 Minchan Kim 2021-04-29 6246 static void alloc_contig_dump_pages(struct list_head *page_list)
a1394bddf9b60e9 Minchan Kim 2021-04-29 6247 {
a1394bddf9b60e9 Minchan Kim 2021-04-29 @6248 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, "migrate failure");
a1394bddf9b60e9 Minchan Kim 2021-04-29 6249
a1394bddf9b60e9 Minchan Kim 2021-04-29 @6250 if (DYNAMIC_DEBUG_BRANCH(descriptor)) {
a1394bddf9b60e9 Minchan Kim 2021-04-29 6251 struct page *page;
a1394bddf9b60e9 Minchan Kim 2021-04-29 6252
a1394bddf9b60e9 Minchan Kim 2021-04-29 6253 dump_stack();
a1394bddf9b60e9 Minchan Kim 2021-04-29 6254 list_for_each_entry(page, page_list, lru)
a1394bddf9b60e9 Minchan Kim 2021-04-29 6255 dump_page(page, "migration failure");
a1394bddf9b60e9 Minchan Kim 2021-04-29 6256 }
a1394bddf9b60e9 Minchan Kim 2021-04-29 6257 }
a1394bddf9b60e9 Minchan Kim 2021-04-29 6258

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-11-04 01:26:34

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH v1 00/12] dyndbg: add support for writing debug logs to trace

Hi Łukasz,

can I haz a git remote url ?
no webmail antics that way.

On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
>
> 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

isnt +p independent of dest var ? its just "on" to syslog.

> 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.
>

that (delayed init) might be a problem,
user side will have to look for the appearance of traces ?

Also, I have some reservations about exposing numeric destinations -
the user(space) must then decide/coordinate what dest-number
is used for which instance/purpose.

It would be fine for 1 customer, but might be a little tedious for many,
who now have to coordinate. A bit like a shared/party line in the early
days of rural telephone.

As I recall, an early early version of classmaps used numeric classes,
(taken straight from drm_debug_category).
As Jason noted (more diplomatically than I assimilated)
it was kind of arbitrary and obscure/obtuse/unhelpful numbering.

It is why I added classnames, with the bonus that
the name->num mapping was also a validation step
against known CLASSMAP_DEFINE-itions
(if you knew DRM drivers knew "DRM_KMS_CORE",
you knew what you were asking for)

Your earlier version had a dest keyword which maybe fits better with this point.
that said, it was in a selector position, so it doesnt work grammatically.

So, what do you think about a new command:

echo <<EoCMDBlk
open kms-stream
class DRM_UT_CORE +T # global
class DRM_UT_KMS +T:kms-stream
EoCMDBlk \
> /proc/dynamic/debug

this allows tracking names, assigning ids, erroring when all used,
and validating names > control
without exposing the numbers.

the open/close changes are (would be) persistent

the thing it doesnt allow is pre-selecting the destination,
then arming it later with a +T

so it doesnt (wouldnt) play super-nice with
echo 0x1F > /sys/module/drm/parameters/debug_trace

that said, we can preset the dst:

echo <<EoCMDBlk
open drm-kms-stream
open drm-core-stream
class DRM_UT_CORE -T:drm-core-stream
class DRM_UT_KMS -T:drm-kms-stream
EoCMDBlk \
> /proc/dynamic/debug

then enable whatever is preset selectively:

echo $I_forgot_the_bit > /sys/module/drm/parameters/debug_trace
OR
echo class DRM_UT_KMS +T > /proc/dynamic/debug







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

so its the specific wording I previously grumbled about, I think.

>
>
> 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:

Bah - macros !
I'll look at your diffs in git :-)

>
> 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.

those 2 no_nl patches were pretty exploratory,
IIRC, Steve was inclined to add the \n when not already in the format.
It would be variation-proof


>
> Changes:
> V1) Major rework after receiving feedback in
> https://lore.kernel.org/all/[email protected]/
>
> 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
>

2023-11-04 01:51:24

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH v1 07/12] dyndbg: repack struct _ddebug

On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
>
> From: Jim Cromie <[email protected]>
>
> Move the JUMP_LABEL to the top of the struct, since theyre both
> align(8) and this closes a pahole (unfortunately trading for padding,
> but still).
>
> Signed-off-by: Jim Cromie <[email protected]>

let me add, I havent really tested this, nevermind thorough.
specifically, I didnt look for any offset dependence on the static-key
inside their container.
Conversely, maybe theres a free default or something in there.

> ---
> include/linux/dynamic_debug.h | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> index 497130816e9c..b9237e4ecd1b 100644
> --- a/include/linux/dynamic_debug.h
> +++ b/include/linux/dynamic_debug.h
> @@ -14,6 +14,12 @@
> * the special section is treated as an array of these.
> */
> struct _ddebug {
> +#ifdef CONFIG_JUMP_LABEL
> + union {
> + struct static_key_true dd_key_true;
> + struct static_key_false dd_key_false;
> + } key;
> +#endif
> /*
> * These fields are used to drive the user interface
> * for selecting and displaying debug callsites.
> @@ -53,12 +59,6 @@ struct _ddebug {
> #define _DPRINTK_FLAGS_DEFAULT 0
> #endif
> unsigned int flags:8;
> -#ifdef CONFIG_JUMP_LABEL
> - union {
> - struct static_key_true dd_key_true;
> - struct static_key_false dd_key_false;
> - } key;
> -#endif
> } __attribute__((aligned(8)));
>
> enum class_map_type {
> --
> 2.42.0.869.gea05f2083d-goog
>

2023-11-04 03:07:50

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument

On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
>
> Add processing of argument provided to T(race) flag.
> The argument value determines destination of debug logs:
>
> 0 - debug logs will be written to prdbg and devdbg trace events
> [1..255] - debug logs will be written to trace instance
>
> A user can provide trace destination by folowing T flag with
> ":" and trace destination value in range [0..255], for example:
>
> echo "module thunderbolt =pT:7" > /sys/kernel/debug/dynamic_debug/control
> echo "module thunderbolt =lT:7,p" > /sys/kernel/debug/dynamic_debug/control
>
> When T flag with argument is followed by other flags then the next flag has
> to be preceded with ",".
>

the trailing , seems punctuation heavy.
Could we just stipulate that any :string (leading : trailing anything)
be the last flag in the spec ?
bare T flags are not constrained otherwise.
seems fine as API-spec-by-error-codes.




> When no value is provided trace destination defaults to 0, for example:
>
> echo "module thunderbolt =T" > /sys/kernel/debug/dynamic_debug/control
> echo "module thunderbolt =lTp" > /sys/kernel/debug/dynamic_debug/control

no colon after T means p is a flag, not a destination name

2023-11-04 03:27:38

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH v1 04/12] dyndbg: add 2 trace-events: pr_debug, dev_dbg

On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
>
> From: Jim Cromie <[email protected]>
>
> ddebug_trace() currently issues a single printk:console event.
> Replace that event by adding include/trace/events/dyndbg.h,
> which defines 2 new trace-events: dyndbg:prdbg & dyndbg:devdbg.
>
> These events get the _ddebug descriptor, so they can access the whole
> callsite record: file, line, function, flags. This allows the
> addition of a dynamic prefix later.
>
> So ddebug_trace() gets 2 new args: the descriptor and the device.
> And its callers: ddebug_printk(), ddebug_dev_printk() upgrade their
> flags param to pass the descriptor itself, and thus also the flags.
>
> Signed-off-by: Jim Cromie <[email protected]>

let me add:

I have doubts about adding the descriptor to the trace record.
For loadable modules in particular, those descriptors will go away at rmmod.

I added it thinking it would support filtering by callsite info.
Its not entirely clear whether it adds any utility, now or potentially.

During dev/hacking, I saw UNSAFE_<mumble> while TP_printk-ing the records,
while banging on it with various hammers (modprobe cycling probably)

maybe on rmmod, they could be "cached" (or pointers poisoned)
allowing their use until then (and maybe afterwards)


> ---
> MAINTAINERS | 1 +
> include/trace/events/dyndbg.h | 74 +++++++++++++++++++++++++++++++++++
> lib/dynamic_debug.c | 73 +++++++++++++++++-----------------
> 3 files changed, 112 insertions(+), 36 deletions(-)
> create mode 100644 include/trace/events/dyndbg.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index dd5de540ec0b..fd02dc86f1fd 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7320,6 +7320,7 @@ M: Jason Baron <[email protected]>
> M: Jim Cromie <[email protected]>
> S: Maintained
> F: include/linux/dynamic_debug.h
> +F: include/trace/events/dyndbg.h
> F: lib/dynamic_debug.c
> F: lib/test_dynamic_debug.c
>
> diff --git a/include/trace/events/dyndbg.h b/include/trace/events/dyndbg.h
> new file mode 100644
> index 000000000000..ccc5bcb070f9
> --- /dev/null
> +++ b/include/trace/events/dyndbg.h
> @@ -0,0 +1,74 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM dyndbg
> +
> +#if !defined(_TRACE_DYNDBG_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_DYNDBG_H
> +
> +#include <linux/tracepoint.h>
> +
> +/* capture pr_debug() callsite descriptor and message */
> +TRACE_EVENT(prdbg,
> + TP_PROTO(const struct _ddebug *desc, const char *text, size_t len),
> +
> + TP_ARGS(desc, text, len),
> +
> + TP_STRUCT__entry(
> + __field(const struct _ddebug *, desc)
> + __dynamic_array(char, msg, len + 1)
> + ),
> +
> + TP_fast_assign(
> + __entry->desc = desc;
> + /*
> + * Each trace entry is printed in a new line.
> + * If the msg finishes with '\n', cut it off
> + * to avoid blank lines in the trace.
> + */
> + if (len > 0 && (text[len - 1] == '\n'))
> + len -= 1;
> +
> + memcpy(__get_str(msg), text, len);
> + __get_str(msg)[len] = 0;
> + ),
> +
> + TP_printk("%s.%s %s", __entry->desc->modname,
> + __entry->desc->function, __get_str(msg))
> +);
> +
> +/* capture dev_dbg() callsite descriptor, device, and message */
> +TRACE_EVENT(devdbg,
> + TP_PROTO(const struct _ddebug *desc, const struct device *dev,
> + const char *text, size_t len),
> +
> + TP_ARGS(desc, dev, text, len),
> +
> + TP_STRUCT__entry(
> + __field(const struct _ddebug *, desc)
> + __field(const struct device *, dev)
> + __dynamic_array(char, msg, len + 1)
> + ),
> +
> + TP_fast_assign(
> + __entry->desc = desc;
> + __entry->dev = (struct device *) dev;
> + /*
> + * Each trace entry is printed in a new line.
> + * If the msg finishes with '\n', cut it off
> + * to avoid blank lines in the trace.
> + */
> + if (len > 0 && (text[len - 1] == '\n'))
> + len -= 1;
> +
> + memcpy(__get_str(msg), text, len);
> + __get_str(msg)[len] = 0;
> + ),
> +
> + TP_printk("%s.%s %s", __entry->desc->modname,
> + __entry->desc->function, __get_str(msg))
> +);
> +
> +#endif /* _TRACE_DYNDBG_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 016f33c20251..1ed3c4f16f69 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -36,7 +36,9 @@
> #include <linux/sched.h>
> #include <linux/device.h>
> #include <linux/netdevice.h>
> -#include <trace/events/printk.h>
> +
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/dyndbg.h>
>
> #include <rdma/ib_verbs.h>
>
> @@ -878,7 +880,9 @@ struct ddebug_trace_bufs {
> static DEFINE_PER_CPU(struct ddebug_trace_bufs, ddebug_trace_bufs);
> static DEFINE_PER_CPU(int, ddebug_trace_reserve);
>
> -static void ddebug_trace(const char *fmt, va_list args)
> +__printf(3, 0)
> +static void ddebug_trace(struct _ddebug *desc, const struct device *dev,
> + const char *fmt, va_list args)
> {
> struct ddebug_trace_buf *buf;
> int bufidx;
> @@ -897,7 +901,11 @@ static void ddebug_trace(const char *fmt, va_list args)
> buf = this_cpu_ptr(ddebug_trace_bufs.bufs) + bufidx;
>
> len = vscnprintf(buf->buf, sizeof(buf->buf), fmt, args);
> - trace_console(buf->buf, len);
> +
> + if (!dev)
> + trace_prdbg(desc, buf->buf, len);
> + else
> + trace_devdbg(desc, dev, buf->buf, len);
>
> out:
> /* As above. */
> @@ -907,9 +915,9 @@ static void ddebug_trace(const char *fmt, va_list args)
> }
>
> __printf(2, 3)
> -static void ddebug_printk(unsigned int flags, const char *fmt, ...)
> +static void ddebug_printk(struct _ddebug *desc, const char *fmt, ...)
> {
> - if (flags & _DPRINTK_FLAGS_TRACE) {
> + if (desc->flags & _DPRINTK_FLAGS_TRACE) {
> va_list args;
>
> va_start(args, fmt);
> @@ -917,11 +925,11 @@ static void ddebug_printk(unsigned int flags, const char *fmt, ...)
> * All callers include the KERN_DEBUG prefix to keep the
> * vprintk case simple; strip it out for tracing.
> */
> - ddebug_trace(fmt + strlen(KERN_DEBUG), args);
> + ddebug_trace(desc, NULL, fmt + strlen(KERN_DEBUG), args);
> va_end(args);
> }
>
> - if (flags & _DPRINTK_FLAGS_PRINTK) {
> + if (desc->flags & _DPRINTK_FLAGS_PRINTK) {
> va_list args;
>
> va_start(args, fmt);
> @@ -931,19 +939,19 @@ static void ddebug_printk(unsigned int flags, const char *fmt, ...)
> }
>
> __printf(3, 4)
> -static void ddebug_dev_printk(unsigned int flags, const struct device *dev,
> +static void ddebug_dev_printk(struct _ddebug *desc, const struct device *dev,
> const char *fmt, ...)
> {
>
> - if (flags & _DPRINTK_FLAGS_TRACE) {
> + if (desc->flags & _DPRINTK_FLAGS_TRACE) {
> va_list args;
>
> va_start(args, fmt);
> - ddebug_trace(fmt, args);
> + ddebug_trace(desc, dev, fmt, args);
> va_end(args);
> }
>
> - if (flags & _DPRINTK_FLAGS_PRINTK) {
> + if (desc->flags & _DPRINTK_FLAGS_PRINTK) {
> va_list args;
>
> va_start(args, fmt);
> @@ -966,7 +974,7 @@ void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
> vaf.fmt = fmt;
> vaf.va = &args;
>
> - ddebug_printk(descriptor->flags, KERN_DEBUG "%s%pV",
> + ddebug_printk(descriptor, KERN_DEBUG "%s%pV",
> dynamic_emit_prefix(descriptor, buf), &vaf);
>
> va_end(args);
> @@ -977,7 +985,6 @@ void __dynamic_dev_dbg(struct _ddebug *descriptor,
> const struct device *dev, const char *fmt, ...)
> {
> struct va_format vaf;
> - unsigned int flags;
> va_list args;
>
> BUG_ON(!descriptor);
> @@ -987,15 +994,14 @@ void __dynamic_dev_dbg(struct _ddebug *descriptor,
>
> vaf.fmt = fmt;
> vaf.va = &args;
> - flags = descriptor->flags;
>
> if (!dev) {
> - ddebug_printk(flags, KERN_DEBUG "(NULL device *): %pV",
> - &vaf);
> + ddebug_printk(descriptor, KERN_DEBUG "(NULL device *): %pV",
> + &vaf);
> } else {
> char buf[PREFIX_SIZE] = "";
>
> - ddebug_dev_printk(flags, dev, "%s%s %s: %pV",
> + ddebug_dev_printk(descriptor, dev, "%s%s %s: %pV",
> dynamic_emit_prefix(descriptor, buf),
> dev_driver_string(dev), dev_name(dev),
> &vaf);
> @@ -1011,7 +1017,6 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
> const struct net_device *dev, const char *fmt, ...)
> {
> struct va_format vaf;
> - unsigned int flags;
> va_list args;
>
> BUG_ON(!descriptor);
> @@ -1021,24 +1026,22 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
>
> vaf.fmt = fmt;
> vaf.va = &args;
> - flags = descriptor->flags;
>
> if (dev && dev->dev.parent) {
> char buf[PREFIX_SIZE] = "";
>
> - ddebug_dev_printk(flags, dev->dev.parent,
> - "%s%s %s %s%s: %pV",
> - dynamic_emit_prefix(descriptor, buf),
> - dev_driver_string(dev->dev.parent),
> - dev_name(dev->dev.parent),
> - netdev_name(dev), netdev_reg_state(dev),
> - &vaf);
> + ddebug_dev_printk(descriptor, dev->dev.parent,
> + "%s%s %s %s%s: %pV",
> + dynamic_emit_prefix(descriptor, buf),
> + dev_driver_string(dev->dev.parent),
> + dev_name(dev->dev.parent),
> + netdev_name(dev), netdev_reg_state(dev),
> + &vaf);
> } else if (dev) {
> - ddebug_printk(flags, KERN_DEBUG "%s%s: %pV",
> - netdev_name(dev), netdev_reg_state(dev), &vaf);
> + ddebug_dev_printk(descriptor, &dev->dev, KERN_DEBUG "%s%s: %pV",
> + netdev_name(dev), netdev_reg_state(dev), &vaf);
> } else {
> - ddebug_printk(flags, KERN_DEBUG "(NULL net_device): %pV",
> - &vaf);
> + ddebug_printk(descriptor, KERN_DEBUG "(NULL net_device): %pV", &vaf);
> }
>
> va_end(args);
> @@ -1054,18 +1057,16 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
> {
> struct va_format vaf;
> va_list args;
> - unsigned int flags;
>
> va_start(args, fmt);
>
> vaf.fmt = fmt;
> vaf.va = &args;
> - flags = descriptor->flags;
>
> if (ibdev && ibdev->dev.parent) {
> char buf[PREFIX_SIZE] = "";
>
> - ddebug_dev_printk(flags, ibdev->dev.parent,
> + ddebug_dev_printk(descriptor, ibdev->dev.parent,
> "%s%s %s %s: %pV",
> dynamic_emit_prefix(descriptor, buf),
> dev_driver_string(ibdev->dev.parent),
> @@ -1073,10 +1074,10 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
> dev_name(&ibdev->dev),
> &vaf);
> } else if (ibdev) {
> - ddebug_printk(flags, KERN_DEBUG "%s: %pV",
> - dev_name(&ibdev->dev), &vaf);
> + ddebug_dev_printk(descriptor, &ibdev->dev, KERN_DEBUG "%s: %pV",
> + dev_name(&ibdev->dev), &vaf);
> } else {
> - ddebug_printk(flags, KERN_DEBUG "(NULL ip_device): %pV", &vaf);
> + ddebug_printk(descriptor, KERN_DEBUG "(NULL ip_device): %pV", &vaf);
> }
>
> va_end(args);
> --
> 2.42.0.869.gea05f2083d-goog
>

2023-11-04 04:34:54

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument

Hi Łukasz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.6 next-20231103]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/ukasz-Bartosik/dyndbg-add-_DPRINTK_FLAGS_ENABLED/20231103-212105
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20231103131011.1316396-11-lb%40semihalf.com
patch subject: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument
config: i386-randconfig-063-20231104 (https://download.01.org/0day-ci/archive/20231104/[email protected]/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231104/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> lib/dynamic_debug.c:157:6: sparse: sparse: symbol 'show_T_args' was not declared. Should it be static?

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-11-06 23:55:40

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH v1 04/12] dyndbg: add 2 trace-events: pr_debug, dev_dbg

On Fri, 3 Nov 2023 14:10:03 +0100
Łukasz Bartosik <[email protected]> wrote:

> +/* capture pr_debug() callsite descriptor and message */
> +TRACE_EVENT(prdbg,
> + TP_PROTO(const struct _ddebug *desc, const char *text, size_t len),
> +
> + TP_ARGS(desc, text, len),
> +
> + TP_STRUCT__entry(
> + __field(const struct _ddebug *, desc)
> + __dynamic_array(char, msg, len + 1)
> + ),
> +
> + TP_fast_assign(
> + __entry->desc = desc;
> + /*
> + * Each trace entry is printed in a new line.
> + * If the msg finishes with '\n', cut it off
> + * to avoid blank lines in the trace.
> + */
> + if (len > 0 && (text[len - 1] == '\n'))
> + len -= 1;
> +
> + memcpy(__get_str(msg), text, len);
> + __get_str(msg)[len] = 0;
> + ),
> +


> + TP_printk("%s.%s %s", __entry->desc->modname,
> + __entry->desc->function, __get_str(msg))
> +);
> +

That TP_printk() is dangerous. How do you know __entry->desc still exists
when reading the buffer?

Is the struct _ddebug permanent? Can it be freed? If so, the above can
easily cause a crash.

-- Steve

2023-11-07 00:45:44

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH v1 06/12] trace: use TP_printk_no_nl in dyndbg:prdbg,devdbg

On Fri, 3 Nov 2023 14:10:05 +0100
Łukasz Bartosik <[email protected]> wrote:

> index ccc5bcb070f9..91dcdbe059c0 100644
> --- a/include/trace/events/dyndbg.h
> +++ b/include/trace/events/dyndbg.h
> @@ -20,20 +20,10 @@ TRACE_EVENT(prdbg,
>
> TP_fast_assign(
> __entry->desc = desc;
> - /*
> - * Each trace entry is printed in a new line.
> - * If the msg finishes with '\n', cut it off
> - * to avoid blank lines in the trace.
> - */
> - if (len > 0 && (text[len - 1] == '\n'))
> - len -= 1;
> -
> memcpy(__get_str(msg), text, len);
> - __get_str(msg)[len] = 0;
> ),
>
> - TP_printk("%s.%s %s", __entry->desc->modname,
> - __entry->desc->function, __get_str(msg))
> + TP_printk_no_nl("%s", __get_str(msg))
> );
>

Instead of adding the TP_printk_no_nl() (Which I still do not like), we
could add a:

__get_str_strip_nl(msg)

That will do the above loop. Which will move the processing to read side
(slow path).

And then we could update libtraceevent to handle that too.

-- Steve

2023-11-24 14:39:18

by Łukasz Bartosik

[permalink] [raw]
Subject: Re: [PATCH v1 07/12] dyndbg: repack struct _ddebug

niedz., 12 lis 2023 o 17:28 Łukasz Bartosik <[email protected]> napisał(a):
>
> pt., 10 lis 2023 o 22:01 <[email protected]> napisał(a):
> >
> > On Fri, Nov 10, 2023 at 7:51 AM Łukasz Bartosik <[email protected]> wrote:
> > >
> > > sob., 4 lis 2023 o 02:49 <[email protected]> napisał(a):
> > > >
> > > > On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
> > > > >
> > > > > From: Jim Cromie <[email protected]>
> > > > >
> > > > > Move the JUMP_LABEL to the top of the struct, since theyre both
> > > > > align(8) and this closes a pahole (unfortunately trading for padding,
> > > > > but still).
> > > > >
> > > > > Signed-off-by: Jim Cromie <[email protected]>
> > > >
> > > > let me add, I havent really tested this, nevermind thorough.
> > > > specifically, I didnt look for any offset dependence on the static-key
> > > > inside their container.
> > > > Conversely, maybe theres a free default or something in there.
> > > >
> > >
> > > Any idea how to properly test the relocation of the key ?
> >
> > I was hoping Jason knew it from memory.
> >
> > I have booted dd-kitchen-sink, which includes it, and it didnt melt the box.
> >
> > I just checked `pahole vmlinux` output for the existence of 0-offset keys.
> > Its not conclusive, cuz im only looking at x86.
> >
> > it does occur, but only for "sub-types".
> >
> > struct static_key_true {
> > struct static_key key; /* 0 16 */
> >
> > /* size: 16, cachelines: 1, members: 1 */
> > /* last cacheline: 16 bytes */
> > };
> > struct static_key_false {
> > struct static_key key; /* 0 16 */
> >
> > /* size: 16, cachelines: 1, members: 1 */
> > /* last cacheline: 16 bytes */
> > };
> > struct static_key_false_deferred {
> > struct static_key_false key; /* 0 16 */
> > ...};
> > struct static_key_mod {
> > struct static_key_mod * next; /* 0 8 */
> > ...};
> > struct static_key_deferred {
> > struct static_key key; /* 0 16 */
>
> I will test it on arm64.

Hi Jim,

I verified that relocation of JUMP_LABEL to the top of the _ddebug
struct does not brak dynamic debug functionality on arm64.
I double checked I had CONFIG_JUMP_LABEL enabled in the kernel config for arm64.
I was able to enable/disable callsites and see debug logs being written.

But if you're concerned there might be issue related to that
relocation on other architectures then let's drop this patch
and I will use pahole instead of padding for location of flags and
trace destination fields.
What do you think ?

Thanks,
Lukasz

2023-11-26 06:01:28

by Jim Cromie

[permalink] [raw]
Subject: Re: [PATCH v1 07/12] dyndbg: repack struct _ddebug

On Fri, Nov 24, 2023 at 7:39 AM Łukasz Bartosik <[email protected]> wrote:
>
> niedz., 12 lis 2023 o 17:28 Łukasz Bartosik <[email protected]> napisał(a):
> >
> > pt., 10 lis 2023 o 22:01 <[email protected]> napisał(a):
> > >
> > > On Fri, Nov 10, 2023 at 7:51 AM Łukasz Bartosik <[email protected]> wrote:
> > > >
> > > > sob., 4 lis 2023 o 02:49 <[email protected]> napisał(a):
> > > > >
> > > > > On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
> > > > > >
> > > > > > From: Jim Cromie <[email protected]>
> > > > > >
> > > > > > Move the JUMP_LABEL to the top of the struct, since theyre both
> > > > > > align(8) and this closes a pahole (unfortunately trading for padding,
> > > > > > but still).
> > > > > >
> > > > > > Signed-off-by: Jim Cromie <[email protected]>
> > > > >
> > > > > let me add, I havent really tested this, nevermind thorough.
> > > > > specifically, I didnt look for any offset dependence on the static-key
> > > > > inside their container.
> > > > > Conversely, maybe theres a free default or something in there.
> > > > >
> > > >
> > > > Any idea how to properly test the relocation of the key ?
> > >
> > > I was hoping Jason knew it from memory.
> > >
> > > I have booted dd-kitchen-sink, which includes it, and it didnt melt the box.
> > >
> > > I just checked `pahole vmlinux` output for the existence of 0-offset keys.
> > > Its not conclusive, cuz im only looking at x86.
> > >
> > > it does occur, but only for "sub-types".
> > >
> > > struct static_key_true {
> > > struct static_key key; /* 0 16 */
> > >
> > > /* size: 16, cachelines: 1, members: 1 */
> > > /* last cacheline: 16 bytes */
> > > };
> > > struct static_key_false {
> > > struct static_key key; /* 0 16 */
> > >
> > > /* size: 16, cachelines: 1, members: 1 */
> > > /* last cacheline: 16 bytes */
> > > };
> > > struct static_key_false_deferred {
> > > struct static_key_false key; /* 0 16 */
> > > ...};
> > > struct static_key_mod {
> > > struct static_key_mod * next; /* 0 8 */
> > > ...};
> > > struct static_key_deferred {
> > > struct static_key key; /* 0 16 */
> >
> > I will test it on arm64.
>
> Hi Jim,
>
> I verified that relocation of JUMP_LABEL to the top of the _ddebug
> struct does not brak dynamic debug functionality on arm64.
> I double checked I had CONFIG_JUMP_LABEL enabled in the kernel config for arm64.
> I was able to enable/disable callsites and see debug logs being written.
>
> But if you're concerned there might be issue related to that
> relocation on other architectures then let's drop this patch
> and I will use pahole instead of padding for location of flags and
> trace destination fields.
> What do you think ?
>


On balance, I think it should go in.
0 - my bias was towards abundance of paranoia
1 - youve done real work to evaluate the actual risk
2 - Jason is on thread, hasnt said WHOA
3 - actual patches have seen some testing (lkp-robot included)
4 - static-keys/jump-labels have been around a long time

One new topic:

Do you have any thoughts or plans wrt self-testing ?

the addition of private instances,
that can be opened & closed, and written to by +T:private_1

would benefit greatly from a test harness to validate it.
so far all Ive done is demo scripts

:-) thanks

> Thanks,
> Lukasz

2023-11-27 22:47:30

by Łukasz Bartosik

[permalink] [raw]
Subject: Re: [PATCH v1 07/12] dyndbg: repack struct _ddebug

niedz., 26 lis 2023 o 07:00 <[email protected]> napisał(a):
>
> On Fri, Nov 24, 2023 at 7:39 AM Łukasz Bartosik <[email protected]> wrote:
> >
> > niedz., 12 lis 2023 o 17:28 Łukasz Bartosik <[email protected]> napisał(a):
> > >
> > > pt., 10 lis 2023 o 22:01 <[email protected]> napisał(a):
> > > >
> > > > On Fri, Nov 10, 2023 at 7:51 AM Łukasz Bartosik <[email protected]> wrote:
> > > > >
> > > > > sob., 4 lis 2023 o 02:49 <[email protected]> napisał(a):
> > > > > >
> > > > > > On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <[email protected]> wrote:
> > > > > > >
> > > > > > > From: Jim Cromie <[email protected]>
> > > > > > >
> > > > > > > Move the JUMP_LABEL to the top of the struct, since theyre both
> > > > > > > align(8) and this closes a pahole (unfortunately trading for padding,
> > > > > > > but still).
> > > > > > >
> > > > > > > Signed-off-by: Jim Cromie <[email protected]>
> > > > > >
> > > > > > let me add, I havent really tested this, nevermind thorough.
> > > > > > specifically, I didnt look for any offset dependence on the static-key
> > > > > > inside their container.
> > > > > > Conversely, maybe theres a free default or something in there.
> > > > > >
> > > > >
> > > > > Any idea how to properly test the relocation of the key ?
> > > >
> > > > I was hoping Jason knew it from memory.
> > > >
> > > > I have booted dd-kitchen-sink, which includes it, and it didnt melt the box.
> > > >
> > > > I just checked `pahole vmlinux` output for the existence of 0-offset keys.
> > > > Its not conclusive, cuz im only looking at x86.
> > > >
> > > > it does occur, but only for "sub-types".
> > > >
> > > > struct static_key_true {
> > > > struct static_key key; /* 0 16 */
> > > >
> > > > /* size: 16, cachelines: 1, members: 1 */
> > > > /* last cacheline: 16 bytes */
> > > > };
> > > > struct static_key_false {
> > > > struct static_key key; /* 0 16 */
> > > >
> > > > /* size: 16, cachelines: 1, members: 1 */
> > > > /* last cacheline: 16 bytes */
> > > > };
> > > > struct static_key_false_deferred {
> > > > struct static_key_false key; /* 0 16 */
> > > > ...};
> > > > struct static_key_mod {
> > > > struct static_key_mod * next; /* 0 8 */
> > > > ...};
> > > > struct static_key_deferred {
> > > > struct static_key key; /* 0 16 */
> > >
> > > I will test it on arm64.
> >
> > Hi Jim,
> >
> > I verified that relocation of JUMP_LABEL to the top of the _ddebug
> > struct does not brak dynamic debug functionality on arm64.
> > I double checked I had CONFIG_JUMP_LABEL enabled in the kernel config for arm64.
> > I was able to enable/disable callsites and see debug logs being written.
> >
> > But if you're concerned there might be issue related to that
> > relocation on other architectures then let's drop this patch
> > and I will use pahole instead of padding for location of flags and
> > trace destination fields.
> > What do you think ?
> >
>
>
> On balance, I think it should go in.
> 0 - my bias was towards abundance of paranoia
> 1 - youve done real work to evaluate the actual risk
> 2 - Jason is on thread, hasnt said WHOA
> 3 - actual patches have seen some testing (lkp-robot included)
> 4 - static-keys/jump-labels have been around a long time
>
> One new topic:
>
> Do you have any thoughts or plans wrt self-testing ?
>

Actually I didn't think about it at all ;). It is not so common
practice to write tests among kernel developers. Addition of trace
instances & events to the dynamic debug is a major change so I see the
value in having it thoroughly tested. That said I'm not saying no to
writing test harness for that purpose but I wonder if there is any
test framework in the kernel that could be reused or is everyone on
their own when it comes to the testing area ?

Thanks,
Lukasz

> the addition of private instances,
> that can be opened & closed, and written to by +T:private_1
>
> would benefit greatly from a test harness to validate it.
> so far all Ive done is demo scripts
>
> :-) thanks
>
> > Thanks,
> > Lukasz