[PATCH 65/65] dyndbg: improve vpr_cm_info msg format

Jim Cromie jim.cromie at gmail.com
Wed Oct 2 18:18:31 UTC 2024


Adjust the debug-msg format to print class-names[0..last], and
[base,+len].  This is more useful to the user than the old format.

[root at v6 b0-dd]# modprobe test_dynamic_debug_submod
[   18.864962] dyndbg: loaded classmap: test_dynamic_debug [16..24] V0..V7
[   18.865046] dyndbg:  found kp:p_level_num =0x0
[   18.865048] dyndbg:   mapped to: test_dynamic_debug [16..24] V0..V7
[   18.865164] dyndbg:   p_level_num: lvl:0 bits:0x0
[   18.865217] dyndbg: loaded classmap: test_dynamic_debug [0..10] D2_CORE..D2_DRMRES
[   18.865297] dyndbg:  found kp:p_disjoint_bits =0x0
[   18.865298] dyndbg:   mapped to: test_dynamic_debug [0..10] D2_CORE..D2_DRMRES
[   18.865424] dyndbg:   p_disjoint_bits: classbits: 0x0
[   18.865472] dyndbg: module:test_dynamic_debug attached 2 classmaps
[   18.865533] dyndbg:  23 debug prints in module test_dynamic_debug
[   18.866558] dyndbg: loaded classmap: test_dynamic_debug_submod [16..24] V0..V7
[   18.866698] dyndbg:  found kp:p_level_num =0x0
[   18.866699] dyndbg:   mapped to: test_dynamic_debug_submod [16..24] V0..V7
[   18.866865] dyndbg:   p_level_num: lvl:0 bits:0x0
[   18.866926] dyndbg: loaded classmap: test_dynamic_debug_submod [0..10] D2_CORE..D2_DRMRES
[   18.867026] dyndbg:  found kp:p_disjoint_bits =0x0
[   18.867027] dyndbg:   mapped to: test_dynamic_debug_submod [0..10] D2_CORE..D2_DRMRES
[   18.867193] dyndbg:   p_disjoint_bits: classbits: 0x0
[   18.867255] dyndbg: module:test_dynamic_debug_submod attached 2 classmap uses
[   18.867351] dyndbg:  23 debug prints in module test_dynamic_debug_submod
[root at v6 b0-dd]#

[   17.181897] dyndbg: loaded class: module:test_dynamic_debug [0..10] D2_CORE..

Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
 lib/dynamic_debug.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 3281eb7383b1..a5fb8ea87148 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1173,11 +1173,12 @@ static const char * const ddebug_classmap_typenames[] = {
 	"DISJOINT_BITS", "LEVEL_NUM"
 };
 
-#define vpr_cm_info(cm_p, msg_p, ...) ({				\
+#define vpr_cm_info(cm_p, msg_fmt, ...) ({				\
 	struct ddebug_class_map const *_cm = cm_p;			\
-	v2pr_info(msg_p " module:%s base:%d len:%d type:%s\n", ##__VA_ARGS__, \
-		  _cm->mod_name, _cm->base, _cm->length,		\
-		  ddebug_classmap_typenames[_cm->map_type]);		\
+	v2pr_info(msg_fmt " [%d..%d] %s..%s\n", ##__VA_ARGS__,		\
+		  _cm->base, _cm->base + _cm->length,			\
+		  _cm->class_names[0],					\
+		  _cm->class_names[_cm->length - 1]);			\
 	})
 
 static void ddebug_sync_classbits(const struct kernel_param *kp, const char *modname)
@@ -1216,7 +1217,7 @@ static void ddebug_match_apply_kparam(const struct kernel_param *kp,
 
 	if (map == dcp->map) {
 		v2pr_info(" found kp:%s =0x%lx", kp->name, *dcp->bits);
-		vpr_cm_info(map, "  mapped to:");
+		vpr_cm_info(map, "  mapped to: %s", modnm);
 		ddebug_sync_classbits(kp, modnm);
 	}
 }
@@ -1228,14 +1229,14 @@ static void ddebug_apply_params(const struct ddebug_class_map *cm, const char *m
 	int i;
 
 	if (cm->mod) {
-		vpr_cm_info(cm, "loaded class:");
+		vpr_cm_info(cm, "loaded classmap: %s", modnm);
 		/* ifdef protects the cm->mod->kp deref */
 		for (i = 0, kp = cm->mod->kp; i < cm->mod->num_kp; i++, kp++)
 			ddebug_match_apply_kparam(kp, cm, modnm);
 	}
 #endif
 	if (!cm->mod) {
-		vpr_cm_info(cm, "builtin class:");
+		vpr_cm_info(cm, "builtin classmap: %s", modnm);
 		for (kp = __start___param; kp < __stop___param; kp++)
 			ddebug_match_apply_kparam(kp, cm, modnm);
 	}
-- 
2.46.2



More information about the Intel-gfx-trybot mailing list