[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200826170041.2497546-3-jim.cromie@gmail.com>
Date: Wed, 26 Aug 2020 11:00:39 -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 2/4] drm-printk: call pr_debug() from drm_dev_dbg, __drm_dbg
Put the pr_debug() after the vaf setup work, so as to use it. And
move the if-category-disabled-return after both, so the pr_debug()
runs unconditionally.
This lets both debug-printers execute independently, according to
their respective controls, allowing later comparison to each other.
#> echo module=drm +pmftl > /proc/dynamic_debug/control
yields logging like:
[1772] drm:drm_dev_dbg:305: i915 0000:00:02.0: [drm:intel_atomic_get_global_obj_state [i915]]
Cat:16 Added new global object 000000006fa51dd6 state 00000000bbddcf9d to 000000005f6e1bc3
[1772] drm:drm_dev_dbg:305: i915 0000:00:02.0: [drm:intel_atomic_get_global_obj_state [i915]]
Cat:16 Added new global object 000000002a5e020a state 000000002b3685ed to 000000005f6e1bc3
[198] drm:drm_dev_dbg:305: i915 0000:00:02.0: [drm:drm_update_vblank_count [drm]]
Cat:32 updating vblank count on crtc 0: current=260920, diff=0, hw=192024 hw_last=192024
[1772] drm:__drm_dbg:331: [drm:drm_atomic_nonblocking_commit [drm]] Cat:16 committing 000000005f6e1bc3 nonblocking
[1772] drm:__drm_dbg:331: [drm:drm_mode_object_put.part.0 [drm]] Cat:1 OBJ ID: 113 (4)
[1772] drm:__drm_dbg:331: [drm:drm_ioctl [drm]] Cat:1 comm="gnome-shell" pid=1772, dev=0xe200, auth=1, I915_GEM_CREATE
[1772] drm:__drm_dbg:331: [drm:drm_ioctl [drm]] Cat:1 comm="gnome-shell" pid=1772, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
[1772] drm:__drm_dbg:331: [drm:drm_ioctl [drm]] Cat:1 comm="gnome-shell" pid=1772, dev=0xe200, auth=1, I915_GEM_SET_TILING
[1772] drm:__drm_dbg:331: [drm:drm_ioctl [drm]] Cat:1 comm="gnome-shell" pid=1772, dev=0xe200, auth=1, I915_GEM_MMAP_OFFSET
Clearly, the mflt flags arent very helpful here, and callsite control
is all or nothing (since theres only 2 callsites handling all the
categories). We are 1 below the function layer of interest, but
theres room for optimism.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
drivers/gpu/drm/drm_print.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 52abaf2ae053..fa2bcf4ec475 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -27,6 +27,7 @@
#include <stdarg.h>
+#define DYNAMIC_DEBUG_MODULE
#include <linux/dynamic_debug.h>
#include <linux/io.h>
#include <linux/moduleparam.h>
@@ -61,17 +62,17 @@ EXPORT_SYMBOL(__drm_debug2);
static int param_set_dyndbg(const char *val, const struct kernel_param *kp)
{
- int chgct, result;
+ int chgct, rc, result;
- result = kstrtouint(val, 0, (unsigned int *)kp->arg);
- pr_warn("set_dyndbg: result:%d from %s\n", result, val);
+ rc = kstrtouint(val, 0, &result);
+ pr_debug("set_dyndbg: rc:%d got:%d from %s\n", rc, 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);
+ pr_debug("change ct:%d\n", chgct);
return 0;
}
static int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
@@ -297,13 +298,16 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
struct va_format vaf;
va_list args;
- if (!drm_debug_enabled(category))
- return;
-
va_start(args, format);
vaf.fmt = format;
vaf.va = &args;
+ dev_dbg(dev, "[" DRM_NAME ":%ps] Cat:%d %pV",
+ __builtin_return_address(0), category, &vaf);
+
+ if (!drm_debug_enabled(category))
+ return;
+
if (dev)
dev_printk(KERN_DEBUG, dev, "[" DRM_NAME ":%ps] %pV",
__builtin_return_address(0), &vaf);
@@ -320,13 +324,16 @@ void __drm_dbg(enum drm_debug_category category, const char *format, ...)
struct va_format vaf;
va_list args;
- if (!drm_debug_enabled(category))
- return;
-
va_start(args, format);
vaf.fmt = format;
vaf.va = &args;
+ pr_debug("[" DRM_NAME ":%ps] Cat:%d %pV",
+ __builtin_return_address(0), category, &vaf);
+
+ if (!drm_debug_enabled(category))
+ return;
+
printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
__builtin_return_address(0), &vaf);
--
2.26.2
Powered by blists - more mailing lists