Skip to contentSkip to conversation

DRM_USE_DYNAMIC_DEBUG regression

RFC PATCH Superseded Jim Cromie 3 participants 26 messages Dec 6, 2022 – Jan 13, 2023

Subsystems (9)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Jim Cromie

author maintainer
#0 lore raw

cover DRM_USE_DYNAMIC_DEBUG regression

Hi everyone,

DRM_USE_DYNAMIC_DEBUG=y has a regression on rc-*

Regression is due to a chicken-egg problem loading modules; on modprobe i915, drm is loaded 1st, and drm.debug is set. When drm_debug_enabled() tested __drm_debug at runtime, that just worked.

But with DRM_USE_DYNAMIC_DEBUG=y, the runtime test is replaced with a post-load enablement of drm_dbg/dyndbg callsites (static-keys), via dyndbg's callback on __drm_debug. Since all drm-drivers need drm.ko, it is loaded 1st, then drm.debug=X is applied, then drivers load, but too late for drm_dbgs to be enabled.

STATUS

For all-loadable drm,i915,amdgpu configs, it almost works, but propagating drm.debug to dependent modules doesnt actually apply, though the motions are there. This is not the problem I want to chase here.

The more basic trouble is:

For builtin drm + helpers, things are broken pretty early; at the beginning of dynamic_debug_init(). As the ddebug_sanity() commit-msg describes in some detail, the records added by _USE fail to reference the struct ddebug_class_map created and exported by _DEFINE, but get separate addresses to "other" data that segv's when used as the expected pointer. FWIW, the pointer val starts with "revi".

OVERVIEW

DECLARE_DYNDBG_CLASSMAP is broken: it is one-size-fits-all-poorly. It muddles the distinction between a (single) definition, and multiple references. Something exported should suffice.

The core of this patchset splits it into:

DYNDBG_CLASSMAP_DEFINE used once per subsystem to define each classmap
DYNDBG_CLASSMAP_USE declare dependence on a DEFINEd classmap

This makes the weird coordinated-changes-by-identical-classmaps "feature" unnecessary; the DEFINE can export the var, and USE refers to the exported var.

So this patchset adds another section: __dyndbg_class_refs.

It is like __dyndbg_classes; it is scanned under ddebug_add_module(), and attached to each module's ddebug_table. Once attached, it can be used like classes to validate and apply class FOO >control queries.

It also maps the class user -> definer explicitly, so that when the module is loaded, the section scan can find the kernel-param that is wired to dyndbg's kparam-callback, and apply its state-var, forex:
__drm_debug to the just loaded helper/driver module.

Theres plenty to address Im sure.

Jim Cromie (17):
test-dyndbg: fixup CLASSMAP usage error
test-dyndbg: show that DEBUG enables prdbgs at compiletime
dyndbg: fix readback value on LEVEL_NAMES interfaces
dyndbg: replace classmap list with a vector
dyndbg: make ddebug_apply_class_bitmap more selective
dyndbg: dynamic_debug_init - use pointer inequality, not strcmp
dyndbg: drop NUM_TYPE_ARRAY
dyndbg: reduce verbose/debug clutter
dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with
DYNDBG_CLASSMAP(_DEFINE|_USE)
dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE)
dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args
dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements
drm_print: fix stale macro-name in comment
dyndbg: unwrap __ddebug_add_module inner function NOTYET
dyndbg: ddebug_sanity()
dyndbg: mess-w-dep-class
dyndbg: miss-on HACK

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  14 +-
 drivers/gpu/drm/display/drm_dp_helper.c |  14 +-
 drivers/gpu/drm/drm_crtc_helper.c       |  14 +-
 drivers/gpu/drm/drm_print.c             |  22 +--
 drivers/gpu/drm/i915/i915_params.c      |  14 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  14 +-
 include/asm-generic/vmlinux.lds.h       |   3 +
 include/drm/drm_print.h                 |   6 +-
 include/linux/dynamic_debug.h           |  57 ++++--
 include/linux/map.h                     |  54 ++++++
 kernel/module/main.c                    |   2 +
 lib/dynamic_debug.c                     | 240 +++++++++++++++++++-----
 lib/test_dynamic_debug.c                |  47 ++---
 13 files changed, 344 insertions(+), 157 deletions(-)
 create mode 100644 include/linux/map.h
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

RFC PATCH 1/17 test-dyndbg: fixup CLASSMAP usage error

more careful reading of test output reveals:

lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =pmf "doing categories\n" lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =p "LOW msg\n" class:MID lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_cats =p "MID msg\n" class:HI lib/test_dynamic_debug.c:107 [test_dynamic_debug]do_cats =_ "HI msg\n" class unknown, _id:13

That last line is wrong, the HI class is declared.

But the enum's 1st val (explicitly initialized) was wrong; it must be _base, not _base+1 (a DECLARE_DYNDBG_CLASSMAP param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. Basically, I coded in an error, and forgot to verify it and remove it.

RFC:

This patch fixes a bad usage of DEFINE_DYNDBG_CLASSMAP(), showing that it is too error-prone. As noted in test-dynamic-debug.c comments:

* Using the CLASSMAP api:
* - classmaps must have corresponding enum
* - enum symbols must match/correlate with class-name strings in the map.
* - base must equal enum's 1st value
* - multiple maps must set their base to share the 0-62 class_id space !!
* (build-bug-on tips welcome)

Those shortcomings could largely be fixed with a __stringify_list (which doesn't exist) used in DEFINE_DYNAMIC_DEBUG_CLASSMAP(), on __VA_ARGS__ a 2nd time. Then, DRM would pass DRM_UT_* ; all the categories, in order, and not their stringifications, which created all the usage complications above.

---
 lib/test_dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_dynamic_debug.c +1 -1
index 8dd250ad022b..a01f0193a419 100644
@@ -75,7 +75,7 @@ DD_SYS_WRAP(disjoint_bits, p);
 DD_SYS_WRAP(disjoint_bits, T);
 
 /* symbolic input, independent bits */
-enum cat_disjoint_names { LOW = 11, MID, HI };
+enum cat_disjoint_names { LOW = 10, MID, HI };
 DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10,
 			"LOW", "MID", "HI");
 DD_SYS_WRAP(disjoint_names, p);
Signature · 1 line
2.38.1
author maintainer
#2 lore raw

RFC PATCH 2/17 test-dyndbg: show that DEBUG enables prdbgs at compiletime

In reply to Jim Cromie

Dyndbg is required to enable prdbgs at compile-time if DEBUG is defined. Show this works; add the defn to test_dynamic_debug.c, and manually inspect/verify its effect at module load:

[   15.292810] dyndbg: module:test_dynamic_debug attached 4 classes
[   15.293189] dyndbg:  32 debug prints in module test_dynamic_debug
[   15.293715] test_dd: init start
[   15.293716] test_dd: doing categories
[   15.293716] test_dd: LOW msg
...
[   15.293733] test_dd: L6 msg
[   15.293733] test_dd: L7 msg
[   15.293733] test_dd: init done

NOTES:

As is observable above, define DEBUG enables all prdbgs, including those in mod_init-fn, and more notably, the "class"d ones (callsites with non-default class_ids).

This differs from the >control interface, which in order to properly protect a client's class'd prdbgs, requires a "class FOO" in queries to change them. Note that the DEBUG is in the module source file.

This yields an occaisional surprise; the following disables all the compile-time enabled plain prdbgs, but leaves the class'd ones enabled.

:#> modprobe test_dynamic_debug dyndbg==_

---
 lib/test_dynamic_debug.c | 2 ++
 1 file changed, 2 insertions(+)
lib/test_dynamic_debug.c +2 -0
index a01f0193a419..9d48689dc0ab 100644
@@ -8,6 +8,8 @@
 
 #define pr_fmt(fmt) "test_dd: " fmt
 
+#define DEBUG
+
 #include <linux/module.h>
 
 /* run tests by reading or writing sysfs node: do_prints */
Signature · 1 line
2.38.1
author maintainer
#3 lore raw

RFC PATCH 3/17 dyndbg: fix readback value on LEVEL_NAMES interfaces

In reply to Jim Cromie

Since sysfs knobs should generally read-back what was just written (unless theres a good reason to do otherwise), this result (using test_dynamic_debug.ko) is suboptimal:

echo L3 > p_level_names
cat p_level_names
4

Fix this with a -1 offset in LEVEL_NAMES readback.

NOTE:

Calling this a BUG is debatable, and the above is slightly inaccurate wrt "read-back"; whats written is a LEVEL_NAME (a string). Whats read back is an integer, giving the 'edge' of the 'low-pass-filter'

The actual test looks like:

RTT: L4 -> p_level_names : 4 :: DOING: levels 4-1

[   17.509594] dyndbg: "L4" > p_level_names:0x4
[   17.510115] dyndbg: apply: 0x1f to: 0xf
[   17.510506] dyndbg: query 0: "class L4 +p" mod:*
[   17.510992] dyndbg: split into words: "class" "L4" "+p"
[   17.511521] dyndbg: op='+'
[   17.511811] dyndbg: flags=0x1
[   17.512127] dyndbg: *flagsp=0x1 *maskp=0xffffffff
[   17.512604] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=L4
[   17.513414] dyndbg: applied: func="" file="" module="" format="" lineno=0-0 class=L4
[   17.514204] dyndbg: processed 1 queries, with 1 matches, 0 errs
[   17.514809] dyndbg: bit_4: 1 matches on class: L4 -> 0x1f
[   17.515355] dyndbg: p_level_names: changed bit-4: "L4" f->1f
[   17.515933] dyndbg: total matches: 1

crap [[ 5 != 4 ]]

This -1 adjustment just reports the edge consistently with its input-mapping.

Fixes b9400852c080 (dyndbg: add drm.debug style (drm/parameters/debug) bitmap support)
---
 lib/dynamic_debug.c | 2 ++
 1 file changed, 2 insertions(+)
lib/dynamic_debug.c +2 -0
index 009f2ead09c1..48ca1387a409 100644
@@ -794,6 +794,8 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp)
 		return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits);
 
 	case DD_CLASS_TYPE_LEVEL_NAMES:
+		return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl - 1);
+
 	case DD_CLASS_TYPE_LEVEL_NUM:
 		return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl);
 	default:
Signature · 1 line
2.38.1
author maintainer
#4 lore raw

RFC PATCH 4/17 dyndbg: replace classmap list with a vector

In reply to Jim Cromie

Classmaps are stored/linked in a section/array, but are each added to the module's ddebug_table.maps list-head.

This is unnecessary; even when ddebug_attach_classmap() is handling the builtin section (with classmaps for multiple builtin modules), its contents are ordered, so a module's possibly multiple classmaps will be consecutive in the section, and could be treated as a vector/block, since both start-addy and subrange length are in the ddebug_info arg.

So this changes:

struct ddebug_class_map drops list link.

struct ddebug_table drops the maps list-head, and gets: classes & num_classes for the start-addy, and length. num_classes is placed to improve struct packing.

The loading: in ddebug_attach_module_classes(), replace the for-the-modname list-add loop, with a forloop that finds the module's subrange (start,length) of matching classmaps within the possibly builtin classmaps vector, and saves those to the ddebug_table.

The reading/using: change list-foreach loops in ddebug_class_name() & ddebug_find_valid_class() to walk the array from start to length.

Also:
Move #define __outvar up, above an added use in a fn-prototype. Simplify ddebug_attach_module_classes args, ref has both addy,len.

This isn't technically a bugfix, but IMO simplifies later fixes for the chicken-egg post-init enablement regression.

---
 include/linux/dynamic_debug.h |  1 -
 lib/dynamic_debug.c           | 61 ++++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 30 deletions(-)
include/linux/dynamic_debug.h +0 -1
index 41682278d2e8..bf47bcfad8e6 100644
@@ -81,7 +81,6 @@ enum class_map_type {
 };
 
 struct ddebug_class_map {
-	struct list_head link;
 	struct module *mod;
 	const char *mod_name;	/* needed for builtins */
 	const char **class_names;
lib/dynamic_debug.c +32 -29

119 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#5 lore raw

RFC PATCH 5/17 dyndbg: make ddebug_apply_class_bitmap more selective

In reply to Jim Cromie

ddebug_apply_class_bitmap() currently applies the class settings to all modules, make it more selective, by adding query_module param.

The fn now calls ddebug_exec_queries(query, NULL), where NULL is query_modname wildcard ("*" does the same). So just expose the parameter, and alter users to explicitly pass the wildcard value.

This allows its more selective use later; for propagating drm.debug settings to dependent modules when/just-after they load. Doing this propagation with "*" is fine, but would match with all previously loaded modules, creating more dynamic_debug.verbose=3 logging activity.

No functional change.

---

after modprobe i915, heres the module dependencies, though not all on drm.debug.

bash-5.2# lsmod

Module                  Size  Used by
i915                 3133440  0
drm_buddy              20480  1 i915
ttm                    90112  1 i915
i2c_algo_bit           16384  1 i915
video                  61440  1 i915
wmi                    32768  1 video
drm_display_helper    200704  1 i915
drm_kms_helper        208896  2 drm_display_helper,i915
drm                   606208  5 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm
cec                    57344  2 drm_display_helper,i915
---
 lib/dynamic_debug.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
lib/dynamic_debug.c +7 -6
index fd5296dbb40f..5d609ff0d559 100644
@@ -600,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname)
 
 /* apply a new bitmap to the sys-knob's current bit-state */
 static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp,
-				     unsigned long *new_bits, unsigned long *old_bits)
+				     unsigned long *new_bits, unsigned long *old_bits,
+				     const char *query_modname)
 {
 #define QUERY_SIZE 128
 	char query[QUERY_SIZE];
@@ -617,7 +618,7 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp,
 		snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi],
 			 test_bit(bi, new_bits) ? '+' : '-', dcp->flags);
 
-		ct = ddebug_exec_queries(query, NULL);
+		ct = ddebug_exec_queries(query, query_modname);
 		matches += ct;
 
 		v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi,
@@ -678,7 +679,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa
 				continue;
 			}
 			curr_bits ^= BIT(cls_id);
-			totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits);
+			totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL);
 			*dcp->bits = curr_bits;
 			v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id,
 				  map->class_names[cls_id]);
@@ -688,7 +689,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa
 			old_bits = CLASSMAP_BITMASK(*dcp->lvl);
 			curr_bits = CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 ));
 
-			totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits);
+			totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL);
 			*dcp->lvl = (cls_id + (wanted ? 1 : 0));
 			v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id,
 				  map->class_names[cls_id], old_bits, curr_bits);
@@ -751,7 +752,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp)
 			inrep &= CLASSMAP_BITMASK(map->length);
 		}
 		v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp));
-		totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits);
+		totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL);
 		*dcp->bits = inrep;
 		break;
 	case DD_CLASS_TYPE_LEVEL_NUM:
@@ -764,7 +765,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp)
 		old_bits = CLASSMAP_BITMASK(*dcp->lvl);
 		new_bits = CLASSMAP_BITMASK(inrep);
 		v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp));
-		totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits);
+		totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, NULL);
 		*dcp->lvl = inrep;
 		break;
 	default:
Signature · 1 line
2.38.1
author maintainer
#6 lore raw

RFC PATCH 6/17 dyndbg: dynamic_debug_init - use pointer inequality, not strcmp

In reply to Jim Cromie

dynamic_debug_init() currently uses strcmp to find the module boundaries in the builtin _ddebug[] table.

The table is filled by the linker; for its content, pointer inequality works, is faster, and communicates the data properties more tightly.

---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +1 -1
index 5d609ff0d559..a0dc681cd215 100644
@@ -1410,7 +1410,7 @@ static int __init dynamic_debug_init(void)
 
 	for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) {
 
-		if (strcmp(modname, iter->modname)) {
+		if (modname != iter->modname) {
 			mod_ct++;
 			di.num_descs = mod_sites;
 			di.descs = iter_mod_start;
Signature · 1 line
2.38.1
author maintainer
#7 lore raw

RFC PATCH 7/17 dyndbg: drop NUM_TYPE_ARRAY

In reply to Jim Cromie

ARRAY_SIZE works here, since array decl is complete.

---
 include/linux/dynamic_debug.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/linux/dynamic_debug.h +1 -3
index bf47bcfad8e6..81b643ab7f6e 100644
@@ -104,11 +104,9 @@ struct ddebug_class_map {
 		.mod_name = KBUILD_MODNAME,				\
 		.base = _base,						\
 		.map_type = _maptype,					\
-		.length = NUM_TYPE_ARGS(char*, __VA_ARGS__),		\
+		.length = ARRAY_SIZE(_var##_classnames),		\
 		.class_names = _var##_classnames,			\
 	}
-#define NUM_TYPE_ARGS(eltype, ...)				\
-        (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype))
 
 /* encapsulate linker provided built-in (or module) dyndbg data */
 struct _ddebug_info {
Signature · 1 line
2.38.1
author maintainer
#8 lore raw

RFC PATCH 8/17 dyndbg: reduce verbose/debug clutter

In reply to Jim Cromie

currently, for verbose=3, this is logged:

[ 3832.333424] dyndbg: parsed: func="" file="" module="amdgpu" format="" lineno=0-0 class=DRM_UT_PRIME
[ 3832.333888] dyndbg: no matches for query
[ 3832.334093] dyndbg: no-match: func="" file="" module="amdgpu" format="" lineno=0-0 class=DRM_UT_PRIME
[ 3832.334570] dyndbg: processed 1 queries, with 0 matches, 0 errs

This patch removes 2nd & 3rd lines;
3 differs from 1 only by status
2 is just status, retold in 4, with more info.

---
 lib/dynamic_debug.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
lib/dynamic_debug.c +2 -8
index a0dc681cd215..445f25ef2461 100644
@@ -265,9 +265,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;
 }
 
@@ -536,7 +533,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);
@@ -554,10 +551,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
Signature · 1 line
2.38.1
author maintainer
#9 lore raw

RFC PATCH 9/17 dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with DYNDBG_CLASSMAP(_DEFINE|_USE)

In reply to Jim Cromie

DECLARE_DYNDBG_CLASSMAPs job was to allow modules to declare the debug classes/categories they want dyndbg to >control on their behalf. Its args give the class-names, their mapping to class_ids, and the sysfs interface style (usually a class-bitmap). Modules wanting a drm.debug style knob need to create the kparam, and call module_param_cb() to wire the sysfs node to the classmap. DRM does this is in drm_print.c

In DRM, multiple modules declare identical DRM_UT_* classmaps, so that the class'd prdbgs are modified across those modules in a coordinated way across the subsystem, by either explicit class DRM_UT_* queries to

Quoted 1 line

control, or by writes to /sys/module/drm/parameters/debug (drm.debug)

This coordination-by-identical-declarations is weird, so this patch splits the macro into _DEFINE and _USE flavors. This distinction follows the "define-once, declare-many-uses" principle, so it improves the api; _DEFINE is used once to specify the classmap, and multiple users _USE the single definition explicitly.

Currently the latter just reuses the former, and still needs all the same args, but that can be tuned later; the _DEFINE can initialize an (extern/global) struct classmap, and _USE can, well use/reference that struct.

Also wrap DYNDBG_CLASSMAP_USEs with ifdef DRM_USE_DYNAMIC_DEBUG to balance with the one around drm_print's use of DYNDBG_CLASSMAP_DEFINE.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  4 +++-
 drivers/gpu/drm/display/drm_dp_helper.c |  4 +++-
 drivers/gpu/drm/drm_crtc_helper.c       |  4 +++-
 drivers/gpu/drm/drm_print.c             |  2 +-
 drivers/gpu/drm/i915/i915_params.c      |  4 +++-
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  4 +++-
 include/linux/dynamic_debug.h           | 20 ++++++++++++----
 lib/test_dynamic_debug.c                | 32 ++++++++++++-------------
 8 files changed, 48 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
index bf2d50c8c92a..0075184b5d93 100644
@@ -188,7 +188,8 @@ int amdgpu_vcnfw_log;
 
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
-DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_CORE",
 			"DRM_UT_DRIVER",
 			"DRM_UT_KMS",
@@ -199,6 +200,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_LEASE",
 			"DRM_UT_DP",
 			"DRM_UT_DRMRES");
+#endif
 
 struct amdgpu_mgpu_info mgpu_info = {
 	.mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),
drivers/gpu/drm/display/drm_dp_helper.c +3 -1
index 16565a0a5da6..8fa7a88299e7 100644
@@ -41,7 +41,8 @@
 
 #include "drm_dp_helper_internal.h"
 
-DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_CORE",
 			"DRM_UT_DRIVER",
 			"DRM_UT_KMS",
@@ -52,6 +53,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_LEASE",
 			"DRM_UT_DP",
 			"DRM_UT_DRMRES");
+#endif
 
 struct dp_aux_backlight {
 	struct backlight_device *base;
drivers/gpu/drm/drm_crtc_helper.c +3 -1
index 7d86020b5244..2f747c9c8f60 100644
@@ -51,7 +51,8 @@
 
 #include "drm_crtc_helper_internal.h"
 
-DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_CORE",
 			"DRM_UT_DRIVER",
 			"DRM_UT_KMS",
@@ -62,6 +63,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_LEASE",
 			"DRM_UT_DP",
 			"DRM_UT_DRMRES");
+#endif
 
 /**
  * DOC: overview
drivers/gpu/drm/drm_print.c +1 -1
index 5b93c11895bb..4b697e18238d 100644
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat
 module_param_named(debug, __drm_debug, ulong, 0600);
 #else
 /* classnames must match vals of enum drm_debug_category */
-DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_CORE",
 			"DRM_UT_DRIVER",
 			"DRM_UT_KMS",
drivers/gpu/drm/i915/i915_params.c +3 -1
index d1e4d528cb17..b5b2542ae364 100644
@@ -29,7 +29,8 @@
 #include "i915_params.h"
 #include "i915_drv.h"
 
-DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_CORE",
 			"DRM_UT_DRIVER",
 			"DRM_UT_KMS",
@@ -40,6 +41,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_LEASE",
 			"DRM_UT_DP",
 			"DRM_UT_DRMRES");
+#endif
 
 #define i915_param_named(name, T, perm, desc) \
 	module_param_named(name, i915_modparams.name, T, perm); \
drivers/gpu/drm/nouveau/nouveau_drm.c +3 -1
index fd99ec0f4257..2963cf5b0807 100644
@@ -71,7 +71,8 @@
 #include "nouveau_svm.h"
 #include "nouveau_dmem.h"
 
-DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_CORE",
 			"DRM_UT_DRIVER",
 			"DRM_UT_KMS",
@@ -82,6 +83,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
 			"DRM_UT_LEASE",
 			"DRM_UT_DP",
 			"DRM_UT_DRMRES");
+#endif
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
 static char *nouveau_config;
include/linux/dynamic_debug.h +16 -4
index 81b643ab7f6e..1cdfd62fd2e4 100644
@@ -56,7 +56,7 @@ struct _ddebug {
 #endif
 } __attribute__((aligned(8)));
 
