* [PATCH 01/18] dyndbg-docs: eschew file /full/path query in docs
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 08/18] dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100' Jim Cromie
` (7 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
Regarding:
commit 2b6783191da7 ("dynamic_debug: add trim_prefix() to provide source-root relative paths")
commit a73619a845d5 ("kbuild: use -fmacro-prefix-map to make __FILE__ a relative path")
2nd commit broke dynamic-debug's "file $fullpath" query form, but
nobody noticed because 1st commit trimmed prefixes from control-file
output, so the click-copy-pasting of fullpaths into new queries had
ceased; that query form became unused.
Removing the function is cleanest, but it could be useful in
old-compiler corner cases, where __FILE__ still has /full/path,
and it safely does nothing otherwize.
So instead, quietly deprecate "file /full/path" query form, by
removing all /full/paths examples in the docs. I skipped adding a
back-compat note.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index 252e5ef324e5..e011f8907116 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -62,10 +62,10 @@ statements via::
nullarbor:~ # cat <debugfs>/dynamic_debug/control
# filename:lineno [module]function flags format
- /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012"
- /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012"
- /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012"
- /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012"
+ net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012"
+ net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012"
+ net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012"
+ net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012"
...
@@ -85,7 +85,7 @@ the debug statement callsites with any non-default flags::
nullarbor:~ # awk '$3 != "=_"' <debugfs>/dynamic_debug/control
# filename:lineno [module]function flags format
- /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012"
+ net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012"
Command Language Reference
==========================
@@ -158,13 +158,12 @@ func
func svc_tcp_accept
file
- The given string is compared against either the full pathname, the
- src-root relative pathname, or the basename of the source file of
- each callsite. Examples::
+ The given string is compared against either the src-root relative
+ pathname, or the basename of the source file of each callsite.
+ Examples::
file svcsock.c
- file kernel/freezer.c
- file /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c
+ file kernel/freezer.c # ie column 1 of control file
module
The given string is compared against the module name
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 08/18] dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
2019-12-05 21:51 ` [PATCH 01/18] dyndbg-docs: eschew file /full/path query in docs Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 12/18] dyndbg: extend ddebug_parse_flags to accept optional filter-flags Jim Cromie
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
Accept these additional query forms:
echo "file $filestr +_" > control
path/to/file.c:100 # as from control, column 1
path/to/file.c:1-100 # or any legal line-range
path/to/file.c:func_A # as from an editor/browser
path/to/file.c:drm_\* # wildcards still work
path/to/file.c:*_foo # lead wildcard too
1st 2 examples are treated as line-ranges, 3,4 are treated as func's
Doc these changes, and sprinkle in a few extra wild-card examples and
trailing # explanation texts.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 5 +++++
lib/dynamic_debug.c | 20 ++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index e011f8907116..689a30316589 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -156,6 +156,7 @@ func
of each callsite. Example::
func svc_tcp_accept
+ func *recv* # in rfcomm, bluetooth, ping, tcp
file
The given string is compared against either the src-root relative
@@ -164,6 +165,9 @@ file
file svcsock.c
file kernel/freezer.c # ie column 1 of control file
+ file drivers/usb/* # all callsites under it
+ file inode.c:start_* # parse :tail as a func (above)
+ file inode.c:1-100 # parse :tail as a line-range (above)
module
The given string is compared against the module name
@@ -173,6 +177,7 @@ module
module sunrpc
module nfsd
+ module drm* # both drm, drm_kms_helper
format
The given string is searched for in the dynamic debug format
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index f0cf90e672b8..9fa6d4eeae5c 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -322,6 +322,8 @@ static int parse_linerange(struct ddebug_query *query, const char *first)
} else {
query->last_lineno = query->first_lineno;
}
+ vpr_info("parsed line %d-%d\n", query->first_lineno,
+ query->last_lineno);
return 0;
}
@@ -358,6 +360,7 @@ static int ddebug_parse_query(char *words[], int nwords,
{
unsigned int i;
int rc = 0;
+ char *fline;
/* check we have an even number of words */
if (nwords % 2 != 0) {
@@ -374,7 +377,22 @@ static int ddebug_parse_query(char *words[], int nwords,
if (!strcmp(words[i], "func")) {
rc = check_set(&query->function, words[i+1], "func");
} else if (!strcmp(words[i], "file")) {
- rc = check_set(&query->filename, words[i+1], "file");
+ if (check_set(&query->filename, words[i+1], "file"))
+ return -EINVAL;
+
+ /* tail :$info is function or line-range */
+ fline = strchr(query->filename, ':');
+ if (!fline)
+ break;
+ *fline++ = '\0';
+ if (isalpha(*fline) || *fline == '*' || *fline == '?') {
+ /* take as function name */
+ if (check_set(&query->function, fline, "func"))
+ return -EINVAL;
+ } else
+ if (parse_linerange(query, fline))
+ return -EINVAL;
+
} else if (!strcmp(words[i], "module")) {
rc = check_set(&query->module, words[i+1], "module");
} else if (!strcmp(words[i], "format")) {
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 12/18] dyndbg: extend ddebug_parse_flags to accept optional filter-flags
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
2019-12-05 21:51 ` [PATCH 01/18] dyndbg-docs: eschew file /full/path query in docs Jim Cromie
2019-12-05 21:51 ` [PATCH 08/18] dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100' Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 14/16] dyndbg: add inverted-flags, implement filtering on flags Jim Cromie
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
change ddebug_parse_flags to accept /^ filterflags? OP modflags /x, as
well as the currently accepted /^ OP modflags /.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 18 +++++++----
lib/dynamic_debug.c | 30 ++++++++++---------
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index 689a30316589..cdc45dcb3e0c 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -209,13 +209,19 @@ line
line -1605 // the 1605 lines from line 1 to line 1605
line 1600- // all lines from line 1600 to the end of the file
-The flags specification comprises a change operation followed
-by one or more flag characters. The change operation is one
-of the characters::
+Flags Specification::
- - remove the given flags
- + add the given flags
- = set the flags to the given flags
+ flagspec ::= filterflags? OP modflags
+ filterflags ::= flagset
+ modflags ::= flagset
+ flagset ::= ([pfmlt_xyz] | [PFMLT_XYZ])+
+ OP ::= [-+=]
+
+OP: modify callsites per following flagset::
+
+ - remove the following flags
+ + add the following flags
+ = set the flags to the following flags
The flags are::
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 8c62c76badcf..be8299e119ab 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -441,34 +441,36 @@ static int ddebug_read_flags(const char *str, struct flagsettings *f)
}
/*
- * Parse `str' as a flags specification, format [-+=][p]+.
- * Sets up *maskp and *flagsp to be used when changing the
- * flags fields of matched _ddebug's. Returns 0 on success
- * or <0 on error.
+ * Parse `str' as a flags-spec, ie: [pfmlt_]*[-+=][pfmlt_]+
+ * Fills flagsettings provided. Returns 0 on success or <0 on error.
*/
-
static int ddebug_parse_flags(const char *str,
struct flagsettings *mods,
struct flagsettings *filter)
{
int op;
+ char *opp = strpbrk(str, "-+=");
- switch (*str) {
- case '+':
- case '-':
- case '=':
- op = *str++;
- break;
- default:
- pr_err("bad flag-op %c, at start of %s\n", *str, str);
+ if (!opp) {
+ pr_err("no OP given in %s\n", str);
return -EINVAL;
}
+ op = *opp;
vpr_info("op='%c'\n", op);
+ if (opp != str) {
+ /* filterflags precedes OP, grab it */
+ *opp++ = '\0';
+ if (ddebug_read_flags(str, filter))
+ return -EINVAL;
+ str = opp;
+ } else
+ str++;
+
if (ddebug_read_flags(str, mods))
return -EINVAL;
- /* calculate final flags, mask based upon op */
+ /* calculate final mods: flags, mask based upon op */
switch (op) {
case '=':
mods->mask = 0;
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 14/16] dyndbg: add inverted-flags, implement filtering on flags
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
` (2 preceding siblings ...)
2019-12-05 21:51 ` [PATCH 12/18] dyndbg: extend ddebug_parse_flags to accept optional filter-flags Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 14/18] dyndbg: add user-flag, negating-flags, and " Jim Cromie
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
1. Add 3 user-flags [xyz] which work like original [pfmlt] flags, but
have no effect on callsite behavior; they allow marking of arbitrary
sets of callsites. Just adding the flag defs themselves is enough,
they inherit the existing flags mechanics.
2. Add [PFMLT],[XYZ] flags, which invert their counterparts; P===!p etc.
And in ddebug_read_flags():
current code does: [pfmlt_xyz] -> flags
copy it to: [PFMLT_XYZ] -> mask
also disallow both of a pair: ie no 'xX', no true & false.
3. Add filtering ops into ddebug_change(), right after all the
callsite-property selections are complete. These test the callsite's
current flagstate before applying modflags.
Why ?
The 3 new/user flags facilitate batching of changes. By marking
individual callsites with 'xyz', user can compose an arbitrary set of
changes, then activate them together by selecting on 'xyz':
#> echo 'file foo.c +xyz; file bar.c +xyz' > control
#> echo 'xyz+p' > control
These user flags aren't strictly needed, but with them you can avoid
using [fmlt] flags for marking, which would alter logging.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 28 ++++++++++++++--
include/linux/dynamic_debug.h | 3 ++
lib/dynamic_debug.c | 33 ++++++++++++++-----
3 files changed, 54 insertions(+), 10 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index cdc45dcb3e0c..5404e23eeac8 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -231,9 +231,33 @@ The flags are::
m Include module name in the printed message
t Include thread ID in messages not generated from interrupt context
_ No flags are set. (Or'd with others on input)
+ x user flag, to mark callsites into a group
+ y user flag, ...
+ z user flag, ...
-For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only ``p`` flag
-have meaning, other flags ignored.
+Additionally, the flags above have upper-case versions, which invert
+their respective meanings. Their use follows.
+
+Using Filters::
+
+Filter-flags specify an optional additional selector on pr_debug
+callsites; with them you can compose an arbitrary set of callsites, by
+iteratively marking them with ``+xyz``, then enabling them all with
+``xyz+p``.
+
+Filters can also contain upper-case flags, like ``XY``, which select
+only callsites with x&y cleared.
+
+Flagsets cannot contain ``xX`` etc, a flag cannot be true and false.
+
+modflags containing upper-case flags is reserved/undefined for now.
+inverted-flags are currently ignored, usage gets trickier if given
+``-pXy``, it should leave x set.
+
+Notes::
+
+For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only
+``p`` flag has meaning, other flags are ignored.
For display, the flags are preceded by ``=``
(mnemonic: what the flags are currently equal to).
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 802480ea8708..0d7c9a3538b6 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -32,6 +32,9 @@ struct _ddebug {
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4)
+#define _DPRINTK_FLAGS_USR_X (1<<5)
+#define _DPRINTK_FLAGS_USR_Y (1<<6)
+#define _DPRINTK_FLAGS_USR_Z (1<<7)
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 26432f88b329..b2630df0c3a5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -85,13 +85,16 @@ static inline const char *trim_prefix(const char *path)
return path + skip;
}
-static struct { unsigned flag:8; char opt_char; } opt_array[] = {
- { _DPRINTK_FLAGS_PRINT, 'p' },
- { _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
- { _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
- { _DPRINTK_FLAGS_INCL_LINENO, 'l' },
- { _DPRINTK_FLAGS_INCL_TID, 't' },
- { _DPRINTK_FLAGS_NONE, '_' },
+static struct { unsigned flag:8; char opt_char, not_char; } opt_array[] = {
+ { _DPRINTK_FLAGS_PRINT, 'p', 'P' },
+ { _DPRINTK_FLAGS_INCL_MODNAME, 'm', 'M' },
+ { _DPRINTK_FLAGS_INCL_FUNCNAME, 'f', 'F' },
+ { _DPRINTK_FLAGS_INCL_LINENO, 'l', 'L' },
+ { _DPRINTK_FLAGS_INCL_TID, 't', 'T' },
+ { _DPRINTK_FLAGS_NONE, '_', '_' },
+ { _DPRINTK_FLAGS_USR_X, 'x', 'X' },
+ { _DPRINTK_FLAGS_USR_Y, 'y', 'Y' },
+ { _DPRINTK_FLAGS_USR_Z, 'z', 'Z' },
};
/* format a string into buf[] which describes the _ddebug's flags */
@@ -195,6 +198,13 @@ static int ddebug_change(const struct ddebug_query *query,
dp->lineno > query->last_lineno)
continue;
+ /* filter for required flags */
+ if ((dp->flags & filter->flags) != filter->flags)
+ continue;
+ /* filter on prohibited bits */
+ if ((~dp->flags & filter->mask) != filter->mask)
+ continue;
+
nfound++;
newflags = (dp->flags & mods->mask) | mods->flags;
@@ -428,10 +438,17 @@ static int ddebug_read_flags(const char *str, struct flagsettings *f)
if (*str == opt_array[i].opt_char) {
f->flags |= opt_array[i].flag;
break;
+ } else if (*str == opt_array[i].not_char) {
+ f->mask |= opt_array[i].flag;
+ break;
}
}
if (i < 0) {
- pr_err("unknown flag '%c' in \"%s\"\n", *str, str);
+ pr_err("unknown flag '%c'", *str);
+ return -EINVAL;
+ }
+ if (f->flags & f->mask) {
+ pr_err("flag '%c' conflicts with earlier one\n", *str);
return -EINVAL;
}
}
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 14/18] dyndbg: add user-flag, negating-flags, and filtering on flags
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
` (3 preceding siblings ...)
2019-12-05 21:51 ` [PATCH 14/16] dyndbg: add inverted-flags, implement filtering on flags Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 15/16] dyndbg: allow inverted-flag-chars in modflags Jim Cromie
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
1. Add a user-flag [u] which works like original [pfmlt] flags, but
has no effect on callsite behavior; it allows marking of arbitrary
sets of callsites.
2. Add [PFMLTU] flags, which negate their counterparts; P===!p etc.
And in ddebug_read_flags():
current code does: [pfmltu_] -> flags
copy it to: [PFMLTU_] -> mask
also disallow both of a pair: ie no 'pP', no true & false.
3. Add filtering ops into ddebug_change(), right after all the
callsite-property selections are complete. These test the callsite's
current flagstate before applying modflags.
Why ?
The new user flag facilitates batching of changes. By marking
individual callsites with 'u', user can compose an arbitrary set of
changes, then activate them together by selecting on 'u':
#> echo 'file foo.c +u; file bar.c +u' > control
#> echo 'u+p' > control
The user flag isn't strictly needed, but with it you can avoid using
[fmlt] flags for marking, which would alter logging when enabled.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 31 ++++++++++++++++---
include/linux/dynamic_debug.h | 1 +
lib/dynamic_debug.c | 31 ++++++++++++++-----
3 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index cdc45dcb3e0c..9f68062ba316 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -230,16 +230,39 @@ The flags are::
l Include line number in the printed message
m Include module name in the printed message
t Include thread ID in messages not generated from interrupt context
+ u user flag, to mark callsites into a group
_ No flags are set. (Or'd with others on input)
-For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only ``p`` flag
-have meaning, other flags ignored.
+Additionally, the flag-chars ``[pflmtu]`` have negating flag-chars
+``[PFMLTU]``, which invert the meanings above. Their use follows.
+
+Using Filters::
+
+Filter-flags specify an optional additional selector on pr_debug
+callsites; with them you can compose an arbitrary set of callsites, by
+iteratively marking them with ``+u``, then enabling them all with
+``u+p``. You can also use ``fmlt`` flags for this, unless the format
+changes are inconvenient.
+
+Filters can also contain the negating flags, like ``UF``, which select
+only callsites with ``u`` and ``f`` cleared.
+
+Flagsets cannot contain ``pP`` etc, a flag cannot be true and false.
+
+modflags containing upper-case flags is reserved/undefined for now.
+inverted-flags are currently ignored, usage gets trickier if given
+``-pXy``, it should leave x set.
+
+Notes::
+
+For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only
+``p`` flag has meaning, other flags are ignored.
For display, the flags are preceded by ``=``
(mnemonic: what the flags are currently equal to).
-Note the regexp ``^[-+=][flmpt_]+$`` matches a flags specification.
-To clear all flags at once, use ``=_`` or ``-flmpt``.
+Note the regexp ``^[-+=][flmptu_]+$`` matches a flags specification.
+To clear all flags at once, use ``=_`` or ``-flmptu``.
Debug messages during Boot Process
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 802480ea8708..a5d76f8f6b40 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -32,6 +32,7 @@ struct _ddebug {
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4)
+#define _DPRINTK_FLAGS_USR (1<<5)
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 26432f88b329..736895efe17d 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -85,13 +85,14 @@ static inline const char *trim_prefix(const char *path)
return path + skip;
}
-static struct { unsigned flag:8; char opt_char; } opt_array[] = {
- { _DPRINTK_FLAGS_PRINT, 'p' },
- { _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
- { _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
- { _DPRINTK_FLAGS_INCL_LINENO, 'l' },
- { _DPRINTK_FLAGS_INCL_TID, 't' },
- { _DPRINTK_FLAGS_NONE, '_' },
+static struct { unsigned flag:8; char opt_char, not_char; } opt_array[] = {
+ { _DPRINTK_FLAGS_PRINT, 'p', 'P' },
+ { _DPRINTK_FLAGS_INCL_MODNAME, 'm', 'M' },
+ { _DPRINTK_FLAGS_INCL_FUNCNAME, 'f', 'F' },
+ { _DPRINTK_FLAGS_INCL_LINENO, 'l', 'L' },
+ { _DPRINTK_FLAGS_INCL_TID, 't', 'T' },
+ { _DPRINTK_FLAGS_NONE, '_', '_' },
+ { _DPRINTK_FLAGS_USR, 'u', 'U' },
};
/* format a string into buf[] which describes the _ddebug's flags */
@@ -195,6 +196,13 @@ static int ddebug_change(const struct ddebug_query *query,
dp->lineno > query->last_lineno)
continue;
+ /* filter for required flags */
+ if ((dp->flags & filter->flags) != filter->flags)
+ continue;
+ /* filter on prohibited bits */
+ if ((~dp->flags & filter->mask) != filter->mask)
+ continue;
+
nfound++;
newflags = (dp->flags & mods->mask) | mods->flags;
@@ -428,10 +436,17 @@ static int ddebug_read_flags(const char *str, struct flagsettings *f)
if (*str == opt_array[i].opt_char) {
f->flags |= opt_array[i].flag;
break;
+ } else if (*str == opt_array[i].not_char) {
+ f->mask |= opt_array[i].flag;
+ break;
}
}
if (i < 0) {
- pr_err("unknown flag '%c' in \"%s\"\n", *str, str);
+ pr_err("unknown flag '%c'", *str);
+ return -EINVAL;
+ }
+ if (f->flags & f->mask) {
+ pr_err("flag '%c' conflicts with earlier one\n", *str);
return -EINVAL;
}
}
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 15/16] dyndbg: allow inverted-flag-chars in modflags
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
` (4 preceding siblings ...)
2019-12-05 21:51 ` [PATCH 14/18] dyndbg: add user-flag, negating-flags, and " Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 15/18] dyndbg: allow negating flag-chars " Jim Cromie
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
Extend flags modifications to allow [PFMLT_XYZ] inverted flags.
This allows control-queries like:
#> Q () { echo file inode.c $* > control } # to type less
#> Q -P # same as +p
#> Q +X # same as -x
#> Q xyz-P # same as xyz+p
This allows flags in a callsite to be simultaneously set and cleared,
while still starting with the current flagstate (with +- ops).
Generally, you chose -p or +p 1st, then set or clear flags
accordingly.
# enable print on callsites with 'xy'; and re-mark with just 'z'
#> Q xy+pXYz
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
Documentation/admin-guide/dynamic-debug-howto.rst | 8 +++++---
lib/dynamic_debug.c | 6 ++++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index 5404e23eeac8..493e74a14bdd 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -250,9 +250,11 @@ only callsites with x&y cleared.
Flagsets cannot contain ``xX`` etc, a flag cannot be true and false.
-modflags containing upper-case flags is reserved/undefined for now.
-inverted-flags are currently ignored, usage gets trickier if given
-``-pXy``, it should leave x set.
+modflags may contain upper-case flags also, using these lets you
+invert the flag setting implied by the OP; '-pX' means disable
+printing, and mark that callsite with usr-x flag to create a group,
+for optional further manipulation. Generally, '+p' and '-p' is your
+main choice, and use of inverted flags in modflags is rare.
Notes::
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index b2630df0c3a5..82daf95b8f64 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -488,15 +488,17 @@ static int ddebug_parse_flags(const char *str,
/* calculate final mods: flags, mask based upon op */
switch (op) {
+ unsigned int tmp;
case '=':
mods->mask = 0;
break;
case '+':
- mods->mask = ~0U;
+ mods->mask = ~mods->mask;
break;
case '-':
+ tmp = mods->mask;
mods->mask = ~mods->flags;
- mods->flags = 0;
+ mods->flags = tmp;
break;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 15/18] dyndbg: allow negating flag-chars in modflags
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
` (5 preceding siblings ...)
2019-12-05 21:51 ` [PATCH 15/16] dyndbg: allow inverted-flag-chars in modflags Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 21:51 ` [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg Jim Cromie
2019-12-05 21:51 ` [PATCH 18/18] dyndbg-docs: normalize comments in examples Jim Cromie
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
Extend flags modifications to allow [PFMLTU] inverted flags.
This allows control-queries like:
#> Q () { echo file inode.c $* > control } # to type less
#> Q -P # same as +p
#> Q +U # same as -u
#> Q u-P # same as u+p
This allows flags in a callsite to be simultaneously set and cleared,
while still starting with the current flagstate (with +- ops).
Generally, you chose -p or +p 1st, then set or clear flags
accordingly.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
Documentation/admin-guide/dynamic-debug-howto.rst | 10 ++++++----
lib/dynamic_debug.c | 6 ++++--
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index 9f68062ba316..5c170e49121d 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -249,9 +249,11 @@ only callsites with ``u`` and ``f`` cleared.
Flagsets cannot contain ``pP`` etc, a flag cannot be true and false.
-modflags containing upper-case flags is reserved/undefined for now.
-inverted-flags are currently ignored, usage gets trickier if given
-``-pXy``, it should leave x set.
+modflags may contain upper-case flags also, using these lets you
+invert the flag setting implied by the OP; '-pU' means disable
+printing, and mark that callsite with the user-flag to create a group,
+for optional further manipulation. Generally, '+p' and '-p' is your
+main choice, and use of negating flags in modflags is rare.
Notes::
@@ -261,7 +263,7 @@ For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only
For display, the flags are preceded by ``=``
(mnemonic: what the flags are currently equal to).
-Note the regexp ``^[-+=][flmptu_]+$`` matches a flags specification.
+Note the regexp ``/^[-+=][flmptu_]+$/i`` matches a flags specification.
To clear all flags at once, use ``=_`` or ``-flmptu``.
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 736895efe17d..15bb9939df97 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -486,15 +486,17 @@ static int ddebug_parse_flags(const char *str,
/* calculate final mods: flags, mask based upon op */
switch (op) {
+ unsigned int tmp;
case '=':
mods->mask = 0;
break;
case '+':
- mods->mask = ~0U;
+ mods->mask = ~mods->mask;
break;
case '-':
+ tmp = mods->mask;
mods->mask = ~mods->flags;
- mods->flags = 0;
+ mods->flags = tmp;
break;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
` (6 preceding siblings ...)
2019-12-05 21:51 ` [PATCH 15/18] dyndbg: allow negating flag-chars " Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
2019-12-05 22:24 ` Andy Shevchenko
2019-12-05 21:51 ` [PATCH 18/18] dyndbg-docs: normalize comments in examples Jim Cromie
8 siblings, 1 reply; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, Andrew Morton, Kees Cook,
Masahiro Yamada, David S. Miller, Joe Lawrence, Kent Overstreet,
Uladzislau Rezki (Sony),
Andy Shevchenko, Gary Hook, Arnd Bergmann, Mark Rutland,
linux-doc
This rename fixes a subtle usage wrinkle; the __setup() names didn't
match the fake "dyndbg" module parameter used to enable dynamic-printk
callsites in modules. See the last change in Docs for the effect.
It also shortens the "__FILE__:__func__" prefix in dyndbg.verbose
messages, effectively s/dynamic_debug/dyndbg/
This is a 99.9% rename; trim_prefix and debugfs_create_dir arg excepted.
Nonetheless, it also changes both /sys appearances:
bash-5.0# ls -R /sys/kernel/debug/dyndbg/ /sys/module/dyndbg/parameters/
/sys/kernel/debug/dyndbg/:
control
/sys/module/dyndbg/parameters/:
verbose
Finally, paths in docs are ~= s|/dynamic_debug/|/dyndbg/|,
plus the kernel cmdline example tweak cited above.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 50 +++++++++----------
lib/Makefile | 4 +-
lib/{dynamic_debug.c => dyndbg.c} | 4 +-
3 files changed, 29 insertions(+), 29 deletions(-)
rename lib/{dynamic_debug.c => dyndbg.c} (99%)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index 5c170e49121d..d91dbb52721d 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -31,7 +31,7 @@ Dynamic debug has even more useful features:
- module name
- format string
- * Provides a debugfs control file: ``<debugfs>/dynamic_debug/control``
+ * Provides a debugfs control file: ``<debugfs>/dyndbg/control``
which can be read to display the complete list of known debug
statements, to help guide you
@@ -42,16 +42,16 @@ The behaviour of ``pr_debug()``/``dev_dbg()`` are controlled via writing to a
control file in the 'debugfs' filesystem. Thus, you must first mount
the debugfs filesystem, in order to make use of this feature.
Subsequently, we refer to the control file as:
-``<debugfs>/dynamic_debug/control``. For example, if you want to enable
+``<debugfs>/dyndbg/control``. For example, if you want to enable
printing from source file ``svcsock.c``, line 1603 you simply do::
nullarbor:~ # echo 'file svcsock.c line 1603 +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
If you make a mistake with the syntax, the write will fail thus::
nullarbor:~ # echo 'file svcsock.c wtf 1 +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
-bash: echo: write error: Invalid argument
Viewing Dynamic Debug Behaviour
@@ -60,7 +60,7 @@ Viewing Dynamic Debug Behaviour
You can view the currently configured behaviour of all the debug
statements via::
- nullarbor:~ # cat <debugfs>/dynamic_debug/control
+ nullarbor:~ # cat <debugfs>/dyndbg/control
# filename:lineno [module]function flags format
net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012"
net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012"
@@ -72,10 +72,10 @@ statements via::
You can also apply standard Unix text manipulation filters to this
data, e.g.::
- nullarbor:~ # grep -i rdma <debugfs>/dynamic_debug/control | wc -l
+ nullarbor:~ # grep -i rdma <debugfs>/dyndbg/control | wc -l
62
- nullarbor:~ # grep -i tcp <debugfs>/dynamic_debug/control | wc -l
+ nullarbor:~ # grep -i tcp <debugfs>/dyndbg/control | wc -l
42
The third column shows the currently enabled flags for each debug
@@ -83,7 +83,7 @@ statement callsite (see below for definitions of the flags). The
default value, with no flags enabled, is ``=_``. So you can view all
the debug statement callsites with any non-default flags::
- nullarbor:~ # awk '$3 != "=_"' <debugfs>/dynamic_debug/control
+ nullarbor:~ # awk '$3 != "=_"' <debugfs>/dyndbg/control
# filename:lineno [module]function flags format
net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012"
@@ -94,27 +94,27 @@ At the lexical level, a command comprises a sequence of words separated
by spaces or tabs. So these are all equivalent::
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
nullarbor:~ # echo -n ' file svcsock.c line 1603 +p ' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
Command submissions are bounded by a write() system call.
Multiple commands can be written together, separated by ``;`` or ``\n``::
~# echo "func pnpacpi_get_resources +p; func pnp_assign_mem +p" \
- > <debugfs>/dynamic_debug/control
+ > <debugfs>/dyndbg/control
If your query set is big, you can batch them too::
- ~# cat query-batch-file > <debugfs>/dynamic_debug/control
+ ~# cat query-batch-file > <debugfs>/dyndbg/control
Another way is to use wildcards. The match rule supports ``*`` (matches
zero or more characters) and ``?`` (matches exactly one character). For
example, you can match all usb drivers::
- ~# echo "file drivers/usb/* +p" > <debugfs>/dynamic_debug/control
+ ~# echo "file drivers/usb/* +p" > <debugfs>/dyndbg/control
At the syntactical level, a command comprises a sequence of match
specifications, followed by a flags change specification::
@@ -338,7 +338,7 @@ For ``CONFIG_DYNAMIC_DEBUG`` kernels, any settings given at boot-time (or
enabled by ``-DDEBUG`` flag during compilation) can be disabled later via
the debugfs interface if the debug messages are no longer needed::
- echo "module module_name -p" > <debugfs>/dynamic_debug/control
+ echo "module module_name -p" > <debugfs>/dyndbg/control
Examples
========
@@ -347,41 +347,41 @@ Examples
// enable the message at line 1603 of file svcsock.c
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
// enable all the messages in file svcsock.c
nullarbor:~ # echo -n 'file svcsock.c +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
// enable all the messages in the NFS server module
nullarbor:~ # echo -n 'module nfsd +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
// enable all 12 messages in the function svc_process()
nullarbor:~ # echo -n 'func svc_process +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
// disable all 12 messages in the function svc_process()
nullarbor:~ # echo -n 'func svc_process -p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
// enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
nullarbor:~ # echo -n 'format "nfsd: READ" +p' >
- <debugfs>/dynamic_debug/control
+ <debugfs>/dyndbg/control
// enable messages in files of which the paths include string "usb"
- nullarbor:~ # echo -n '*usb* +p' > <debugfs>/dynamic_debug/control
+ nullarbor:~ # echo -n '*usb* +p' > <debugfs>/dyndbg/control
// enable all messages
- nullarbor:~ # echo -n '+p' > <debugfs>/dynamic_debug/control
+ nullarbor:~ # echo -n '+p' > <debugfs>/dyndbg/control
// add module, function to all enabled messages
- nullarbor:~ # echo -n '+mf' > <debugfs>/dynamic_debug/control
+ nullarbor:~ # echo -n '+mf' > <debugfs>/dyndbg/control
// boot-args example, with newlines and comments for readability
Kernel command line: ...
// see whats going on in dyndbg=value processing
- dynamic_debug.verbose=1
+ dyndbg.verbose=1
// enable pr_debugs in 2 builtins, #cmt is stripped
dyndbg="module params +p #cmt ; module sys +p"
// enable pr_debugs in 2 functions in a module loaded later
diff --git a/lib/Makefile b/lib/Makefile
index c5892807e06f..ea4028aa7852 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -15,7 +15,7 @@ KCOV_INSTRUMENT_string.o := n
KCOV_INSTRUMENT_rbtree.o := n
KCOV_INSTRUMENT_list_debug.o := n
KCOV_INSTRUMENT_debugobjects.o := n
-KCOV_INSTRUMENT_dynamic_debug.o := n
+KCOV_INSTRUMENT_dyndbg.o := n
# Early boot use of cmdline, don't instrument it
ifdef CONFIG_AMD_MEM_ENCRYPT
@@ -180,7 +180,7 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o
obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
-obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o
+obj-$(CONFIG_DYNAMIC_DEBUG) += dyndbg.o
obj-$(CONFIG_NLATTR) += nlattr.o
diff --git a/lib/dynamic_debug.c b/lib/dyndbg.c
similarity index 99%
rename from lib/dynamic_debug.c
rename to lib/dyndbg.c
index d056fca96b9d..f410d341841a 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dyndbg.c
@@ -77,7 +77,7 @@ module_param(verbose, int, 0644);
/* Return the path relative to source root */
static inline const char *trim_prefix(const char *path)
{
- int skip = strlen(__FILE__) - strlen("lib/dynamic_debug.c");
+ int skip = strlen(__FILE__) - strlen("lib/dyndbg.c");
if (strncmp(path, __FILE__, skip))
skip = 0; /* prefix mismatch, don't skip */
@@ -1055,7 +1055,7 @@ static int __init dynamic_debug_init_debugfs(void)
if (!ddebug_init_success)
return -ENODEV;
- dir = debugfs_create_dir("dynamic_debug", NULL);
+ dir = debugfs_create_dir("dyndbg", NULL);
debugfs_create_file("control", 0644, dir, NULL, &ddebug_proc_fops);
return 0;
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 18/18] dyndbg-docs: normalize comments in examples
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
` (7 preceding siblings ...)
2019-12-05 21:51 ` [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg Jim Cromie
@ 2019-12-05 21:51 ` Jim Cromie
8 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-12-05 21:51 UTC (permalink / raw)
To: jbaron, gregkh, linux-kernel
Cc: linux, Jim Cromie, Jonathan Corbet, linux-doc
given that:
~# cat batch-of-dyndbg-cmd-queries > /sys/kernel/debug/dyndbg/control
works, and since '#' is a legal comment character accepted
by >control, the syntax is much more like bash than c++.
So replace '//' with '#'.
Someone might copy-paste these examples, lets make them more usable
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
.../admin-guide/dynamic-debug-howto.rst | 51 ++++++++++---------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index d91dbb52721d..33eed4713bb8 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -189,11 +189,11 @@ format
characters (``"``) or single quote characters (``'``).
Examples::
- format svcrdma: // many of the NFS/RDMA server pr_debugs
- format readahead // some pr_debugs in the readahead cache
- format nfsd:\040SETATTR // one way to match a format with whitespace
- format "nfsd: SETATTR" // a neater way to match a format with whitespace
- format 'nfsd: SETATTR' // yet another way to match a format with whitespace
+ format svcrdma: # many of the NFS/RDMA server pr_debugs
+ format readahead # some pr_debugs in the readahead cache
+ format nfsd:\040SETATTR # one way to match a format with whitespace
+ format "nfsd: SETATTR" # a neater way to match a format with whitespace
+ format 'nfsd: SETATTR' # yet another way to match a format with whitespace
line
The given line number or range of line numbers is compared
@@ -204,10 +204,10 @@ line
the first line in the file, an empty last line number means the
last line number in the file. Examples::
- line 1603 // exactly line 1603
- line 1600-1605 // the six lines from line 1600 to line 1605
- line -1605 // the 1605 lines from line 1 to line 1605
- line 1600- // all lines from line 1600 to the end of the file
+ line 1603 # exactly line 1603
+ line 1600-1605 # the six lines from line 1600 to line 1605
+ line -1605 # the 1605 lines from line 1 to line 1605
+ line 1600- # all lines from line 1600 to the end of the file
Flags Specification::
@@ -345,44 +345,47 @@ Examples
::
- // enable the message at line 1603 of file svcsock.c
+ # enable the message at line 1603 of file svcsock.c
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
<debugfs>/dyndbg/control
- // enable all the messages in file svcsock.c
+ # enable all the messages in file svcsock.c
nullarbor:~ # echo -n 'file svcsock.c +p' >
<debugfs>/dyndbg/control
- // enable all the messages in the NFS server module
+ # enable all the messages in the NFS server module
nullarbor:~ # echo -n 'module nfsd +p' >
<debugfs>/dyndbg/control
- // enable all 12 messages in the function svc_process()
+ # enable all 12 messages in the function svc_process()
nullarbor:~ # echo -n 'func svc_process +p' >
<debugfs>/dyndbg/control
- // disable all 12 messages in the function svc_process()
+ # disable all 12 messages in the function svc_process()
nullarbor:~ # echo -n 'func svc_process -p' >
<debugfs>/dyndbg/control
- // enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
+ # enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
nullarbor:~ # echo -n 'format "nfsd: READ" +p' >
<debugfs>/dyndbg/control
- // enable messages in files of which the paths include string "usb"
+ # enable messages in files of which the paths include string "usb"
nullarbor:~ # echo -n '*usb* +p' > <debugfs>/dyndbg/control
- // enable all messages
+ # enable all messages
nullarbor:~ # echo -n '+p' > <debugfs>/dyndbg/control
- // add module, function to all enabled messages
+ # add module, function to all enabled messages
nullarbor:~ # echo -n '+mf' > <debugfs>/dyndbg/control
- // boot-args example, with newlines and comments for readability
- Kernel command line: ...
- // see whats going on in dyndbg=value processing
+ # boot-args example, with newlines and comments for readability
+ # Kernel command line: ...
+
+ # see whats going on in dyndbg=value processing
dyndbg.verbose=1
- // enable pr_debugs in 2 builtins, #cmt is stripped
+
+ # enable pr_debugs in 2 builtins, #cmt is stripped
dyndbg="module params +p #cmt ; module sys +p"
- // enable pr_debugs in 2 functions in a module loaded later
- pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p"
+
+ # enable pr_debugs in 2 functions in a module loaded later
+ pc87360.dyndbg="func *_init_device +p; func *_find +p"
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg
2019-12-05 21:51 ` [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg Jim Cromie
@ 2019-12-05 22:24 ` Andy Shevchenko
2019-12-06 7:49 ` Rasmus Villemoes
0 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2019-12-05 22:24 UTC (permalink / raw)
To: Jim Cromie
Cc: jbaron, Greg Kroah-Hartman, Linux Kernel Mailing List,
Rasmus Villemoes, Jonathan Corbet, Andrew Morton, Kees Cook,
Masahiro Yamada, David S. Miller, Joe Lawrence, Kent Overstreet,
Uladzislau Rezki (Sony),
Andy Shevchenko, Gary Hook, Arnd Bergmann, Mark Rutland,
Linux Documentation List
On Thu, Dec 5, 2019 at 11:54 PM Jim Cromie <jim.cromie@gmail.com> wrote:
>
> This rename fixes a subtle usage wrinkle; the __setup() names didn't
> match the fake "dyndbg" module parameter used to enable dynamic-printk
> callsites in modules. See the last change in Docs for the effect.
>
> It also shortens the "__FILE__:__func__" prefix in dyndbg.verbose
> messages, effectively s/dynamic_debug/dyndbg/
>
> This is a 99.9% rename; trim_prefix and debugfs_create_dir arg excepted.
> Nonetheless, it also changes both /sys appearances:
>
> bash-5.0# ls -R /sys/kernel/debug/dyndbg/ /sys/module/dyndbg/parameters/
> /sys/kernel/debug/dyndbg/:
> control
> /sys/module/dyndbg/parameters/:
Isn't this path a part of ABI?
> verbose
>
> Finally, paths in docs are ~= s|/dynamic_debug/|/dyndbg/|,
> plus the kernel cmdline example tweak cited above.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg
2019-12-05 22:24 ` Andy Shevchenko
@ 2019-12-06 7:49 ` Rasmus Villemoes
2019-12-06 17:33 ` jim.cromie
0 siblings, 1 reply; 13+ messages in thread
From: Rasmus Villemoes @ 2019-12-06 7:49 UTC (permalink / raw)
To: Andy Shevchenko, Jim Cromie
Cc: jbaron, Greg Kroah-Hartman, Linux Kernel Mailing List,
Jonathan Corbet, Andrew Morton, Kees Cook, Masahiro Yamada,
David S. Miller, Joe Lawrence, Kent Overstreet,
Uladzislau Rezki (Sony),
Andy Shevchenko, Gary Hook, Arnd Bergmann, Mark Rutland,
Linux Documentation List
On 05/12/2019 23.24, Andy Shevchenko wrote:
> On Thu, Dec 5, 2019 at 11:54 PM Jim Cromie <jim.cromie@gmail.com> wrote:
>>
>> This rename fixes a subtle usage wrinkle; the __setup() names didn't
>> match the fake "dyndbg" module parameter used to enable dynamic-printk
>> callsites in modules. See the last change in Docs for the effect.
>>
>> It also shortens the "__FILE__:__func__" prefix in dyndbg.verbose
>> messages, effectively s/dynamic_debug/dyndbg/
>>
>> This is a 99.9% rename; trim_prefix and debugfs_create_dir arg excepted.
>> Nonetheless, it also changes both /sys appearances:
>>
>> bash-5.0# ls -R /sys/kernel/debug/dyndbg/ /sys/module/dyndbg/parameters/
>> /sys/kernel/debug/dyndbg/:
>> control
>
>> /sys/module/dyndbg/parameters/:
>
> Isn't this path a part of ABI?
Yeah, I think this is a somewhat dangerous change, and I don't really
see the point.
Unrelated: Jim, if you want these patches picked up eventually, you have
to put akpm on the recipient list (he is on this one, but AFAICT not on
any of the others).
Rasmus
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg
2019-12-06 7:49 ` Rasmus Villemoes
@ 2019-12-06 17:33 ` jim.cromie
0 siblings, 0 replies; 13+ messages in thread
From: jim.cromie @ 2019-12-06 17:33 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Andy Shevchenko, Jason Baron, Greg Kroah-Hartman,
Linux Kernel Mailing List, Jonathan Corbet, Andrew Morton,
Kees Cook, Masahiro Yamada, David S. Miller, Joe Lawrence,
Kent Overstreet, Uladzislau Rezki (Sony),
Andy Shevchenko, Gary Hook, Arnd Bergmann, Mark Rutland,
Linux Documentation List
On Fri, Dec 6, 2019 at 12:49 AM Rasmus Villemoes
<linux@rasmusvillemoes.dk> wrote:
>
> On 05/12/2019 23.24, Andy Shevchenko wrote:
> > On Thu, Dec 5, 2019 at 11:54 PM Jim Cromie <jim.cromie@gmail.com> wrote:
> >
..
> >> /sys/module/dyndbg/parameters/:
> >
> > Isn't this path a part of ABI?
>
> Yeah, I think this is a somewhat dangerous change, and I don't really
> see the point.
OK, I didnt realize this was ABI.
I withdraw that patch, and will fix the following one.
>
> Unrelated: Jim, if you want these patches picked up eventually, you have
> to put akpm on the recipient list (he is on this one, but AFAICT not on
> any of the others).
>
Oof.
GregKH has in the past picked up my dyndbg stuff, and Jason's too
but that was 7 years ago
> Rasmus
thanks,
JIm
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 15/16] dyndbg: allow inverted-flag-chars in modflags
@ 2019-11-27 17:51 Jim Cromie
0 siblings, 0 replies; 13+ messages in thread
From: Jim Cromie @ 2019-11-27 17:51 UTC (permalink / raw)
To: jbaron, linux-kernel; +Cc: linux, greg, Jim Cromie, Jonathan Corbet, linux-doc
Extend flags modifications to allow [PFMLT_XYZ] inverted flags.
This allows control-queries like:
#> Q () { echo file inode.c $* > control } # to type less
#> Q -P # same as +p
#> Q +X # same as -x
#> Q xyz-P # same as xyz+p
This allows flags in a callsite to be simultaneously set and cleared,
while still starting with the current flagstate (with +- ops).
Generally, you chose -p or +p 1st, then set or clear flags
accordingly.
# enable print on callsites with 'xy'; and re-mark with just 'z'
#> Q xy+pXYz
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
Documentation/admin-guide/dynamic-debug-howto.rst | 8 +++++---
lib/dynamic_debug.c | 6 ++++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst
index 5404e23eeac8..493e74a14bdd 100644
--- a/Documentation/admin-guide/dynamic-debug-howto.rst
+++ b/Documentation/admin-guide/dynamic-debug-howto.rst
@@ -250,9 +250,11 @@ only callsites with x&y cleared.
Flagsets cannot contain ``xX`` etc, a flag cannot be true and false.
-modflags containing upper-case flags is reserved/undefined for now.
-inverted-flags are currently ignored, usage gets trickier if given
-``-pXy``, it should leave x set.
+modflags may contain upper-case flags also, using these lets you
+invert the flag setting implied by the OP; '-pX' means disable
+printing, and mark that callsite with usr-x flag to create a group,
+for optional further manipulation. Generally, '+p' and '-p' is your
+main choice, and use of inverted flags in modflags is rare.
Notes::
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index b2630df0c3a5..82daf95b8f64 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -488,15 +488,17 @@ static int ddebug_parse_flags(const char *str,
/* calculate final mods: flags, mask based upon op */
switch (op) {
+ unsigned int tmp;
case '=':
mods->mask = 0;
break;
case '+':
- mods->mask = ~0U;
+ mods->mask = ~mods->mask;
break;
case '-':
+ tmp = mods->mask;
mods->mask = ~mods->flags;
- mods->flags = 0;
+ mods->flags = tmp;
break;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-12-06 17:33 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20191205215151.421926-1-jim.cromie@gmail.com>
2019-12-05 21:51 ` [PATCH 01/18] dyndbg-docs: eschew file /full/path query in docs Jim Cromie
2019-12-05 21:51 ` [PATCH 08/18] dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100' Jim Cromie
2019-12-05 21:51 ` [PATCH 12/18] dyndbg: extend ddebug_parse_flags to accept optional filter-flags Jim Cromie
2019-12-05 21:51 ` [PATCH 14/16] dyndbg: add inverted-flags, implement filtering on flags Jim Cromie
2019-12-05 21:51 ` [PATCH 14/18] dyndbg: add user-flag, negating-flags, and " Jim Cromie
2019-12-05 21:51 ` [PATCH 15/16] dyndbg: allow inverted-flag-chars in modflags Jim Cromie
2019-12-05 21:51 ` [PATCH 15/18] dyndbg: allow negating flag-chars " Jim Cromie
2019-12-05 21:51 ` [PATCH 17/18] dyndbg: rename dynamic_debug to dyndbg Jim Cromie
2019-12-05 22:24 ` Andy Shevchenko
2019-12-06 7:49 ` Rasmus Villemoes
2019-12-06 17:33 ` jim.cromie
2019-12-05 21:51 ` [PATCH 18/18] dyndbg-docs: normalize comments in examples Jim Cromie
2019-11-27 17:51 [PATCH 15/16] dyndbg: allow inverted-flag-chars in modflags Jim Cromie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).