From: Jim Cromie <jim.cromie@gmail.com>
To: "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>,
"Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"Zhenyu Wang" <zhenyuw@linux.intel.com>,
"Zhi Wang" <zhi.a.wang@intel.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Jason Baron" <jbaron@akamai.com>,
"Ashley Thomas" <Ashley.Thomas2@amd.com>,
"Qingqing Zhuo" <qingqing.zhuo@amd.com>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
"Wyatt Wood" <Wyatt.Wood@amd.com>,
"Jim Cromie" <jim.cromie@gmail.com>,
"Jessica Yu" <jeyu@kernel.org>, "Johan Hovold" <johan@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Nick Desaulniers" <ndesaulniers@gooogle.com>,
"Joe Perches" <joe@perches.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
amd-gfx@lists.freedesktop.org,
intel-gvt-dev@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org
Subject: [PATCH v4 5/7] i915/gvt: control pr_debug("gvt:")s with bits in parameters/debug_gvt
Date: Sat, 31 Jul 2021 15:42:02 -0600 [thread overview]
Message-ID: <20210731214211.657280-6-jim.cromie@gmail.com> (raw)
In-Reply-To: <20210731214211.657280-1-jim.cromie@gmail.com>
The gvt component of this driver has ~120 pr_debugs, in 9 "classes".
Following the interface model of drm.debug, add a parameter to map
bits to these classes.
If CONFIG_DRM_USE_DYNAMIC_DEBUG=y (and CONFIG_DYNAMIC_DEBUG_CORE), add
-DDYNAMIC_DEBUG_MODULE into Makefile. TBD: maybe add a separate
CONFIG_I915_USE_DYNAMIC_DEBUG to more fully optionalize this.
this is close to our target:
DYNDBG_BITMAP_DESC(__gvt_debug, "dyndbg bitmap desc",
{ "gvt: cmd: ", "command processing" },
{ "gvt: core: ", "core help" },
{ "gvt: dpy: ", "display help" },
{ "gvt: el: ", "help" },
{ "gvt: irq: ", "help" },
{ "gvt: mm: ", "help" },
{ "gvt: mmio: ", "help" },
{ "gvt: render: ", "help" },
{ "gvt: sched: " "help" });
actual patch has a few details different, helper macros mainly.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
drivers/gpu/drm/i915/gvt/Makefile | 4 ++++
drivers/gpu/drm/i915/i915_params.c | 34 ++++++++++++++++++++++++++++++
include/drm/drm_print.h | 3 ++-
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile
index ea8324abc784..846ba73b8de6 100644
--- a/drivers/gpu/drm/i915/gvt/Makefile
+++ b/drivers/gpu/drm/i915/gvt/Makefile
@@ -7,3 +7,7 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
ccflags-y += -I $(srctree)/$(src) -I $(srctree)/$(src)/$(GVT_DIR)/
i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
+
+#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG
+ccflags-y += -DDYNAMIC_DEBUG_MODULE
+#endif
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index e07f4cfea63a..c951ef76454f 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -265,3 +265,37 @@ void i915_params_free(struct i915_params *params)
I915_PARAMS_FOR_EACH(FREE);
#undef FREE
}
+
+/* POC for callback -> dynamic_debug_exec_queries */
+unsigned long __gvt_debug;
+EXPORT_SYMBOL(__gvt_debug);
+
+#define _help(key) "\t\"" key "\"\t: help for " key "\n"
+#define cmd_help(key) { .prefix = key, .help = key ": help for " key }
+
+#define I915_DYNDBG_PARM_DESC(name) \
+ "Enable debug output via /sys/module/i915/parameters/" #name \
+ ", where each bit enables a debug category.\n" \
+ _help("gvt:cmd:") \
+ _help("gvt:core:") \
+ _help("gvt:dpy:") \
+ _help("gvt:el:") \
+ _help("gvt:irq:") \
+ _help("gvt:mm:") \
+ _help("gvt:mmio:") \
+ _help("gvt:render:") \
+ _help("gvt:sched:")
+
+MODULE_PARM_DESC(debug_gvt, I915_DYNDBG_PARM_DESC(debug_gvt));
+
+DEFINE_DYNDBG_BITMAP(debug_gvt, &__gvt_debug,
+ I915_DYNDBG_PARM_DESC(debug_gvt),
+ cmd_help("gvt:cmd:"),
+ cmd_help("gvt:core:"),
+ cmd_help("gvt:dpy:"),
+ cmd_help("gvt:el:"),
+ cmd_help("gvt:irq:"),
+ cmd_help("gvt:mm:"),
+ cmd_help("gvt:mmio:"),
+ cmd_help("gvt:render:"),
+ cmd_help("gvt:sched:"));
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 15a089a87c22..47803c64b144 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -530,7 +530,8 @@ void __drm_err(const char *format, ...);
const struct drm_device *drm_ = (drm); \
\
if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_)) \
- drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__); \
+ drm_dev_dbg((drm_) ? (drm_)->dev : NULL, \
+ DRM_DBG_CLASS_ ## category, fmt, ##__VA_ARGS__); \
})
#define drm_dbg_kms_ratelimited(drm, fmt, ...) \
--
2.31.1
next prev parent reply other threads:[~2021-07-31 21:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-31 21:41 [PATCH v4 0/7] drm: use dyndbg in drm_print Jim Cromie
2021-07-31 21:41 ` [PATCH v4 1/7] drm/print: fixup spelling in a comment Jim Cromie
2021-07-31 21:41 ` [PATCH v4 2/7] moduleparam: add data member to struct kernel_param Jim Cromie
2021-08-02 16:18 ` Emil Velikov
2021-08-02 18:36 ` jim.cromie
2021-07-31 21:42 ` [PATCH v4 3/7] dyndbg: add dyndbg-bitmap definer and callbacks Jim Cromie
2021-08-02 16:24 ` [Intel-gfx] " Emil Velikov
2021-08-02 18:40 ` jim.cromie
2021-07-31 21:42 ` [PATCH v4 4/7] i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes Jim Cromie
2021-07-31 21:42 ` Jim Cromie [this message]
2021-08-02 16:27 ` [PATCH v4 5/7] i915/gvt: control pr_debug("gvt:")s with bits in parameters/debug_gvt Emil Velikov
2021-07-31 21:42 ` [PATCH v4 6/7] drm/print: add choice to use dynamic debug in drm-debug Jim Cromie
2021-07-31 21:42 ` [PATCH v4 7/7] amdgpu: define a dydbg-bitmap to control categorized pr_debugs Jim Cromie
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=20210731214211.657280-6-jim.cromie@gmail.com \
--to=jim.cromie@gmail.com \
--cc=Ashley.Thomas2@amd.com \
--cc=Wyatt.Wood@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jbaron@akamai.com \
--cc=jeyu@kernel.org \
--cc=joe@perches.com \
--cc=johan@kernel.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ndesaulniers@gooogle.com \
--cc=ojeda@kernel.org \
--cc=qingqing.zhuo@amd.com \
--cc=rodrigo.vivi@intel.com \
--cc=sunpeng.li@amd.com \
--cc=tzimmermann@suse.de \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).