From: Jim Cromie <jim.cromie@gmail.com>
To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
jbaron@akamai.com
Cc: Jim Cromie <jim.cromie@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Subject: [PATCH 1/4] drm-printk: POC caller of dynamic-debug-exec-queries
Date: Wed, 26 Aug 2020 11:00:38 -0600 [thread overview]
Message-ID: <20200826170041.2497546-2-jim.cromie@gmail.com> (raw)
In-Reply-To: <20200826170041.2497546-1-jim.cromie@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2020-08-26 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 17:00 [PATCH 0/4] dyndbg: POC use dynamic_debug_exec_queries in DRM Jim Cromie
2020-08-26 17:00 ` Jim Cromie [this message]
2020-08-26 19:44 ` [PATCH 1/4] drm-printk: POC caller of dynamic-debug-exec-queries kernel test robot
2020-08-26 20:20 ` kernel test robot
2020-08-26 17:00 ` [PATCH 2/4] drm-printk: call pr_debug() from drm_dev_dbg, __drm_dbg Jim Cromie
2020-08-26 17:00 ` [PATCH 3/4] i915: add -DDYNAMIC_DEBUG_MODULE to i915/gvt/Makefile Jim Cromie
2020-08-26 17:00 ` [PATCH 4/4] i915: POC use dynamic_debug_exec_queries to control pr_debugs in gvt Jim Cromie
2020-08-26 22:30 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200826170041.2497546-2-jim.cromie@gmail.com \
--to=jim.cromie@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jbaron@akamai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome