[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220516225640.3102269-28-jim.cromie@gmail.com>
Date: Mon, 16 May 2022 16:56:40 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: jbaron@...mai.com, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
intel-gvt-dev@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org
Cc: gregkh@...uxfoundation.org, daniel.vetter@...ll.ch,
seanpaul@...omium.org, robdclark@...il.com, rostedt@...dmis.org,
mathieu.desnoyers@...icios.com, quic_saipraka@...cinc.com,
will@...nel.org, catalin.marinas@....com,
quic_psodagud@...cinc.com, maz@...nel.org, arnd@...db.de,
linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, mingo@...hat.com,
jim.cromie@...il.com
Subject: [PATCH v2 27/27] dyndbg/drm: POC add tracebits sysfs-knob
clone DRM.debug interface to DRM.tracebits: ie map bits to
drm-debug-categories, except this interface enables messages to
tracefs, not to syslog.
This reuses dyndbg's register-classes API to add the new sysfs-knob:
drm_drv.h:
[A] 2nd use of DYNAMIC_DEBUG_CLASSES(drm_trace_classes), which
declares and initializes a known-classes map with the same literal
classnames as in the 1st use. This "shares" the classnames for both
sysfs-knobs, which is necessary because they're manipulating a shared
dyndbg callsite, toggling "p" and "T" flags respectively.
This incurs a tiny waste of constant strings, but its worth it for the
simpler declarative macro.
drm_print.c:
1- declare and export a 2nd bit-vector: __drm_trace, like __drm_debug
2- declare and init a struct ddebug_classes_bitmap_param with:
__drm_trace [1], drm_trace_classes [A].
3- module_param_cb([2]) - does the sysfs part
drm_drv.c:
register and unregister [A], and missed unregister on drm_debug_classes.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
drivers/gpu/drm/drm_drv.c | 3 +++
drivers/gpu/drm/drm_print.c | 10 ++++++++++
include/drm/drm_drv.h | 14 +++++++++++++-
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 16683fb169aa..ad141c5e29ca 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -1039,6 +1039,8 @@ static void drm_core_exit(void)
drm_sysfs_destroy();
idr_destroy(&drm_minors_idr);
drm_connector_ida_destroy();
+ dynamic_debug_unregister_classes(&drm_debug_classes);
+ dynamic_debug_unregister_classes(&drm_trace_classes);
}
static int __init drm_core_init(void)
@@ -1046,6 +1048,7 @@ static int __init drm_core_init(void)
int ret;
dynamic_debug_register_classes(&drm_debug_classes);
+ dynamic_debug_register_classes(&drm_trace_classes);
drm_connector_ida_init();
idr_init(&drm_minors_idr);
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 9afb676bda4d..970b6dd46c42 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -44,6 +44,9 @@
unsigned long __drm_debug;
EXPORT_SYMBOL(__drm_debug);
+unsigned long __drm_trace;
+EXPORT_SYMBOL(__drm_trace);
+
MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n"
"\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n"
@@ -63,6 +66,13 @@ static struct ddebug_classes_bitmap_param drm_debug_bitmap = {
.map = &drm_debug_classes,
};
module_param_cb(debug, ¶m_ops_dyndbg_classes, &drm_debug_bitmap, 0600);
+
+static struct ddebug_classes_bitmap_param drm_trace_bitmap = {
+ .bits = &__drm_trace,
+ .flags = "T",
+ .map = &drm_trace_classes,
+};
+module_param_cb(tracecats, ¶m_ops_dyndbg_classes, &drm_trace_bitmap, 0600);
#endif
void __drm_puts_coredump(struct drm_printer *p, const char *str)
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index c2ffe12161b8..596de0addfd5 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -45,7 +45,19 @@ struct drm_printer;
struct sg_table;
/* these must comport with enum drm_debug_category values */
-DYNAMIC_DEBUG_CLASSES(drm_debug_classes, "*", 0,
+DYNAMIC_DEBUG_CLASSES(drm_debug_classes, 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");
+
+DYNAMIC_DEBUG_CLASSES(drm_trace_classes, 0,
"DRM_UT_CORE",
"DRM_UT_DRIVER",
"DRM_UT_KMS",
--
2.35.3
Powered by blists - more mailing lists