-enum class_map_type {
+enum ddebug_class_map_type {
 	DD_CLASS_TYPE_DISJOINT_BITS,
 	/**
 	 * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit.
@@ -86,17 +86,19 @@ struct ddebug_class_map {
 	const char **class_names;
 	const int length;
 	const int base;		/* index of 1st .class_id, allows split/shared space */
-	enum class_map_type map_type;
+	enum ddebug_class_map_type map_type;
 };
 
 /**
- * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module
+ * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the
+ * debug classes used in this module.  This tells dyndbg the authorized
+ * classnames it should manipulate.
  * @_var:   a struct ddebug_class_map, passed to module_param_cb
  * @_type:  enum class_map_type, chooses bits/verbose, numeric/symbolic
  * @_base:  offset of 1st class-name. splits .class_id space
  * @classes: class-names used to control class'd prdbgs
  */
-#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...)		\
+#define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...)		\
 	static const char *_var##_classnames[] = { __VA_ARGS__ };	\
 	static struct ddebug_class_map __aligned(8) __used		\
 		__section("__dyndbg_classes") _var = {			\
@@ -108,6 +110,16 @@ struct ddebug_class_map {
 		.class_names = _var##_classnames,			\
 	}
 
+/*
+ * refer to the classmap instantiated once, by the macro above.  This
+ * distinguishes the multiple users of drm.debug from the single
+ * definition, allowing them to specialize.  ATM its a pass-thru, but
+ * it should help regularize the admittedly wierd sharing by identical
+ * definitions.
+ */
+#define DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...)		\
+	DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__)
+
 /* encapsulate linker provided built-in (or module) dyndbg data */
 struct _ddebug_info {
 	struct _ddebug *descs;
lib/test_dynamic_debug.c +16 -16
index 9d48689dc0ab..4ae01f7fa920 100644
@@ -62,38 +62,38 @@ enum cat_disjoint_bits {
 	D2_LEASE,
 	D2_DP,
 	D2_DRMRES };
-DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"D2_CORE",
-			"D2_DRIVER",
-			"D2_KMS",
-			"D2_PRIME",
-			"D2_ATOMIC",
-			"D2_VBL",
-			"D2_STATE",
-			"D2_LEASE",
-			"D2_DP",
-			"D2_DRMRES");
+DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0,
+		       "D2_CORE",
+		       "D2_DRIVER",
+		       "D2_KMS",
+		       "D2_PRIME",
+		       "D2_ATOMIC",
+		       "D2_VBL",
+		       "D2_STATE",
+		       "D2_LEASE",
+		       "D2_DP",
+		       "D2_DRMRES");
 DD_SYS_WRAP(disjoint_bits, p);
 DD_SYS_WRAP(disjoint_bits, T);
 
 /* symbolic input, independent bits */
 enum cat_disjoint_names { LOW = 10, MID, HI };
-DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10,
-			"LOW", "MID", "HI");
+DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10,
+		       "LOW", "MID", "HI");
 DD_SYS_WRAP(disjoint_names, p);
 DD_SYS_WRAP(disjoint_names, T);
 
 /* numeric verbosity, V2 > V1 related */
 enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 };
-DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14,
+DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14,
 		       "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7");
 DD_SYS_WRAP(level_num, p);
 DD_SYS_WRAP(level_num, T);
 
 /* symbolic verbosity */
 enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 };
-DECLARE_DYNDBG_CLASSMAP(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22,
-			"L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7");
+DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22,
+		       "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7");
 DD_SYS_WRAP(level_names, p);
 DD_SYS_WRAP(level_names, T);
 
Signature · 1 line
2.38.1
author maintainer
#10 lore raw

RFC PATCH 10/17 dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE)

In reply to Jim Cromie

Now that the DECLARE_DYNDBG_CLASSMAP macro has been split into DYNDBG_CLASSMAP_DEFINE and DYNDBG_CLASSMAP_USE variants, lets differentiate them according to their separate jobs.

Dyndbg's existing __dyndbg_classes[] section does:

. catalogs the classmaps defined by the module (or builtin modules) . authorizes dyndbg to >control those class'd prdbgs for the module.

This patch adds __dyndbg_class_refs[] section:

. catalogs references/uses of the above classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . maps the client module to classmap definitions
this allows dyndbg to propagate drm.debug to the client module.

The distinction of the 2 roles yields 2 gains:

It follows the define-once-declare-elsewhere pattern that K&R gave us, dumping the weird coordinated-changes-by-identical-classmaps API.

It should help solve the chicken-egg problem that drm.debug-on-dyndbg has; the _USEr module must propagate the drm.debug setting once the using module has loaded.

The new DYNDBG_CLASSMAP macros add records to the sections:

DYNDBG_CLASSMAP_DEFINE:
invoked by drm_print, just once per sub-system. defines the classmap, names "DRM_UT_*", maps to class_id's authorizes dyndbg to exert >control
populates __dyndbg_classes[] "section", __used. exports the classmap.

DYNDBG_CLASSMAP_USE:
invoked by modules using classmaps defined & exported elsewhere populates __dyndbg_class_refs[] "section", __used. maps client-module name to the extern'd classmap.
no client-name yet, but will need it.

also:

struct ddebug_info gets 2 new fields to encapsulate the new section:
class_refs, num_class_refs.
set by dynamic_debug_init() for builtins.
or by kernel/module/main:load_info() for loadable modules.

. struct ddebug_class_user
contains: user-module-name, ref to classmap-defn
dyndbg finds drm-driver's use of a classmap, gets/applies its settings

. struct ddebug_class_map gets .knob ptr to ddebug_class_param.
compiled null, init'd under ddebug_add_module() allows finding drm.debug setting.

. vmlinux.lds.h additions: linker symbols, KEEP for new section

dynamic_debug.c:

ddebug_attach_module_classes():
as before
foreach __dyndbg_classes: ddebug_find_kparam(classmap*)

ddebug_attach_client_module_classes():
foreach __dyndbg_class_refs: ddebug_param_load_dependent_class(classmap*) called after list-add to ddebug-tables.

ddebug_load_dependent_class():

This applies >controls to the module, it needs the module to be present in the ddebug-tables list so that ddebug_change can apply the changes to it. So in ddebug_add_module, call 2nd fn *after* adding the ddebug_table to the list.

ddebug_find_kparam(classmap*):

Finds the kernel-param / sysfs-node that controls the classmap, by verifying that dyndbg's kparam-ops are used by the kparam. The found kparams arg is our ddebug_class_param, and has a ref to the state-var under the sysfs-node.

ddebug_match_attach_kparam():

tests that kparam.ops == dyndbg's, then casts arg to ddebug_class_param, and tests modnames for equality.

ddebug_param_load_dependent_class(struct ddebug_class_user*):

Called on class_refs entries, these classmaps have already been seen by ddebug_find_kparam() which has wired the classmap.knob to the kparam. So this fn just calls ddebug_apply_class_bitmap() on the state-var.

ddebug_find_valid_class():

This helps ddebug_change(), doing the search over classmaps, looking for the class given to >control. So now it searches over __dyndbg_class_refs[] after __dyndbg_classes[].

Thats the theory anyway. things are still broken (differently) for both builtins and loadables. For loadables, the >control is applied, but doesnt alter any callsites.

---
 include/asm-generic/vmlinux.lds.h |   3 +
 include/linux/dynamic_debug.h     |  41 ++++++---
 kernel/module/main.c              |   2 +
 lib/dynamic_debug.c               | 137 +++++++++++++++++++++++++++---
 4 files changed, 157 insertions(+), 26 deletions(-)
include/asm-generic/vmlinux.lds.h +3 -0
index 3dc5824141cd..7100701fb68c 100644
@@ -363,6 +363,9 @@
 	__start___dyndbg_classes = .;					\
 	KEEP(*(__dyndbg_classes))					\
 	__stop___dyndbg_classes = .;					\
+	__start___dyndbg_class_refs = .;				\
+	KEEP(*(__dyndbg_class_refs))					\
+	__stop___dyndbg_class_refs = .;					\
 	__start___dyndbg = .;						\
 	KEEP(*(__dyndbg))						\
 	__stop___dyndbg = .;						\
include/linux/dynamic_debug.h +28 -13

68 lines not on this page · raw message

kernel/module/main.c +2 -0
index d02d39c7174e..ee4f85a3b8f0 100644
@@ -2111,6 +2111,8 @@ static int find_module_sections(struct module *mod, struct load_info *info)
 					sizeof(*info->dyndbg.descs), &info->dyndbg.num_descs);
 	info->dyndbg.classes = section_objs(info, "__dyndbg_classes",
 					sizeof(*info->dyndbg.classes), &info->dyndbg.num_classes);
+	info->dyndbg.class_refs = section_objs(info, "__dyndbg_class_refs",
+					sizeof(*info->dyndbg.class_refs), &info->dyndbg.num_class_refs);
 
 	return 0;
 }
lib/dynamic_debug.c +124 -13

226 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#11 lore raw

RFC PATCH 11/17 dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args

In reply to Jim Cromie

Drop macro args after _var. Since DYNDBG_CLASSMAP_USE no longer forwards to DYNDBG_CLASSMAP_DEFINE, it doesn't need those args to forward. Keep only the _var arg, which is the extern'd struct classmap with all the class info.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +---------
 drivers/gpu/drm/display/drm_dp_helper.c | 12 +---------
 drivers/gpu/drm/drm_crtc_helper.c       | 12 +---------
 drivers/gpu/drm/i915/i915_params.c      | 12 +---------
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 12 +---------
 include/linux/dynamic_debug.h           | 30 ++++++++++++++-----------
 6 files changed, 22 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -11
