[Intel-gfx] [PATCH v4 38/41] nouveau-dyndbg: alter DEBUG, TRACE, SPAM levels to use dyndbg
Jim Cromie
jim.cromie at gmail.com
Wed Jul 20 15:32:30 UTC 2022
clone the nvkm_printk,_,__ macro ladder into nvkm_drmdbg,_,__.
And alter debug, trace, spam macros to use the renamed ladder.
This *sets-up* to remove the _subdev->debug >= (l) condition from the
__ macro, once the bitmap-param is wired up correctly (pointing at the
right state-bit-vector), and figured into dyndbg's jump-label
enablement.
Also, with DYNDBG=y, sites will be off, until enabled by >control, or
by #define DEBUG at compile time.
Starting with this as a model:
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,..
We basically need to clone that, but ref a different .bits:
.bits = &_subdev->debug,
while respecting the _subdev's lifecycle.
hints welcomed.
no functional changes. (other than dyndbg's default-off)
Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
index 065d07ccea87..b9c2afab321f 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
@@ -59,9 +59,17 @@ void nvkm_subdev_intr(struct nvkm_subdev *);
#define nvkm_error(s,f,a...) nvkm_printk((s), ERROR, err, f, ##a)
#define nvkm_warn(s,f,a...) nvkm_printk((s), WARN, notice, f, ##a)
#define nvkm_info(s,f,a...) nvkm_printk((s), INFO, info, f, ##a)
-#define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, dbg, f, ##a)
-#define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, dbg, f, ##a)
-#define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a)
+
+#define nvkm_drmdbg__(s,l,p,f,a...) do { \
+ const struct nvkm_subdev *_subdev = (s); \
+ if (CONFIG_NOUVEAU_DEBUG >= (l) && _subdev->debug >= (l)) \
+ dev_dbg(_subdev->device->dev, "%s: "f, _subdev->name, ##a); \
+} while(0)
+#define nvkm_drmdbg_(s,l,f,a...) nvkm_drmdbg__((s), NV_DBG_##l, dbg, f, ##a)
+#define nvkm_debug(s,f,a...) nvkm_drmdbg_((s), DEBUG, f, ##a)
+#define nvkm_trace(s,f,a...) nvkm_drmdbg_((s), TRACE, f, ##a)
+#define nvkm_spam(s,f,a...) nvkm_drmdbg_((s), SPAM, f, ##a)
#define nvkm_error_ratelimited(s,f,a...) nvkm_printk((s), ERROR, err_ratelimited, f, ##a)
+
#endif
--
2.36.1
More information about the Intel-gfx
mailing list