diff mbox series

[09/63] dyndbg: reduce verbose/debug clutter

Message ID 20250125064619.8305-10-jim.cromie@gmail.com (mailing list archive)
State New, archived
Headers show
Series Fix CONFIG_DRM_USE_DYNAMIC_DEBUG=y | expand

Commit Message

Jim Cromie Jan. 25, 2025, 6:45 a.m. UTC
currently, for verbose=3, these are logged (blank lines for clarity):

 dyndbg: query 0: "class DRM_UT_CORE +p" mod:*
 dyndbg: split into words: "class" "DRM_UT_CORE" "+p"

 dyndbg: op='+'
 dyndbg: flags=0x1
 dyndbg: *flagsp=0x1 *maskp=0xffffffff

 dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=...
 dyndbg: no matches for query
 dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=...
 dyndbg: processed 1 queries, with 0 matches, 0 errs

That is excessive, so this patch:
 - shrinks 3 lines of 2nd stanza to single line
 - drops 1st 2 lines of 3rd stanza
   3rd line is like 1st, with result, not procedure.
   2nd line is just status, retold in 4th, with more info.

New output:

 dyndbg: query 0: "class DRM_UT_CORE +p" mod:*
 dyndbg: split into words: "class" "DRM_UT_CORE" "+p"
 dyndbg: op='+' flags=0x1 *flagsp=0x1 *maskp=0xffffffff
 dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=...
 dyndbg: processed 1 queries, with 0 matches, 0 errs

no functional change.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Louis Chauvet Feb. 25, 2025, 2:10 p.m. UTC | #1
Le 25/01/2025 à 07:45, Jim Cromie a écrit :
> currently, for verbose=3, these are logged (blank lines for clarity):
> 
>   dyndbg: query 0: "class DRM_UT_CORE +p" mod:*
>   dyndbg: split into words: "class" "DRM_UT_CORE" "+p"
> 
>   dyndbg: op='+'
>   dyndbg: flags=0x1
>   dyndbg: *flagsp=0x1 *maskp=0xffffffff
> 
>   dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=...
>   dyndbg: no matches for query
>   dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=...
>   dyndbg: processed 1 queries, with 0 matches, 0 errs
> 
> That is excessive, so this patch:
>   - shrinks 3 lines of 2nd stanza to single line
>   - drops 1st 2 lines of 3rd stanza
>     3rd line is like 1st, with result, not procedure.
>     2nd line is just status, retold in 4th, with more info.
> 
> New output:
> 
>   dyndbg: query 0: "class DRM_UT_CORE +p" mod:*
>   dyndbg: split into words: "class" "DRM_UT_CORE" "+p"
>   dyndbg: op='+' flags=0x1 *flagsp=0x1 *maskp=0xffffffff
>   dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=...
>   dyndbg: processed 1 queries, with 0 matches, 0 errs
> 
> no functional change.
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>

> ---
>   lib/dynamic_debug.c | 14 +++-----------
>   1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 9adcb9fa7110..1b2fb6502e61 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -266,9 +266,6 @@ static int ddebug_change(const struct ddebug_query *query,
>   	}
>   	mutex_unlock(&ddebug_lock);
>   
> -	if (!nfound && verbose)
> -		pr_info("no matches for query\n");
> -
>   	return nfound;
>   }
>   
> @@ -501,7 +498,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
>   		pr_err("bad flag-op %c, at start of %s\n", *str, str);
>   		return -EINVAL;
>   	}
> -	v3pr_info("op='%c'\n", op);
>   
>   	for (; *str ; ++str) {
>   		for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
> @@ -515,7 +511,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
>   			return -EINVAL;
>   		}
>   	}
> -	v3pr_info("flags=0x%x\n", modifiers->flags);
>   
>   	/* calculate final flags, mask based upon op */
>   	switch (op) {
> @@ -531,7 +526,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
>   		modifiers->flags = 0;
>   		break;
>   	}
> -	v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask);
> +	v3pr_info("op='%c' flags=0x%x maskp=0x%x\n", op, modifiers->flags, modifiers->mask);
>   
>   	return 0;
>   }
> @@ -541,7 +536,7 @@ static int ddebug_exec_query(char *query_string, const char *modname)
>   	struct flag_settings modifiers = {};
>   	struct ddebug_query query = {};
>   #define MAXWORDS 9
> -	int nwords, nfound;
> +	int nwords;
>   	char *words[MAXWORDS];
>   
>   	nwords = ddebug_tokenize(query_string, words, MAXWORDS);
> @@ -559,10 +554,7 @@ static int ddebug_exec_query(char *query_string, const char *modname)
>   		return -EINVAL;
>   	}
>   	/* actually go and implement the change */
> -	nfound = ddebug_change(&query, &modifiers);
> -	vpr_info_dq(&query, nfound ? "applied" : "no-match");
> -
> -	return nfound;
> +	return ddebug_change(&query, &modifiers);
>   }
>   
>   /* handle multiple queries in query string, continue on error, return
diff mbox series

Patch

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 9adcb9fa7110..1b2fb6502e61 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -266,9 +266,6 @@  static int ddebug_change(const struct ddebug_query *query,
 	}
 	mutex_unlock(&ddebug_lock);
 
-	if (!nfound && verbose)
-		pr_info("no matches for query\n");
-
 	return nfound;
 }
 
@@ -501,7 +498,6 @@  static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
 		pr_err("bad flag-op %c, at start of %s\n", *str, str);
 		return -EINVAL;
 	}
-	v3pr_info("op='%c'\n", op);
 
 	for (; *str ; ++str) {
 		for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
@@ -515,7 +511,6 @@  static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
 			return -EINVAL;
 		}
 	}
-	v3pr_info("flags=0x%x\n", modifiers->flags);
 
 	/* calculate final flags, mask based upon op */
 	switch (op) {
@@ -531,7 +526,7 @@  static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)
 		modifiers->flags = 0;
 		break;
 	}
-	v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask);
+	v3pr_info("op='%c' flags=0x%x maskp=0x%x\n", op, modifiers->flags, modifiers->mask);
 
 	return 0;
 }
@@ -541,7 +536,7 @@  static int ddebug_exec_query(char *query_string, const char *modname)
 	struct flag_settings modifiers = {};
 	struct ddebug_query query = {};
 #define MAXWORDS 9
-	int nwords, nfound;
+	int nwords;
 	char *words[MAXWORDS];
 
 	nwords = ddebug_tokenize(query_string, words, MAXWORDS);
@@ -559,10 +554,7 @@  static int ddebug_exec_query(char *query_string, const char *modname)
 		return -EINVAL;
 	}
 	/* actually go and implement the change */
-	nfound = ddebug_change(&query, &modifiers);
-	vpr_info_dq(&query, nfound ? "applied" : "no-match");
-
-	return nfound;
+	return ddebug_change(&query, &modifiers);
 }
 
 /* handle multiple queries in query string, continue on error, return