[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200826170041.2497546-2-jim.cromie@gmail.com>
Date: Wed, 26 Aug 2020 11:00:38 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
jbaron@...mai.com
Cc: Jim Cromie <jim.cromie@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>
Subject: [PATCH 1/4] drm-printk: POC caller of dynamic-debug-exec-queries
Export of dynamic-debug-exec-queries exists for users like drm.
This commit is a 1st user-test; it adds a 2nd knob, __drm_debug2,
similar in function to __drm_debug. module_param_cb wires it to a
callback which maps the input value to one of: "module=drm* +/-p".
The include is needed to see the exported function prototype.
Notes:
The define DEBUG at top of drm-printk enables all pr_debug()s,
independent of CONFIG_DYNAMIC_DEBUG_CORE.
drm-printk is an independent print control system using __drm_debug
bits. The plan is to find the low-level macros in which to insert a
pr_debug call, their eventual callsites will have distinct METADATA,
so will be itemized in control, and individually selectable.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
drivers/gpu/drm/drm_print.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 111b932cf2a9..52abaf2ae053 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -27,6 +27,7 @@
#include <stdarg.h>
+#include <linux/dynamic_debug.h>
#include <linux/io.h>
#include <linux/moduleparam.h>
#include <linux/seq_file.h>
@@ -54,6 +55,40 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat
"\t\tBit 8 (0x100) will enable DP messages (displayport code)");
module_param_named(debug, __drm_debug, int, 0600);
+/* POC for callback -> ddebug_exec_queries */
+unsigned int __drm_debug2;
+EXPORT_SYMBOL(__drm_debug2);
+
+static int param_set_dyndbg(const char *val, const struct kernel_param *kp)
+{
+ int chgct, result;
+
+ result = kstrtouint(val, 0, (unsigned int *)kp->arg);
+ pr_warn("set_dyndbg: result:%d from %s\n", result, val);
+
+ if (result)
+ chgct = dynamic_debug_exec_queries("module=drm* +p", NULL);
+ else
+ chgct = dynamic_debug_exec_queries("module=drm* -p", NULL);
+
+ pr_warn("change ct:%d\n", chgct);
+ return 0;
+}
+static int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
+{
+ return scnprintf(buffer, PAGE_SIZE, "%u\n",
+ *((unsigned int *)kp->arg));
+}
+static const struct kernel_param_ops param_ops_dyndbg = {
+ .set = param_set_dyndbg,
+ .get = param_get_dyndbg,
+};
+
+MODULE_PARM_DESC(debug_dyn, "Enable debug output, where each bit enables a debug category.\n"
+ "\t\tthese wont work yet\n");
+module_param_cb(debug_dyn, ¶m_ops_dyndbg, &__drm_debug2, 0644);
+
+
void __drm_puts_coredump(struct drm_printer *p, const char *str)
{
struct drm_print_iterator *iterator = p->arg;
--
2.26.2
Powered by blists - more mailing lists