index 0075184b5d93..7bcc22ef5d49 100644
@@ -189,17 +189,7 @@ int amdgpu_vcnfw_log;
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
-DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"DRM_UT_CORE",
-			"DRM_UT_DRIVER",
-			"DRM_UT_KMS",
-			"DRM_UT_PRIME",
-			"DRM_UT_ATOMIC",
-			"DRM_UT_VBL",
-			"DRM_UT_STATE",
-			"DRM_UT_LEASE",
-			"DRM_UT_DP",
-			"DRM_UT_DRMRES");
+DYNDBG_CLASSMAP_USE(drm_debug_classes);
 #endif
 
 struct amdgpu_mgpu_info mgpu_info = {
drivers/gpu/drm/display/drm_dp_helper.c +1 -11
index 8fa7a88299e7..3bc188cb1116 100644
@@ -42,17 +42,7 @@
 #include "drm_dp_helper_internal.h"
 
 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
-DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"DRM_UT_CORE",
-			"DRM_UT_DRIVER",
-			"DRM_UT_KMS",
-			"DRM_UT_PRIME",
-			"DRM_UT_ATOMIC",
-			"DRM_UT_VBL",
-			"DRM_UT_STATE",
-			"DRM_UT_LEASE",
-			"DRM_UT_DP",
-			"DRM_UT_DRMRES");
+DYNDBG_CLASSMAP_USE(drm_debug_classes);
 #endif
 
 struct dp_aux_backlight {
drivers/gpu/drm/drm_crtc_helper.c +1 -11
index 2f747c9c8f60..5fb83336b015 100644
@@ -52,17 +52,7 @@
 #include "drm_crtc_helper_internal.h"
 
 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
-DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"DRM_UT_CORE",
-			"DRM_UT_DRIVER",
-			"DRM_UT_KMS",
-			"DRM_UT_PRIME",
-			"DRM_UT_ATOMIC",
-			"DRM_UT_VBL",
-			"DRM_UT_STATE",
-			"DRM_UT_LEASE",
-			"DRM_UT_DP",
-			"DRM_UT_DRMRES");
+DYNDBG_CLASSMAP_USE(drm_debug_classes);
 #endif
 
 /**
drivers/gpu/drm/i915/i915_params.c +1 -11
index b5b2542ae364..e959d0384ead 100644
@@ -30,17 +30,7 @@
 #include "i915_drv.h"
 
 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
-DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"DRM_UT_CORE",
-			"DRM_UT_DRIVER",
-			"DRM_UT_KMS",
-			"DRM_UT_PRIME",
-			"DRM_UT_ATOMIC",
-			"DRM_UT_VBL",
-			"DRM_UT_STATE",
-			"DRM_UT_LEASE",
-			"DRM_UT_DP",
-			"DRM_UT_DRMRES");
+DYNDBG_CLASSMAP_USE(drm_debug_classes);
 #endif
 
 #define i915_param_named(name, T, perm, desc) \
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -11
index 2963cf5b0807..609edeb2a117 100644
@@ -72,17 +72,7 @@
 #include "nouveau_dmem.h"
 
 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
-DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"DRM_UT_CORE",
-			"DRM_UT_DRIVER",
-			"DRM_UT_KMS",
-			"DRM_UT_PRIME",
-			"DRM_UT_ATOMIC",
-			"DRM_UT_VBL",
-			"DRM_UT_STATE",
-			"DRM_UT_LEASE",
-			"DRM_UT_DP",
-			"DRM_UT_DRMRES");
+DYNDBG_CLASSMAP_USE(drm_debug_classes);
 #endif
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
include/linux/dynamic_debug.h +17 -13
index dabbe1a9180c..0088fc354c98 100644
@@ -92,13 +92,15 @@ struct ddebug_class_map {
 };
 
 /**
- * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the
- * debug classes used in this module.  This tells dyndbg the authorized
- * classnames it should manipulate.
- * @_var:   a struct ddebug_class_map, passed to module_param_cb
+ * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module.
+ * @_var:   name of the classmap, exported for other modules coordinated use.
  * @_type:  enum class_map_type, chooses bits/verbose, numeric/symbolic
  * @_base:  offset of 1st class-name. splits .class_id space
- * @classes: class-names used to control class'd prdbgs
+ * @classes: enum-map - symbol names are "classnames", vals are .class_ids
+ *
+ * @classes vals are _ddebug.class_ids used in the module, the symbol
+ * names are stringified; they authorize "class FOO" to >control.
+ * Connection to a kernel-param is done separately.
  */
 #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...)		\
 	const char *_var##_classnames[] = { __VA_ARGS__ };		\
@@ -118,16 +120,18 @@ struct ddebug_class_user {
 	struct ddebug_class_map *map;
 };
 /**
- * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module.
- * This lets dyndbg initialize the dependent module's prdbgs from the
- * other module's controlling sysfs node.
+ * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere.
+ * @_var: name of the exported classmap
+ *
+ * This registers the module's use of another module's classmap defn,
+ * allowing dyndbg to find the controlling kparam, and propagate its
+ * settings to the dependent module being loaded.
  */
-#define DYNDBG_CLASSMAP_USE(_var, ...)					\
-	DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user),	\
-			     __VA_ARGS__)
-#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...)				\
+#define DYNDBG_CLASSMAP_USE(_var)					\
+	DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user))
+#define DYNDBG_CLASSMAP_USE_(_var, _uname)				\
 	extern struct ddebug_class_map _var[];				\
-	static struct ddebug_class_user __used				\
+	struct ddebug_class_user __used					\
 	__section("__dyndbg_class_refs") _uname = {			\
 		.user_mod_name = KBUILD_MODNAME,			\
 		.map = _var,						\
Signature · 1 line
2.38.1
author maintainer
#12 lore raw

RFC PATCH 12/17 dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements

In reply to Jim Cromie

patch 1 in this series fixed a CLASSMAP usage error, this improves the api so that misuse is less likely.

changes here:

0- Add William Swanson's public domain map macro:
https://github.com/swansontec/map-macro/blob/master/map.h
this makes 1 possible.

1- classnames were formerly specified as strings: "DRM_UT_CORE"
now they are the actual enum const symbols: DRM_UT_CORE
direct use of symbols is tighter, more comprehensible by tools, grep

2- drop _base arg.
_base was the value of the 1st classname
that is now available due to 1, no need to require it 2x

So take _base out of the API/kdoc. Note that the macro impl keeps the _base arg so that it can be used to set classmap.base, but reuses it in the MAP-stringify _base, __VA_ARGS__ expression.

Also cleanup the API usage comment in test_dynamic_debug.c, and since comments in test-code might not be noticed, restate that here.

Using the CLASSMAP api:

- class-specifications are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc.
their values define bit positions to drm.debug (as before)

- they are stringified and accepted at >control
echo class DRM_UT_CORE +p >control

- multiple class-maps must share the per-module: 0-62 class_id space (by setting initial enum values to non-overlapping subranges)

todo: fixup the 'i' prefix, a quick/dirty avoidance of MAP.

NOTE: test_dynamic_debug.c also has this helper macro to wire a classmap to a drm.debug style parameter; its easier to just use it as a model/template as needed, rather than try to make it general enough to be an official API helper.

 define DD_SYS_WRAP(_model, _flags)					\
	static unsigned long bits_##_model;				\
	static struct ddebug_class_param _flags##_model = {		\
		.bits = &bits_##_model,					\
		.flags = #_flags,					\
		.map = &map_##_model,					\
	};								\
	module_param_cb(_flags##_##_model, &param_ops_dyndbg_classes, &_flags##_model, 0600)
---
 drivers/gpu/drm/drm_print.c   | 22 +++++++-------
 include/drm/drm_print.h       |  1 +
 include/linux/dynamic_debug.h | 17 ++++++-----
 include/linux/map.h           | 54 +++++++++++++++++++++++++++++++++++
 lib/test_dynamic_debug.c      | 43 ++++++++++++++--------------
 5 files changed, 95 insertions(+), 42 deletions(-)
 create mode 100644 include/linux/map.h
drivers/gpu/drm/drm_print.c +11 -11
index 4b697e18238d..07c25241e8cc 100644
@@ -56,17 +56,17 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat
 module_param_named(debug, __drm_debug, ulong, 0600);
 #else
 /* classnames must match vals of enum drm_debug_category */
-DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
-			"DRM_UT_CORE",
-			"DRM_UT_DRIVER",
-			"DRM_UT_KMS",
-			"DRM_UT_PRIME",
-			"DRM_UT_ATOMIC",
-			"DRM_UT_VBL",
-			"DRM_UT_STATE",
-			"DRM_UT_LEASE",
-			"DRM_UT_DP",
-			"DRM_UT_DRMRES");
+DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS,
+		       DRM_UT_CORE,
+		       DRM_UT_DRIVER,
+		       DRM_UT_KMS,
+		       DRM_UT_PRIME,
+		       DRM_UT_ATOMIC,
+		       DRM_UT_VBL,
+		       DRM_UT_STATE,
+		       DRM_UT_LEASE,
+		       DRM_UT_DP,
+		       DRM_UT_DRMRES);
 
 static struct ddebug_class_param drm_debug_bitmap = {
 	.bits = &__drm_debug,
include/drm/drm_print.h +1 -0
index a44fb7ef257f..6a27e8f26770 100644
@@ -333,6 +333,7 @@ static inline bool drm_debug_enabled_raw(enum drm_debug_category category)
 	})
 
 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
+//extern struct ddebug_class_map drm_debug_classes[];
 /*
  * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets
  * a descriptor, and only enabled callsites are reachable.  They use
include/linux/dynamic_debug.h +8 -9
index 0088fc354c98..6f53a687cb32 100644
@@ -7,6 +7,7 @@
 #endif
 
 #include <linux/build_bug.h>
+#include <linux/map.h>
 
 /*
  * An instance of this structure is created in a special
@@ -92,18 +93,16 @@ struct ddebug_class_map {
 };
 
 /**
- * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module.
- * @_var:   name of the classmap, exported for other modules coordinated use.
- * @_type:  enum class_map_type, chooses bits/verbose, numeric/symbolic
- * @_base:  offset of 1st class-name. splits .class_id space
- * @classes: enum-map - symbol names are "classnames", vals are .class_ids
+ * DYNDBG_CLASSMAP_DEFINE - define the debug classes used in this module.
+ * This tells dyndbg what debug classes it should control for the client.
  *
- * @classes vals are _ddebug.class_ids used in the module, the symbol
- * names are stringified; they authorize "class FOO" to >control.
- * Connection to a kernel-param is done separately.
+ * @_var:    struct ddebug_class_map, as passed to module_param_cb
+ * @_type:   enum ddebug_class_map_type, chooses bits/verbose, numeric/symbolic
+ * @classes: enum class values used in module, such as: DRM_UT_*
  */
 #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...)		\
-	const char *_var##_classnames[] = { __VA_ARGS__ };		\
+	const char *_var##_classnames[] = {				\
+		iMAP_LIST(__stringify, _base, __VA_ARGS__) };		\
 	struct ddebug_class_map __aligned(8) __used			\
 		__section("__dyndbg_classes") _var = {			\
 		.mod = THIS_MODULE,					\
include/linux/map.h new file +54 -0

54 lines not on this page · raw message

lib/test_dynamic_debug.c +21 -22

70 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#13 lore raw

RFC PATCH 13/17 drm_print: fix stale macro-name in comment

In reply to Jim Cromie

Cited commit uses stale macro name, fix this, and explain better.

When DRM_USE_DYNAMIC_DEBUG=y, DYNDBG_CLASSMAP_DEFINE() maps DRM_UT_* onto BITs in drm.debug. This still uses enum drm_debug_category, but it is somewhat indirect, with the ordered set of DRM_UT_* enum-vals. This requires that the macro args: DRM_UT_* list must be kept in sync and in order.

Fixes f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.")

---
. emphasize ABI non-change despite enum val change - Jani Nikula . reorder to back of patchset to follow API name changes.

---
 include/drm/drm_print.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/drm/drm_print.h +4 -1
index 6a27e8f26770..7695ba31b3a4 100644
@@ -276,7 +276,10 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
  *
  */
 enum drm_debug_category {
-	/* These names must match those in DYNAMIC_DEBUG_CLASSBITS */
+	/*
+	 * Keep DYNDBG_CLASSMAP_DEFINE args in sync with changes here,
+	 * the enum-values define BIT()s in drm.debug, so are ABI.
+	 */
 	/**
 	 * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c,
 	 * drm_memory.c, ...
Signature · 1 line
2.38.1
#14 lore raw

Re: [RFC PATCH 13/17] drm_print: fix stale macro-name in comment

Quoted 10 lines · Jim Cromie

Cited commit uses stale macro name, fix this, and explain better.

When DRM_USE_DYNAMIC_DEBUG=y, DYNDBG_CLASSMAP_DEFINE() maps DRM_UT_* onto BITs in drm.debug. This still uses enum drm_debug_category, but it is somewhat indirect, with the ordered set of DRM_UT_* enum-vals. This requires that the macro args: DRM_UT_* list must be kept in sync and in order.

Fixes f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.")

Should I land this already?
-Daniel

Quoted 26 lines

---
. emphasize ABI non-change despite enum val change - Jani Nikula . reorder to back of patchset to follow API name changes.

---
 include/drm/drm_print.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/drm/drm_print.h +4 -1
index 6a27e8f26770..7695ba31b3a4 100644
@@ -276,7 +276,10 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
  *
  */
 enum drm_debug_category {
-	/* These names must match those in DYNAMIC_DEBUG_CLASSBITS */
+	/*
+	 * Keep DYNDBG_CLASSMAP_DEFINE args in sync with changes here,
+	 * the enum-values define BIT()s in drm.debug, so are ABI.
+	 */
 	/**
 	 * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c,
 	 * drm_memory.c, ...
Signature · 1 line
2.38.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
author maintainer
#15 lore raw

RFC PATCH 14/17 dyndbg: unwrap __ddebug_add_module inner function NOTYET

In reply to Jim Cromie

The inner func has a base arg which is unused in the body, so theres no point in having the inner fn. Its one-time purpose was subsumed into the ddebug_info record, which is used in dynamic_debug_init() as a cursor to load the builtin _ddebug[] table.

TODO: cited commit gives another reason for base, to provide an index in support of de-duplicating column data. Refresh that patchset to see if its still true.

Fixes 6afa31514977 ("dyndbg: unwrap __ddebug_add_module inner function")
---
 lib/dynamic_debug.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
lib/dynamic_debug.c +3 -9
index 45b8414fa130..02f36c553835 100644
@@ -1329,8 +1329,7 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct
  * Allocate a new ddebug_table for the given module
  * and add it to the global list.
  */
-static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base,
-			       const char *modname)
+int ddebug_add_module(struct _ddebug_info *di, const char *modname)
 {
 	struct ddebug_table *dt;
 
@@ -1372,11 +1371,6 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base,
 	return 0;
 }
 
-int ddebug_add_module(struct _ddebug_info *di, const char *modname)
-{
-	return __ddebug_add_module(di, 0, modname);
-}
-
 /* helper for ddebug_dyndbg_(boot|module)_param_cb */
 static int ddebug_dyndbg_param_cb(char *param, char *val,
 				const char *modname, int on_err)
@@ -1519,7 +1513,7 @@ static int __init dynamic_debug_init(void)
 			mod_ct++;
 			di.num_descs = mod_sites;
 			di.descs = iter_mod_start;
-			ret = __ddebug_add_module(&di, i - mod_sites, modname);
+			ret = ddebug_add_module(&di, modname);
 			if (ret)
 				goto out_err;
 
@@ -1530,7 +1524,7 @@ static int __init dynamic_debug_init(void)
 	}
 	di.num_descs = mod_sites;
 	di.descs = iter_mod_start;
-	ret = __ddebug_add_module(&di, i - mod_sites, modname);
+	ret = ddebug_add_module(&di, modname);
 	if (ret)
 		goto out_err;
 
Signature · 1 line
2.38.1
author maintainer
#16 lore raw

RFC PATCH 15/17 dyndbg: ddebug_sanity()

In reply to Jim Cromie

It appears that, at least for builtin drm,i915 loadable amdgpu, data in the class_refs section is not properly linked, this works partway towards isolating the problem.

The "NO CLI" name test is failing.
This version of the report fails with a non-canonical address:
// v2pr_info("NO CLI name on: %s\n", cli->map->mod_name);

[    0.109299] dyndbg: add-module: main 6 sites 1.3
[    0.109595] general protection fault, probably for non-canonical address 0x7265766972640000: 0000

fwiw:

  $ perl -e ' $a = pack "H8", "7265766972640000"; print "a:<$a>\n"'
  a:<revi>

These records are added to __dyndbg_class_refs section by DYNDBG_CLASSMAP_USE

This patch adds ddebug_sanity(), and calls it 3 times to characterize what goes wrong and when. It turns out that its contents are wrong immediately, in 1st step of dynamic_debug_init().

[    0.107327] dyndbg: classes
[    0.107537] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    0.107592] dyndbg: class-refs
[    0.107823] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e35e nm:0000000000000000 nm:(null)
[    0.108554] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe86 nm:ffffffff834fc4c8 nm:
[    0.108590] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785aa nm:ffffffff834fc4c8 nm:

Those maps are wrong:

class-refs should all ref the same map, ie class[0]: module:drm. the nm:s should also show module names of 3 builtin clients of drm. So things must end poorly.

modprobing the loadable module does better:

bash-5.2# modprobe amdgpu

[ 6645.212706] AMD-Vi: AMD IOMMUv2 functionality not available on this system - This is not a bug.
[ 6645.653124] dyndbg: add-module: amdgpu 4425 sites 0.1
[ 6645.653582] dyndbg: classes
[ 6645.653830] dyndbg: class-refs
[ 6645.654124] dyndbg: class-ref[0]: cli:ffffffffc0a31b90 map:ffffffff834fc4c8 nm:ffffffffc08bc176 nm:amdgpu
[ 6645.654936] dyndbg: classes
[ 6645.655188] dyndbg: class-refs
[ 6645.655450] dyndbg: class-ref[0]: cli:ffffffffc0a31b90 map:ffffffff834fc4c8 nm:ffffffffc08bc176 nm:amdgpu
[ 6645.656246] dyndbg: class_ref[0] amdgpu -> drm
[ 6645.656613] dyndbg: amdgpu needs drm, 0x0
[ 6645.656953] dyndbg: apply bitmap: 0x0 to: 0x0
[ 6645.657322] dyndbg: break on 0/1
[ 6645.657592] dyndbg: 4425 debug prints in module amdgpu

Here, the maps are correct; they ref the class[0] module:drm above. That said, apply bitmap is wrong.

---

[    1.210094] dyndbg: add-module: drm 302 sites 1.3
[    1.210496] dyndbg: classes
[    1.210674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.211290] dyndbg: class-refs
[    1.211548] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.211674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.212464] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.212675] dyndbg: classes start: class[0]: module:drm base:0 len:10 ty:0
[    1.213257] dyndbg: builtin class: module:drm base:0 len:10 ty:0
[    1.213675] dyndbg: controlling kp: drm.drm.debug
[    1.214087] dyndbg: module:drm attached 1 classes
[    1.214490] dyndbg: classes
[    1.214674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.215291] dyndbg: class-refs
[    1.215552] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.215674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.216430] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.216674] dyndbg: NO CLI ffffffff8293e376 7265766972640000
[    1.217149] dyndbg: 302 debug prints in module drm
[    1.217549] dyndbg: add-module: drm_kms_helper 95 sites 1.3
[    1.217674] dyndbg: classes
[    1.217913] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.218525] dyndbg: class-refs
[    1.218674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.219486] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.219674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.220469] dyndbg: classes
[    1.220674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.221324] dyndbg: class-refs
[    1.221606] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.221674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.222472] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.222674] dyndbg: NO CLI ffffffff8293e376 7265766972640000
[    1.223173] dyndbg:  95 debug prints in module drm_kms_helper
[    1.223675] dyndbg: add-module: drm_display_helper 150 sites 1.3
[    1.224223] dyndbg: classes
[    1.224484] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.224676] dyndbg: class-refs
[    1.224954] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.225674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.226498] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.226674] dyndbg: classes
[    1.226931] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.227577] dyndbg: class-refs
[    1.227674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.228501] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.228674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.229443] dyndbg: NO CLI ffffffff8293e376 7265766972640000
[    1.229674] dyndbg: 150 debug prints in module drm_display_helper
[    1.230195] dyndbg: add-module: ttm 2 sites 1.3
[    1.230581] dyndbg: classes
[    1.230674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.231291] dyndbg: class-refs
[    1.231559] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.231674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.232439] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.232674] dyndbg: classes
[    1.232915] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.233535] dyndbg: class-refs
[    1.233674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.234470] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.234674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.235427] dyndbg: NO CLI ffffffff8293e376 7265766972640000
[    1.235674] dyndbg:   2 debug prints in module ttm
[    1.236079] dyndbg: add-module: i915 1657 sites 1.3
[    1.236490] dyndbg: classes
[    1.236674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.237283] dyndbg: class-refs
[    1.237545] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.237674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.238431] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.238674] dyndbg: classes
[    1.238911] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8
[    1.239519] dyndbg: class-refs
[    1.239674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null)
[    1.240467] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm:
[    1.240674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm:
[    1.241478] dyndbg: NO CLI ffffffff8293e376 7265766972640000
[    1.241674] dyndbg: 1657 debug prints in module i915
---
 include/linux/dynamic_debug.h |  4 ++--
 lib/dynamic_debug.c           | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)
include/linux/dynamic_debug.h +2 -2
index 6f53a687cb32..2a1199aadab6 100644
@@ -115,8 +115,8 @@ struct ddebug_class_map {
 	EXPORT_SYMBOL(_var)
 
 struct ddebug_class_user {
-	char *user_mod_name;
-	struct ddebug_class_map *map;
+	const char *user_mod_name;
+	const struct ddebug_class_map *map;
 };
 /**
  * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere.
lib/dynamic_debug.c +31 -1
index 02f36c553835..46684aa7284d 100644
@@ -1301,7 +1301,8 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct
 			continue;
 		}
 		if (!cli->user_mod_name) {
-			v2pr_info("NO CLI name\n");
+			v2pr_info("NO CLI name %px %px\n", cli->map, cli->map->mod_name);
+			// v2pr_info("NO CLI name on: %s\n", cli->map->mod_name);
 			continue;
 		}
 
@@ -1325,6 +1326,29 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct
 	}
 }
 
+static void ddebug_sanity(struct _ddebug_info *di)
+{
+	struct ddebug_class_map *cm;
+	struct ddebug_class_user *cli;
+	int i;
+
+	if (di->num_classes)
+		v2pr_info("classes\n");
+
+	for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) {
+		v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d cm:%px\n",
+			  i, cm->mod_name, cm->base, cm->length, cm->map_type, cm);
+	}
+	if (di->num_class_refs)
+		v2pr_info("class-refs\n");
+
+	for (i = 0, cli = di->class_refs; i < di->num_class_refs; i++, cli++) {
+		// cli->map->mod_name will segv
+		v2pr_info("class-ref[%d]: cli:%px map:%px nm:%px nm:%s\n", i, cli,
+			  cli->map, cli->user_mod_name, cli->user_mod_name);
+	}
+}
+
 /*
  * Allocate a new ddebug_table for the given module
  * and add it to the global list.
@@ -1357,6 +1381,8 @@ int ddebug_add_module(struct _ddebug_info *di, const char *modname)
 
 	INIT_LIST_HEAD(&dt->link);
 
+	ddebug_sanity(di);
+
 	if (di->num_classes)
 		ddebug_attach_module_classes(dt, di);
 
@@ -1364,6 +1390,8 @@ int ddebug_add_module(struct _ddebug_info *di, const char *modname)
 	list_add_tail(&dt->link, &ddebug_tables);
 	mutex_unlock(&ddebug_lock);
 
+	ddebug_sanity(di);
+
 	if (di->num_class_refs)
 		ddebug_attach_client_module_classes(dt, di);
 
@@ -1493,6 +1521,8 @@ static int __init dynamic_debug_init(void)
 		.num_class_refs = __stop___dyndbg_class_refs - __start___dyndbg_class_refs,
 	};
 
+	ddebug_sanity(&di);
+
 	if (&__start___dyndbg == &__stop___dyndbg) {
 		if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) {
 			pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
Signature · 1 line
2.38.1
author maintainer
#17 lore raw

RFC PATCH 16/17 dyndbg: mess-w-dep-class

In reply to Jim Cromie

for loadable drm, helpers, and drivers, dependent-load is failing to apply changes, needs more investigation.

---
 lib/dynamic_debug.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/dynamic_debug.c +4 -4
index 46684aa7284d..3ef1c0a1f0cd 100644
@@ -1248,14 +1248,14 @@ static void ddebug_find_kparam(struct ddebug_class_map *cm)
 
 static void ddebug_param_load_dependent_class(const struct ddebug_class_user *cli)
 {
-	unsigned long new_bits, old_bits = 0;
+	unsigned long *new_bits, old_bits = 0;
 
-	new_bits = *cli->map->dc_parm->bits;
+	new_bits = cli->map->dc_parm->bits;
 
 	vpr_info("%s needs %s, 0x%lx\n", cli->user_mod_name,
-		 cli->map->mod_name, new_bits);
+		 cli->map->mod_name, *new_bits);
 
-	ddebug_apply_class_bitmap(cli->map->dc_parm, &new_bits, &old_bits, cli->user_mod_name);
+	ddebug_apply_class_bitmap(cli->map->dc_parm, new_bits, &old_bits, cli->user_mod_name);
 }
 
 static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di)
Signature · 1 line
2.38.1
author maintainer
#18 lore raw

RFC PATCH 17/17 dyndbg: miss-on HACK

In reply to Jim Cromie

dont break the loop, to see multiple clients. the 3 client records are differently wrong.

---
 lib/dynamic_debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/dynamic_debug.c +3 -2
index 3ef1c0a1f0cd..a26eaa348731 100644
@@ -629,6 +629,7 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp,
 		v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi,
 			  ct, map->class_names[bi], *new_bits);
 	}
+	v2pr_info("applied bitmap: 0x%lx to: 0x%lx\n", *new_bits, *old_bits);
 	return matches;
 }
 
@@ -1321,8 +1322,8 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct
 			 */
 			v2pr_info("break on %d/%d\n", i, di->num_class_refs);
 			dt->num_class_refs = 1;
-			break;
-		}
+		} else
+			v2pr_info("miss on %d/%d\n", i, di->num_class_refs);
 	}
 }
 
Signature · 1 line
2.38.1
#19 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for DRM_USE_DYNAMIC_DEBUG regression

In reply to Jim Cromie
== Series Details ==

== Series Details ==

Series: DRM_USE_DYNAMIC_DEBUG regression
URL : https://patchwork.freedesktop.org/series/111651/
State : warning

== Summary ==

Error: dim checkpatch failed
8d78d81edb74 test-dyndbg: fixup CLASSMAP usage error
a526555f2fee test-dyndbg: show that DEBUG enables prdbgs at compiletime
69a3d199c77b dyndbg: fix readback value on LEVEL_NAMES interfaces
-:43: WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: b9400852c080 ("dyndbg: add drm.debug style (drm/parameters/debug) bitmap support")' #43:

Fixes b9400852c080 (dyndbg: add drm.debug style (drm/parameters/debug) bitmap support)

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
554c7d4e3228 dyndbg: replace classmap list with a vector
6363d68be8a0 dyndbg: make ddebug_apply_class_bitmap more selective cb8c90d8fccb dyndbg: dynamic_debug_init - use pointer inequality, not strcmp ef959da3c2ac dyndbg: drop NUM_TYPE_ARRAY
03750f80b032 dyndbg: reduce verbose/debug clutter
f0f3d3b03b78 dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with DYNDBG_CLASSMAP(_DEFINE|_USE) -:46: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #46: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:194:
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
"DRM_UT_CORE",

-:68: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #68: FILE: drivers/gpu/drm/display/drm_dp_helper.c:46:
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
"DRM_UT_CORE",

-:90: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #90: FILE: drivers/gpu/drm/drm_crtc_helper.c:55:
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
"DRM_UT_CORE",

-:111: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #111: FILE: drivers/gpu/drm/drm_print.c:60:
+DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
"DRM_UT_CORE",

-:125: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #125: FILE: drivers/gpu/drm/i915/i915_params.c:34:
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
"DRM_UT_CORE",

-:147: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #147: FILE: drivers/gpu/drm/nouveau/nouveau_drm.c:76:
+DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
"DRM_UT_CORE",

-:202: WARNING:TYPO_SPELLING: 'wierd' may be misspelled - perhaps 'weird'? #202: FILE: include/linux/dynamic_debug.h:117:
+ * it should help regularize the admittedly wierd sharing by identical

                                             ^^^^^

total: 0 errors, 1 warnings, 6 checks, 188 lines checked b3c275ffb38c dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE) -:106: WARNING:TYPO_SPELLING: 'doesnt' may be misspelled - perhaps 'doesn't'? #106:
but doesnt alter any callsites.

    ^^^^^^

-:170: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #170: FILE: include/linux/dynamic_debug.h:120:
+};
+/**

-:180: CHECK:MACRO_ARG_REUSE: Macro argument reuse '_var' - possible side-effects? #180: FILE: include/linux/dynamic_debug.h:128:
+#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \
+ extern struct ddebug_class_map _var[]; \
+ static struct ddebug_class_user __used \
+ __section("__dyndbg_class_refs") _uname = { \
+ .user_mod_name = KBUILD_MODNAME, \
+ .map = _var, \
+ }

-:208: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #208: FILE: kernel/module/main.c:2115:
+ sizeof(*info->dyndbg.class_refs), &info->dyndbg.num_class_refs);

-:208: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #208: FILE: kernel/module/main.c:2115:
+ info->dyndbg.class_refs = section_objs(info, "__dyndbg_class_refs",
+ sizeof(*info->dyndbg.class_refs), &info->dyndbg.num_class_refs);

-:220: WARNING:AVOID_EXTERNS: externs should be avoided in .c files #220: FILE: lib/dynamic_debug.c:46:
+extern struct ddebug_class_user __start___dyndbg_class_refs[];

-:221: WARNING:AVOID_EXTERNS: externs should be avoided in .c files #221: FILE: lib/dynamic_debug.c:47:
+extern struct ddebug_class_user __stop___dyndbg_class_refs[];

-:304: CHECK:BRACES: braces {} should be used on all arms of this statement #304: FILE: lib/dynamic_debug.c:1222:
+ if (!strncmp(cm->mod_name, dcp->map->mod_name, strlen(cm->mod_name))) {
[...]
+ } else
[...]

-:307: CHECK:BRACES: Unbalanced braces around else statement #307: FILE: lib/dynamic_debug.c:1225:
+ } else

-:378: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #378: FILE: lib/dynamic_debug.c:1294:
+ for (i = 0, cli = di->class_refs; i < di->num_class_refs; i++, cli++) {
+

-:393: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #393: FILE: lib/dynamic_debug.c:1309:
+ if (!strcmp(cli->user_mod_name, dt->mod_name)) {
+

total: 0 errors, 4 warnings, 7 checks, 311 lines checked
de7be92e3d3d dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args
-:173: CHECK:MACRO_ARG_REUSE: Macro argument reuse '_var' - possible side-effects? #173: FILE: include/linux/dynamic_debug.h:132:
+#define DYNDBG_CLASSMAP_USE_(_var, _uname) \
extern struct ddebug_class_map _var[]; \
+ struct ddebug_class_user __used \
__section("__dyndbg_class_refs") _uname = { \
.user_mod_name = KBUILD_MODNAME, \
.map = _var, \

total: 0 errors, 0 warnings, 1 checks, 136 lines checked
d60f21cf5cef dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements
-:56: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #56:

	module_param_cb(_flags##_##_model, &param_ops_dyndbg_classes, &_flags##_model, 0600)

-:144: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #144:
new file mode 100644

-:149: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #149: FILE: include/linux/map.h:1:
+/*

-:173: ERROR:SPACING: space prohibited before that ',' (ctx:WxE) #173: FILE: include/linux/map.h:25:
+#define iMAP_COMMA ,

                    ^

-:173: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #173: FILE: include/linux/map.h:25:
+#define iMAP_COMMA ,

-:175: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #175: FILE: include/linux/map.h:27:
+#define iMAP_GET_END2() 0, iMAP_END

-:178: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #178: FILE: include/linux/map.h:30:
+#define iMAP_NEXT0(test, next, ...) next iMAP_OUT

-:182: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #182: FILE: include/linux/map.h:34:
+#define iMAP0(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP1)(f, peek, __VA_ARGS__)

-:182: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'f' - possible side-effects? #182: FILE: include/linux/map.h:34:
+#define iMAP0(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP1)(f, peek, __VA_ARGS__)

-:182: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'peek' - possible side-effects? #182: FILE: include/linux/map.h:34:
+#define iMAP0(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP1)(f, peek, __VA_ARGS__)

-:183: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #183: FILE: include/linux/map.h:35:
+#define iMAP1(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP0)(f, peek, __VA_ARGS__)

-:183: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'f' - possible side-effects? #183: FILE: include/linux/map.h:35:
+#define iMAP1(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP0)(f, peek, __VA_ARGS__)

-:183: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'peek' - possible side-effects? #183: FILE: include/linux/map.h:35:
+#define iMAP1(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP0)(f, peek, __VA_ARGS__)

-:188: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #188: FILE: include/linux/map.h:40:
+#define iMAP_LIST0(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST1)(f, peek, __VA_ARGS__)

-:188: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'f' - possible side-effects? #188: FILE: include/linux/map.h:40:
+#define iMAP_LIST0(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST1)(f, peek, __VA_ARGS__)

-:188: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'peek' - possible side-effects? #188: FILE: include/linux/map.h:40:
+#define iMAP_LIST0(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST1)(f, peek, __VA_ARGS__)

-:189: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #189: FILE: include/linux/map.h:41:
+#define iMAP_LIST1(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST0)(f, peek, __VA_ARGS__)

-:189: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'f' - possible side-effects? #189: FILE: include/linux/map.h:41:
+#define iMAP_LIST1(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST0)(f, peek, __VA_ARGS__)

-:189: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'peek' - possible side-effects? #189: FILE: include/linux/map.h:41:
+#define iMAP_LIST1(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST0)(f, peek, __VA_ARGS__)

total: 8 errors, 3 warnings, 8 checks, 191 lines checked
6349e3ae481a drm_print: fix stale macro-name in comment
67e31054b47c dyndbg: unwrap __ddebug_add_module inner function NOTYET
-:15: WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '6afa31514977', maybe rebased or not pulled? #15:

Fixes 6afa31514977 ("dyndbg: unwrap __ddebug_add_module inner function")

total: 0 errors, 1 warnings, 0 checks, 36 lines checked
8a430b9dc8a7 dyndbg: ddebug_sanity()
-:87: WARNING:VSPRINTF_SPECIFIER_PX: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'. #87: FILE: lib/dynamic_debug.c:1304:
+ v2pr_info("NO CLI name %px %px\n", cli->map, cli->map->mod_name);

-:106: WARNING:VSPRINTF_SPECIFIER_PX: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'. #106: FILE: lib/dynamic_debug.c:1339:
+ v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d cm:%px\n",
+ i, cm->mod_name, cm->base, cm->length, cm->map_type, cm);

-:114: WARNING:VSPRINTF_SPECIFIER_PX: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'. #114: FILE: lib/dynamic_debug.c:1347:
+ v2pr_info("class-ref[%d]: cli:%px map:%px nm:%px nm:%s\n", i, cli,
+ cli->map, cli->user_mod_name, cli->user_mod_name);

total: 0 errors, 3 warnings, 0 checks, 72 lines checked 49fee09ae90c dyndbg: mess-w-dep-class
-:31: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 0 checks, 18 lines checked dea8951c8532 dyndbg: miss-on HACK
-:27: CHECK:BRACES: Unbalanced braces around else statement #27: FILE: lib/dynamic_debug.c:1325:
+ } else

-:31: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 1 checks, 17 lines checked

#21 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for DRM_USE_DYNAMIC_DEBUG regression

In reply to Jim Cromie
== Series Details ==

== Series Details ==

Series: DRM_USE_DYNAMIC_DEBUG regression
URL : https://patchwork.freedesktop.org/series/111651/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12471 -> Patchwork_111651v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/index.html

Participating hosts (44 -> 42)
------------------------------

Additional (1): fi-hsw-4770
Missing (3): bat-dg2-11 fi-rkl-11600 fi-tgl-dsi

Known issues
------------

Here are the changes found in Patchwork_111651v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [PASS][1] -> [FAIL][2] ([i915#7229])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/fi-pnv-d510/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-pnv-d510/igt@[email protected]

* igt@gem_render_tiled_blits@basic:
- fi-apl-guc: [PASS][3] -> [INCOMPLETE][4] ([i915#7056])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/fi-apl-guc/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-apl-guc/igt@[email protected]

* igt@gem_softpin@allocator-basic-reserve:
- fi-hsw-4770: NOTRUN -> [SKIP][5] ([fdo#109271]) +11 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-hsw-4770/igt@[email protected]

* igt@kms_chamelium@dp-crc-fast:
- fi-hsw-4770: NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +8 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-hsw-4770/igt@[email protected]

* igt@kms_psr@sprite_plane_onoff:
- fi-hsw-4770: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#1072]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-rplp-1}: [DMESG-WARN][8] ([i915#2867]) -> [PASS][9] +1 similar issue
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/bat-rplp-1/igt@gem_exec_suspend@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: [DMESG-FAIL][10] ([i915#5334]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@late_gt_pm:
- fi-kbl-soraka: [INCOMPLETE][12] -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/fi-kbl-soraka/igt@i915_selftest@live@late_gt_pm.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/fi-kbl-soraka/igt@i915_selftest@live@late_gt_pm.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6434]: https://gitlab.freedesktop.org/drm/intel/issues/6434
[i915#6559]: https://gitlab.freedesktop.org/drm/intel/issues/6559
[i915#7056]: https://gitlab.freedesktop.org/drm/intel/issues/7056
[i915#7229]: https://gitlab.freedesktop.org/drm/intel/issues/7229
[i915#7346]: https://gitlab.freedesktop.org/drm/intel/issues/7346

Build changes
-------------

* Linux: CI_DRM_12471 -> Patchwork_111651v1

CI-20190529: 20190529
CI_DRM_12471: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7083: c001793d5f22deb01918b6ba52af829794582df1 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111651v1: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

581b33202eed dyndbg: miss-on HACK
002ac0c5cef5 dyndbg: mess-w-dep-class
9af76c6a6aff dyndbg: ddebug_sanity()
edefdd520046 dyndbg: unwrap __ddebug_add_module inner function NOTYET d6f5201f2fca drm_print: fix stale macro-name in comment
2f336eae2d14 dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements
73d8e0796c76 dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args
8730bdab5ee7 dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE) 6f1175135daa dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with DYNDBG_CLASSMAP(_DEFINE|_USE) 360565a95c04 dyndbg: reduce verbose/debug clutter
d0512bc2a308 dyndbg: drop NUM_TYPE_ARRAY
7e5ce3f0815f dyndbg: dynamic_debug_init - use pointer inequality, not strcmp 4ecd962b6d19 dyndbg: make ddebug_apply_class_bitmap more selective f72fc87553f9 dyndbg: replace classmap list with a vector
a2a5aa3ba7b2 dyndbg: fix readback value on LEVEL_NAMES interfaces 5acbd5649fc6 test-dyndbg: show that DEBUG enables prdbgs at compiletime 156196441ee6 test-dyndbg: fixup CLASSMAP usage error

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/index.html

#22 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for DRM_USE_DYNAMIC_DEBUG regression

In reply to Jim Cromie
== Series Details ==

== Series Details ==

Series: DRM_USE_DYNAMIC_DEBUG regression
URL : https://patchwork.freedesktop.org/series/111651/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12471_full -> Patchwork_111651v1_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_111651v1_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_111651v1_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Participating hosts (9 -> 11)
------------------------------

Additional (2): shard-rkl shard-dg1

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_111651v1_full:

### IGT changes ###

#### Possible regressions ####

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-tglb: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb2/igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-gtt.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-tglb3/igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-gtt.html

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@gem_create@create-clear@smem0:
- {shard-rkl}: NOTRUN -> [INCOMPLETE][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-rkl-4/igt@gem_create@[email protected]

* igt@perf_pmu@busy-idle-check-all@vcs0:
- {shard-dg1}: NOTRUN -> [FAIL][4] +3 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-dg1-17/igt@perf_pmu@[email protected]

Known issues
------------

Here are the changes found in Patchwork_111651v1_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_persistence@hang:
- shard-skl: NOTRUN -> [SKIP][5] ([fdo#109271]) +128 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@[email protected]

* igt@gem_exec_balancer@parallel-keep-in-fence:
- shard-iclb: [PASS][6] -> [SKIP][7] ([i915#4525])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb2/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb8/igt@[email protected]

* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: [PASS][8] -> [FAIL][9] ([i915#2842]) +1 similar issue
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb6/igt@gem_exec_fair@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-tglb7/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-iclb: NOTRUN -> [FAIL][10] ([i915#2842])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_lmem_swapping@heavy-verify-multi-ccs:
- shard-skl: NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#4613]) +2 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl1/igt@[email protected]

* igt@gem_spin_batch@spin-each:
- shard-skl: [PASS][12] -> [FAIL][13] ([i915#2898])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl9/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl2/igt@[email protected]

* igt@i915_module_load@load:
- shard-skl: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#6227])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl1/igt@[email protected]

* igt@i915_pipe_stress@stress-xrgb8888-ytiled:
- shard-skl: NOTRUN -> [FAIL][15] ([i915#7036])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- shard-apl: [PASS][16] -> [DMESG-FAIL][17] ([i915#5334])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl1/igt@i915_selftest@live@gt_heartbeat.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-apl7/igt@i915_selftest@live@gt_heartbeat.html

* igt@kms_ccs@pipe-b-random-ccs-data-y_tiled_gen12_mc_ccs:
- shard-skl: NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#3886]) +5 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@kms_ccs@pipe-b-random-ccs-data-y_tiled_gen12_mc_ccs.html

* igt@kms_color_chamelium@ctm-max:
- shard-skl: NOTRUN -> [SKIP][19] ([fdo#109271] / [fdo#111827]) +8 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions:
- shard-iclb: [PASS][20] -> [FAIL][21] ([i915#2346])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb6/igt@kms_cursor_legacy@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb7/igt@kms_cursor_legacy@[email protected]

* igt@kms_flip@flip-vs-suspend@c-dp1:
- shard-apl: [PASS][22] -> [DMESG-WARN][23] ([i915#180]) +1 similar issue
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl2/igt@kms_flip@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-apl8/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@c-edp1:
- shard-skl: [PASS][24] -> [FAIL][25] ([i915#2122]) +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl5/igt@kms_flip@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl6/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-4tile-to-64bpp-4tile-downscaling@pipe-a-valid-mode:
- shard-iclb: NOTRUN -> [SKIP][26] ([i915#2587] / [i915#2672]) +3 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb1/igt@kms_flip_scaled_crc@flip-32bpp-4tile-to-64bpp-4tile-downscaling@pipe-a-valid-mode.html

* igt@kms_flip_scaled_crc@flip-32bpp-linear-to-64bpp-linear-downscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][27] ([i915#3555])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb2/igt@kms_flip_scaled_crc@flip-32bpp-linear-to-64bpp-linear-downscaling@pipe-a-default-mode.html

* igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-32bpp-4tile-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][28] ([i915#2672]) +5 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb2/igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-32bpp-4tile-upscaling@pipe-a-default-mode.html

* igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][29] ([i915#2672] / [i915#3555])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb3/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-default-mode.html

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt:
- shard-snb: [PASS][30] -> [SKIP][31] ([fdo#109271]) +1 similar issue
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-snb7/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-snb5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-plflip-blt:
- shard-iclb: [PASS][32] -> [FAIL][33] ([i915#2546])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb7/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb3/igt@[email protected]

* igt@kms_plane_alpha_blend@constant-alpha-min@pipe-c-edp-1:
- shard-skl: NOTRUN -> [FAIL][34] ([i915#4573]) +2 similar issues
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl1/igt@kms_plane_alpha_blend@[email protected]

* igt@kms_psr2_sf@cursor-plane-move-continuous-sf:
- shard-skl: NOTRUN -> [SKIP][35] ([fdo#109271] / [i915#658])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@[email protected]

* igt@kms_psr@psr2_sprite_mmap_gtt:
- shard-iclb: [PASS][36] -> [SKIP][37] ([fdo#109441]) +1 similar issue
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_gtt.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb8/igt@kms_psr@psr2_sprite_mmap_gtt.html

* igt@kms_writeback@writeback-check-output:
- shard-skl: NOTRUN -> [SKIP][38] ([fdo#109271] / [i915#2437])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl1/igt@[email protected]

* igt@perf@blocking:
- shard-skl: [PASS][39] -> [FAIL][40] ([i915#1542]) +1 similar issue
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl7/igt@[email protected]

* igt@sysfs_clients@busy:
- shard-skl: NOTRUN -> [SKIP][41] ([fdo#109271] / [i915#2994]) +2 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_balancer@parallel-out-fence:
- shard-iclb: [SKIP][42] ([i915#4525]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb8/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb2/igt@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-tglb: [FAIL][44] ([i915#2842]) -> [PASS][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb7/igt@gem_exec_fair@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-tglb7/igt@gem_exec_fair@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [FAIL][46] ([i915#3989] / [i915#454]) -> [PASS][47]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb3/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb6/igt@[email protected]

* igt@i915_pm_rc6_residency@rc6-idle@vcs0:
- shard-skl: [WARN][48] ([i915#1804]) -> [PASS][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl4/igt@i915_pm_rc6_residency@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl9/igt@i915_pm_rc6_residency@[email protected]

* igt@i915_pm_rps@engine-order:
- shard-apl: [FAIL][50] ([i915#6537]) -> [PASS][51]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl7/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-apl3/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@c-edp1:
- shard-skl: [FAIL][52] ([i915#79]) -> [PASS][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl4/igt@kms_flip@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl9/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible@a-dp1:
- shard-apl: [DMESG-WARN][54] ([i915#180]) -> [PASS][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl2/igt@kms_flip@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-apl8/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-ts-check@b-edp1:
- shard-skl: [FAIL][56] ([i915#2122]) -> [PASS][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl5/igt@kms_flip@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl10/igt@kms_flip@[email protected]

* igt@kms_psr@psr2_no_drrs:
- shard-iclb: [SKIP][58] ([fdo#109441]) -> [PASS][59] +1 similar issue
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb6/igt@kms_psr@psr2_no_drrs.html
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb2/igt@kms_psr@psr2_no_drrs.html

* igt@kms_psr_stress_test@flip-primary-invalidate-overlay:
- shard-tglb: [SKIP][60] ([i915#5519]) -> [PASS][61]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb7/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-tglb1/igt@[email protected]

* igt@syncobj_timeline@wait-for-submit-delayed-submit:
- shard-skl: [DMESG-WARN][62] ([i915#1982]) -> [PASS][63]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl3/igt@[email protected]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl1/igt@[email protected]

#### Warnings ####

* igt@kms_psr2_sf@plane-move-sf-dmg-area:
- shard-iclb: [SKIP][64] ([i915#2920]) -> [SKIP][65] ([fdo#111068] / [i915#658])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb2/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-iclb8/igt@[email protected]

* igt@runner@aborted:
- shard-skl: ([FAIL][66], [FAIL][67], [FAIL][68]) ([i915#3002] / [i915#4312] / [i915#6949]) -> ([FAIL][69], [FAIL][70], [FAIL][71]) ([i915#3002] / [i915#4312])
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl10/igt@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl7/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl6/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl5/igt@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl1/igt@[email protected]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/shard-skl2/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
[fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1542]: https://gitlab.freedesktop.org/drm/intel/issues/1542
[i915#1722]: https://gitlab.freedesktop.org/drm/intel/issues/1722
[i915#1755]: https://gitlab.freedesktop.org/drm/intel/issues/1755
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1804]: https://gitlab.freedesktop.org/drm/intel/issues/1804
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1850]: https://gitlab.freedesktop.org/drm/intel/issues/1850
[i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
[i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2433]: https://gitlab.freedesktop.org/drm/intel/issues/2433
[i915#2436]: https://gitlab.freedesktop.org/drm/intel/issues/2436
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2546]: https://gitlab.freedesktop.org/drm/intel/issues/2546
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2898]: https://gitlab.freedesktop.org/drm/intel/issues/2898
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3936]: https://gitlab.freedesktop.org/drm/intel/issues/3936
[i915#3938]: https://gitlab.freedesktop.org/drm/intel/issues/3938
[i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
[i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
[i915#4036]: https://gitlab.freedesktop.org/drm/intel/issues/4036
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#426]: https://gitlab.freedesktop.org/drm/intel/issues/426
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
[i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
[i915#4391]: https://gitlab.freedesktop.org/drm/intel/issues/4391
[i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
[i915#4573]: https://gitlab.freedesktop.org/drm/intel/issues/4573
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4854]: https://gitlab.freedesktop.org/drm/intel/issues/4854
[i915#4855]: https://gitlab.freedesktop.org/drm/intel/issues/4855
[i915#4859]: https://gitlab.freedesktop.org/drm/intel/issues/4859
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4874]: https://gitlab.freedesktop.org/drm/intel/issues/4874
[i915#4877]: https://gitlab.freedesktop.org/drm/intel/issues/4877
[i915#4879]: https://gitlab.freedesktop.org/drm/intel/issues/4879
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#4881]: https://gitlab.freedesktop.org/drm/intel/issues/4881
[i915#4884]: https://gitlab.freedesktop.org/drm/intel/issues/4884
[i915#4885]: https://gitlab.freedesktop.org/drm/intel/issues/4885
[i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
[i915#4991]: https://gitlab.freedesktop.org/drm/intel/issues/4991
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#5327]: https://gitlab.freedesktop.org/drm/intel/issues/5327
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#5519]: https://gitlab.freedesktop.org/drm/intel/issues/5519
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6230]: https://gitlab.freedesktop.org/drm/intel/issues/6230
[i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
[i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6344]: https://gitlab.freedesktop.org/drm/intel/issues/6344
[i915#6355]: https://gitlab.freedesktop.org/drm/intel/issues/6355
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6463]: https://gitlab.freedesktop.org/drm/intel/issues/6463
[i915#6493]: https://gitlab.freedesktop.org/drm/intel/issues/6493
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#6537]: https://gitlab.freedesktop.org/drm/intel/issues/6537
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#6949]: https://gitlab.freedesktop.org/drm/intel/issues/6949
[i915#7036]: https://gitlab.freedesktop.org/drm/intel/issues/7036
[i915#7052]: https://gitlab.freedesktop.org/drm/intel/issues/7052
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7178]: https://gitlab.freedesktop.org/drm/intel/issues/7178
[i915#7276]: https://gitlab.freedesktop.org/drm/intel/issues/7276
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7582]: https://gitlab.freedesktop.org/drm/intel/issues/7582
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79

Build changes
-------------

* Linux: CI_DRM_12471 -> Patchwork_111651v1

CI-20190529: 20190529
CI_DRM_12471: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7083: c001793d5f22deb01918b6ba52af829794582df1 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111651v1: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111651v1/index.html

#23 lore raw
In reply to Jim Cromie
Quoted 21 lines · Jim Cromie

Hi everyone,

DRM_USE_DYNAMIC_DEBUG=y has a regression on rc-*

Regression is due to a chicken-egg problem loading modules; on modprobe i915, drm is loaded 1st, and drm.debug is set. When drm_debug_enabled() tested __drm_debug at runtime, that just worked.

But with DRM_USE_DYNAMIC_DEBUG=y, the runtime test is replaced with a post-load enablement of drm_dbg/dyndbg callsites (static-keys), via dyndbg's callback on __drm_debug. Since all drm-drivers need drm.ko, it is loaded 1st, then drm.debug=X is applied, then drivers load, but too late for drm_dbgs to be enabled.

STATUS

For all-loadable drm,i915,amdgpu configs, it almost works, but propagating drm.debug to dependent modules doesnt actually apply, though the motions are there. This is not the problem I want to chase here.

Quoted 8 lines

The more basic trouble is:

For builtin drm + helpers, things are broken pretty early; at the beginning of dynamic_debug_init(). As the ddebug_sanity() commit-msg describes in some detail, the records added by _USE fail to reference the struct ddebug_class_map created and exported by _DEFINE, but get separate addresses to "other" data that segv's when used as the expected pointer. FWIW, the pointer val starts with "revi".

So I honestly have no idea here, linker stuff is way beyond where I have clue. So what's the way forward here?

The DEFINE/USE split does like the right thing to do at least from the "how it's used in drivers" pov. But if we're just running circles not quite getting there I dunno :-/
-Daniel

Quoted 68 lines

OVERVIEW

DECLARE_DYNDBG_CLASSMAP is broken: it is one-size-fits-all-poorly. It muddles the distinction between a (single) definition, and multiple references. Something exported should suffice.

The core of this patchset splits it into:

DYNDBG_CLASSMAP_DEFINE used once per subsystem to define each classmap
DYNDBG_CLASSMAP_USE declare dependence on a DEFINEd classmap

This makes the weird coordinated-changes-by-identical-classmaps "feature" unnecessary; the DEFINE can export the var, and USE refers to the exported var.

So this patchset adds another section: __dyndbg_class_refs.

It is like __dyndbg_classes; it is scanned under ddebug_add_module(), and attached to each module's ddebug_table. Once attached, it can be used like classes to validate and apply class FOO >control queries.

It also maps the class user -> definer explicitly, so that when the module is loaded, the section scan can find the kernel-param that is wired to dyndbg's kparam-callback, and apply its state-var, forex:
__drm_debug to the just loaded helper/driver module.

Theres plenty to address Im sure.

Jim Cromie (17):
test-dyndbg: fixup CLASSMAP usage error
test-dyndbg: show that DEBUG enables prdbgs at compiletime
dyndbg: fix readback value on LEVEL_NAMES interfaces
dyndbg: replace classmap list with a vector
dyndbg: make ddebug_apply_class_bitmap more selective
dyndbg: dynamic_debug_init - use pointer inequality, not strcmp
dyndbg: drop NUM_TYPE_ARRAY
dyndbg: reduce verbose/debug clutter
dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with
DYNDBG_CLASSMAP(_DEFINE|_USE)
dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE)
dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args
dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements
drm_print: fix stale macro-name in comment
dyndbg: unwrap __ddebug_add_module inner function NOTYET
dyndbg: ddebug_sanity()
dyndbg: mess-w-dep-class
dyndbg: miss-on HACK

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  14 +-
 drivers/gpu/drm/display/drm_dp_helper.c |  14 +-
 drivers/gpu/drm/drm_crtc_helper.c       |  14 +-
 drivers/gpu/drm/drm_print.c             |  22 +--
 drivers/gpu/drm/i915/i915_params.c      |  14 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  14 +-
 include/asm-generic/vmlinux.lds.h       |   3 +
 include/drm/drm_print.h                 |   6 +-
 include/linux/dynamic_debug.h           |  57 ++++--
 include/linux/map.h                     |  54 ++++++
 kernel/module/main.c                    |   2 +
 lib/dynamic_debug.c                     | 240 +++++++++++++++++++-----
 lib/test_dynamic_debug.c                |  47 ++---
 13 files changed, 344 insertions(+), 157 deletions(-)
 create mode 100644 include/linux/map.h
Signature · 1 line
2.38.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
author maintainer
#24 lore raw
Quoted 32 lines · Daniel Vetter
Quoted 21 lines · Jim Cromie

Hi everyone,

DRM_USE_DYNAMIC_DEBUG=y has a regression on rc-*

Regression is due to a chicken-egg problem loading modules; on modprobe i915, drm is loaded 1st, and drm.debug is set. When drm_debug_enabled() tested __drm_debug at runtime, that just worked.

But with DRM_USE_DYNAMIC_DEBUG=y, the runtime test is replaced with a post-load enablement of drm_dbg/dyndbg callsites (static-keys), via dyndbg's callback on __drm_debug. Since all drm-drivers need drm.ko, it is loaded 1st, then drm.debug=X is applied, then drivers load, but too late for drm_dbgs to be enabled.

STATUS

For all-loadable drm,i915,amdgpu configs, it almost works, but propagating drm.debug to dependent modules doesnt actually apply, though the motions are there. This is not the problem I want to chase here.

Quoted 8 lines

The more basic trouble is:

For builtin drm + helpers, things are broken pretty early; at the beginning of dynamic_debug_init(). As the ddebug_sanity() commit-msg describes in some detail, the records added by _USE fail to reference the struct ddebug_class_map created and exported by _DEFINE, but get separate addresses to "other" data that segv's when used as the expected pointer. FWIW, the pointer val starts with "revi".

Quoted 3 lines

So I honestly have no idea here, linker stuff is way beyond where I have clue. So what's the way forward here?

Ive fixed this aspect.
Unsurprisingly, it wasnt the linker :-}

Quoted 5 lines

The DEFINE/USE split does like the right thing to do at least from the "how it's used in drivers" pov. But if we're just running circles not quite getting there I dunno :-/
-Daniel

Sending new rev next.
I think its getting close.

#25 lore raw
Quoted 33 lines · On Fri, Jan 13, 2023 at 11:29:57AM -0700, [email protected] wrote:
Quoted 32 lines · Daniel Vetter
Quoted 29 lines · Jim Cromie

Hi everyone,

DRM_USE_DYNAMIC_DEBUG=y has a regression on rc-*

Regression is due to a chicken-egg problem loading modules; on modprobe i915, drm is loaded 1st, and drm.debug is set. When drm_debug_enabled() tested __drm_debug at runtime, that just worked.

But with DRM_USE_DYNAMIC_DEBUG=y, the runtime test is replaced with a post-load enablement of drm_dbg/dyndbg callsites (static-keys), via dyndbg's callback on __drm_debug. Since all drm-drivers need drm.ko, it is loaded 1st, then drm.debug=X is applied, then drivers load, but too late for drm_dbgs to be enabled.

STATUS

For all-loadable drm,i915,amdgpu configs, it almost works, but propagating drm.debug to dependent modules doesnt actually apply, though the motions are there. This is not the problem I want to chase here.

The more basic trouble is:

For builtin drm + helpers, things are broken pretty early; at the beginning of dynamic_debug_init(). As the ddebug_sanity() commit-msg describes in some detail, the records added by _USE fail to reference the struct ddebug_class_map created and exported by _DEFINE, but get separate addresses to "other" data that segv's when used as the expected pointer. FWIW, the pointer val starts with "revi".

Quoted 6 lines
Quoted 3 lines

So I honestly have no idea here, linker stuff is way beyond where I have clue. So what's the way forward here?

Ive fixed this aspect.
Unsurprisingly, it wasnt the linker :-}

Awesome!

Quoted 8 lines
Quoted 5 lines

The DEFINE/USE split does like the right thing to do at least from the "how it's used in drivers" pov. But if we're just running circles not quite getting there I dunno :-/
-Daniel

Sending new rev next.
I think its getting close.

Thanks a lot for keeping on pushing this.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch