use DYNAMIC_DEBUG to implement DRM.debug
Subsystems (10)
Jim Cromie
maintainerv8 cover use DYNAMIC_DEBUG to implement DRM.debug
Hi Jason, Greg, Daniel, DRM folks,
In DRM-debug currently, drm_debug_enabled() is called a lot to decide whether or not to write debug messages. Each test is cheap, but costs continue with uptime. DYNAMIC_DEBUG "dyndbg", when built with JUMP_LABEL, replaces each of those tests with a patchable NOOP, for "zero cost when off" debugs.
Broadly, this patchset does 3 things, in 2 trees:
Adds DEFINE_DYNAMIC_DEBUG_CATEGORIES, which defines a mapping from bits to "categorized" pr_debugs, a sysfs interface, and callbacks to implement the bits as dynamic_debug >controls. This is modelled after DRM's debug interface.
Uses the new macro in amdgpu & i915 to control existing pr_debugs according to their ad-hoc categorizations.
Adapts the drm-debug API (~20 macros) to configurably "replace" drm_dbg & drm_dev_dbg with pr_debug & dev_dbg, which avoids drm_debug_enabled() overheads. CONFIG_DRM_USE_DYNAMIC_DEBUG controls this; the memory costs are substantial (many new/converted drm callsites, 56 bytes/pr_debug), so the choice should be made by the user.
#prdbgs KiB #with DRM_USE_DYNAMIC_DEBUG=y
kernel 3079 166k
drm 1 .06k 376 21k
drm_kms_helper 207 12k
i915 167 9.3k 1811 101k amdgpu 2339 130k 3917 220k nouveau 3 .17k 105 ~60k
DEFINE_DYNAMIC_DEBUG_CATEGORIES is used to create the controlling bitmap, which is wired to __drm_debug var so remaining drm_debug_enabled() users stay in sync.
this is v8:
- 7 small tweaks to dyndbg pr-infos etc, no functional changes
- drop help field from dyndbg_bitdesc
- simplify declarative interface
- move ^ anchor, trailing space to macro helper
this makes callback slightly more generic
- i915/gvt move code, Makefile bits per Tvrtko
- mem cost numbers
- more CI fixes
I think the dyndbg patches qualify to get in this cycle; all but the last are no-functional-changes, the last is a new feature (which uses existing mechanics without any adjustments), and has no users yet, so it can't cause regressions.
Obviously, DRM is the anticipated user. I've fixed the patchwork CI problems I have seen on v6, v7, and lkp-robot reports since. Since CONFIG_DRM_USE_DYNAMIC_DEBUG=y by default, it should have seen "on" testing, not just "off" testing.
Jim Cromie (16):
Dyndbg no-functional-changes chunk:
dyndbg: add module to a vpr-info in dd-exec-queries
dyndbg: pr-info in boot-param should say so
dyndbg: rationalize verbosity
dyndbg: use alt-quotes in vpr-infos, not those user might use
dyndbg: vpr-info on remove-module complete, not starting
dyndbg: no vpr-info on empty queries
dyndbg-doc: fix bootparam usage example (possible conflict
New Feature, using unchanged mechanisms:
dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES bitmap and callbacks
DRM 1st user(s):
drm: fix doc grammar error
i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES for existing prdbgs
amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES on existing prdbgs
drm_print: add choice to use dynamic debug in drm-debug
drm_print: instrument drm_debug_enabled
amdgpu_ucode: reduce number of pr_debug calls
nouveau: fold multiple DRM_DEBUG_DRIVERs together
.../admin-guide/dynamic-debug-howto.rst | 8 +- drivers/gpu/drm/Kconfig | 26 ++ drivers/gpu/drm/Makefile | 3 + drivers/gpu/drm/amd/amdgpu/Makefile | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 293 ++++++++++-------- .../gpu/drm/amd/display/dc/core/dc_debug.c | 43 ++- drivers/gpu/drm/drm_print.c | 53 +++- drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gvt/debug.h | 18 +- drivers/gpu/drm/i915/intel_gvt.c | 34 ++ drivers/gpu/drm/nouveau/nouveau_drm.c | 36 ++- include/drm/drm_drv.h | 2 +- include/drm/drm_print.h | 184 ++++++++--- include/linux/dynamic_debug.h | 62 ++++ lib/dynamic_debug.c | 121 ++++++-- 15 files changed, 650 insertions(+), 237 deletions(-)
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 1/16 dyndbg: add module to a vpr-info in dd-exec-queries
dd-exec-queries accepts a separate module arg (so it can support $module.dyndbg cmdline arg), add it to the vpr-info for more context.
--- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +1 -1
@@ -529,7 +529,7 @@ static int ddebug_exec_queries(char *query, const char *modname)if (!query || !*query || *query =='#' )continue ; -vpr_info ("query %d: \"%s\"\n" , i, query); +v2pr_info ("query %d: \"%s\" mod:%s\n" , i, query, modname ?:"*" ); rc =ddebug_exec_query (query, modname);if (rc <0 ) {
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 2/16 dyndbg: pr-info in boot-param should say so
In reply to Jim Cromieadd "bootparam" to format. no functional changes.
--- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +1 -1
@@ -998,7 +998,7 @@ static int ddebug_dyndbg_param_cb(char *param, char *val,static int ddebug_dyndbg_boot_param_cb (char *param,char *val,const char *unused,void *arg) { -vpr_info ("%s=\"%s\"\n" , param, val); +vpr_info ("bootparam %s=\"%s\"\n" , param, val);return ddebug_dyndbg_param_cb (param, val,NULL ,0 ); }
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 3/16 dyndbg: rationalize verbosity
In reply to Jim Cromiechange current v*pr_info() calls to fit this new scheme:
-1 module add/remove, callsite counts - a few v2s here now -2 command ingest, splitting
-3 command parsing - many v1s here now
-4 per-site changes - was v2
2 is new, to isolate a problem where a stress-test script (which feeds large multi-command strings) would produce short writes, truncating last command and confusing test results.
4 gets per-callsite "changed:" pr-infos, which are very noisy during stress tests, and obscure v1-3 messages.
Update docs verbose example to 3 per its comment
--- .../admin-guide/dynamic-debug-howto.rst | 2 +- lib/dynamic_debug.c | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-)
Documentation/admin-guide/dynamic-debug-howto.rst +1 -1
@@ -358,7 +358,7 @@ Examples // boot-args example, with newlines and comments for readability Kernel command line: ... // see whats going on in dyndbg=value processing - dynamic_debug.verbose=1 + dynamic_debug.verbose=3 // enable pr_debugs in 2 builtins, #cmt is stripped dyndbg="module params +p #cmt ; module sys +p" // enable pr_debugs in 2 functions in a module loaded later
lib/dynamic_debug.c +12 -10
@@ -118,6 +118,8 @@ do { \#define vpr_info (fmt, ...) vnpr_info(1, fmt, ##__VA_ARGS__)#define v2pr_info (fmt, ...) vnpr_info(2, fmt, ##__VA_ARGS__) +#define v3pr_info (fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) +#define v4pr_info (fmt, ...) vnpr_info(4, fmt, ##__VA_ARGS__)static void vpr_info_dq (const struct ddebug_query *query,const char *msg) {
@@ -130,7 +132,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) fmtlen--; } - vpr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", + v3pr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", msg, query->function ?: "", query->filename ?: "",
@@ -213,7 +215,7 @@ static int ddebug_change(const struct ddebug_query *query,static_branch_enable (&dp->key.dd_key_true);#endif dp->flags = newflags; -v2pr_info ("changed %s:%d [%s]%s =%s\n" , +v4pr_info ("changed %s:%d [%s]%s =%s\n" ,trim_prefix (dp->filename), dp->lineno, dt->mod_name, dp->function,ddebug_describe_flags (dp->flags, &fbuf));
@@ -273,7 +275,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) buf = end; } -if (verbose) { +if (verbose >=3 ) {int i;pr_info ("split into words:" );for (i =0 ; i < nwords; i++)
@@ -333,7 +335,7 @@ static int parse_linerange(struct ddebug_query *query, const char *first) }else { query->last_lineno = query->first_lineno; } -vpr_info ("parsed line %d-%d\n" , query->first_lineno, +v3pr_info ("parsed line %d-%d\n" , query->first_lineno, query->last_lineno);return 0 ; }
@@ -447,7 +449,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)pr_err ("bad flag-op %c, at start of %s\n" , *str, str);return -EINVAL ; } -vpr_info ("op='%c'\n" , op); +v3pr_info ("op='%c'\n" , op);for (; *str ; ++str) {for (i =ARRAY_SIZE (opt_array) -1 ; i >=0 ; i--) {
@@ -461,7 +463,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)return -EINVAL ; } } -vpr_info ("flags=0x%x\n" , modifiers->flags); +v3pr_info ("flags=0x%x\n" , modifiers->flags);/* calculate final flags, mask based upon op */ switch (op) {
@@ -477,7 +479,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags =0 ;break ; } -vpr_info ("*flagsp=0x%x *maskp=0x%x\n" , modifiers->flags, modifiers->mask); +v3pr_info ("*flagsp=0x%x *maskp=0x%x\n" , modifiers->flags, modifiers->mask);return 0 ; }
@@ -540,7 +542,7 @@ static int ddebug_exec_queries(char *query, const char *modname) } i++; } -vpr_info ("processed %d queries, with %d matches, %d errs\n" , +v2pr_info ("processed %d queries, with %d matches, %d errs\n" , i, nfound, errs);if (exitcode)
@@ -781,7 +783,7 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, tmpbuf =memdup_user_nul (ubuf, len);if (IS_ERR (tmpbuf))return PTR_ERR (tmpbuf); -vpr_info ("read %d bytes from userspace\n" , (int )len); +v2pr_info ("read %u bytes from userspace <\n%s>\n" , (unsigned )len, tmpbuf); ret =ddebug_exec_queries (tmpbuf,NULL );kfree (tmpbuf);
@@ -969,7 +971,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,list_add (&dt->link, &ddebug_tables);mutex_unlock (&ddebug_lock); -v2pr_info ("%3u debug prints in module %s\n" , n, dt->mod_name); +vpr_info ("%3u debug prints in module %s\n" , n, dt->mod_name);return 0 ; }
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 4/16 dyndbg: use alt-quotes in vpr-infos, not those user might use
In reply to Jim Cromieecho $cmd > control can be finicky with respect to quoting (mostly wrt * expansion), so lets not complicate things by adding our own in debug messages. Quote as <%s> instead of '%s' or \"%s\"
--- lib/dynamic_debug.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
lib/dynamic_debug.c +8 -8
@@ -132,7 +132,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) fmtlen--; } - v3pr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", + v3pr_info("%s: func=<%s> file=<%s> module=<%s> format=<%.*s> lineno=%u-%u\n", msg, query->function ?: "", query->filename ?: "",
@@ -279,7 +279,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)int i;pr_info ("split into words:" );for (i =0 ; i < nwords; i++) -pr_cont (" \"%s\"" , words[i]); +pr_cont (" <%s>" , words[i]);pr_cont ("\n" ); }
@@ -419,7 +419,7 @@ static int ddebug_parse_query(char *words[], int nwords,if (parse_linerange (query, arg))return -EINVAL ; }else { -pr_err ("unknown keyword \"%s\"\n" , keyword); +pr_err ("unknown keyword <%s>\n" , keyword);return -EINVAL ; }if (rc)
@@ -449,7 +449,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers)pr_err ("bad flag-op %c, at start of %s\n" , *str, str);return -EINVAL ; } -v3pr_info ("op='%c'\n" , op); +v3pr_info ("op=<%c>\n" , op);for (; *str ; ++str) {for (i =ARRAY_SIZE (opt_array) -1 ; i >=0 ; i--) {
@@ -531,7 +531,7 @@ static int ddebug_exec_queries(char *query, const char *modname)if (!query || !*query || *query =='#' )continue ; -v2pr_info ("query %d: \"%s\" mod:%s\n" , i, query, modname ?:"*" ); +v2pr_info ("query %d: <%s> mod:<%s>\n" , i, query, modname ?:"*" ); rc =ddebug_exec_query (query, modname);if (rc <0 ) {
@@ -1000,7 +1000,7 @@ static int ddebug_dyndbg_param_cb(char *param, char *val,static int ddebug_dyndbg_boot_param_cb (char *param,char *val,const char *unused,void *arg) { -vpr_info ("bootparam %s=\"%s\"\n" , param, val); +vpr_info ("bootparam %s=<%s>\n" , param, val);return ddebug_dyndbg_param_cb (param, val,NULL ,0 ); }
@@ -1011,7 +1011,7 @@ static int ddebug_dyndbg_boot_param_cb(char *param, char *val,*/ int ddebug_dyndbg_module_param_cb (char *param,char *val,const char *module) { -vpr_info ("module: %s %s=\"%s\"\n" , module, param, val); +vpr_info ("module: %s %s=<%s>\n" , module, param, val);return ddebug_dyndbg_param_cb (param, val, module, -ENOENT ); }
@@ -1030,7 +1030,7 @@ int ddebug_remove_module(const char *mod_name)struct ddebug_table *dt, *nextdt;int ret = -ENOENT ; -v2pr_info ("removing module \"%s\"\n" , mod_name); +v2pr_info ("removing module <%s>\n" , mod_name);mutex_lock (&ddebug_lock);list_for_each_entry_safe (dt, nextdt, &ddebug_tables, link) {
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 5/16 dyndbg: vpr-info on remove-module complete, not starting
In reply to Jim CromieOn qemu --smp 3 runs, remove-module can get called 3 times. Instead, print once at end, if entry was found and removed.
--- lib/dynamic_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/dynamic_debug.c +2 -2
@@ -1030,8 +1030,6 @@ int ddebug_remove_module(const char *mod_name)struct ddebug_table *dt, *nextdt;int ret = -ENOENT ; -v2pr_info ("removing module <%s>\n" , mod_name); -mutex_lock (&ddebug_lock);list_for_each_entry_safe (dt, nextdt, &ddebug_tables, link) {if (dt->mod_name == mod_name) {
@@ -1041,6 +1039,8 @@ int ddebug_remove_module(const char *mod_name) } }mutex_unlock (&ddebug_lock); +if (!ret) +v2pr_info ("removed module <%s>\n" , mod_name);return ret; }
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 6/16 dyndbg: no vpr-info on empty queries
In reply to Jim Cromiewhen echo $cmd > control contains multiple queries, extra query separators (;\n) can parse as empty statements. This is normal, and pr-info on empty command is just noise. Also change varname.
--- lib/dynamic_debug.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
lib/dynamic_debug.c +7 -6
@@ -520,9 +520,9 @@ static int ddebug_exec_query(char *query_string, const char *modname)static int ddebug_exec_queries (char *query,const char *modname) {char *split; -int i, errs =0 , exitcode =0 , rc, nfound =0 ; +int qct, errs =0 , exitcode =0 , rc, nfound =0 ; -for (i =0 ; query; query = split) { +for (qct =0 ; query; query = split) { split =strpbrk (query,";\n" );if (split) *split++ ='\0' ;
@@ -531,7 +531,7 @@ static int ddebug_exec_queries(char *query, const char *modname)if (!query || !*query || *query =='#' )continue ; -v2pr_info ("query %d: <%s> mod:<%s>\n" , i, query, modname ?:"*" ); +v2pr_info ("query %d: <%s> mod:<%s>\n" , qct, query, modname ?:"*" ); rc =ddebug_exec_query (query, modname);if (rc <0 ) {
@@ -540,10 +540,11 @@ static int ddebug_exec_queries(char *query, const char *modname) }else { nfound += rc; } - i++; + qct++; } -v2pr_info ("processed %d queries, with %d matches, %d errs\n" , - i, nfound, errs); +if (qct) +v2pr_info ("processed %d queries, with %d matches, %d errs\n" , + qct, nfound, errs);if (exitcode)return exitcode;
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 7/16 dyndbg-doc: fix bootparam usage example
In reply to Jim CromieThis example uses dyndbg as a core/kernel param; it is a (fake) module param. Using it as given gets an "Unknown command line parameters:" warning. Fix the broken example.
--- Documentation/admin-guide/dynamic-debug-howto.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Documentation/admin-guide/dynamic-debug-howto.rst +2 -4
@@ -359,7 +359,5 @@ Examples Kernel command line: ... // see whats going on in dyndbg=value processing dynamic_debug.verbose=3 - // enable pr_debugs in 2 builtins, #cmt is stripped - dyndbg="module params +p #cmt ; module sys +p" - // enable pr_debugs in 2 functions in a module loaded later - pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p" + // enable pr_debugs in 2 builtins, 1 loadable modules init* funcs + params.dyndbg=+p sys.dyndbg=+p pc87360.dyndbg="func init* +p"
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 8/16 dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES bitmap and callbacks
In reply to Jim CromieDEFINE_DYNAMIC_DEBUG_CATEGORIES(fsname, var, bitmap_desc, @bit_descs) allows users to create a drm.debug style (bitmap) sysfs interface, mapping each bit to a pr_debug "category".
Unlike drm, dyndbg has no coding of "category", but it can select a set of pr_debugs with a substr match on their formats. Since many pr_debugs use a system of format prefixes, dyndbg can en/disable those existing groupings as sets/categories.
the new macro's categories are used like so:
echo format '^$category ' +/-p >control
DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug,
"i915/gvt bitmap desc", /* * map each bit to a category * helper macro adds ^ prefix and ' ' suffix seen above */ _DD_cat_(0, "gvt:cmd:"), _DD_cat_(1, "gvt:core:"), _DD_cat_(2, "gvt:dpy:"), _DD_cat_(3, "gvt:el:"), _DD_cat_(4, "gvt:irq:"), _DD_cat_(5, "gvt:mm:"), _DD_cat_(6, "gvt:mmio:"), _DD_cat_(7, "gvt:render:"), _DD_cat_(8, "gvt:sched:"));
- int param_set_dyndbg()
- int param_get_dyndbg()
- struct kernel_param_ops param_ops_dyndbg
Following the model of kernel/params.c STANDARD_PARAM_DEFS, these are non-static and exported.
get/set use an augmented kernel_param; the arg refs a new struct dyndbg_bitmap_param containing:
A- the map (array, indexed by bitpos) of "categories" (strings to find
in prdbg.formats). These define the set/category of callsites per bit.
B- a pointer to the user's ulong holding the bits/state.
by sharing state, we coordinate with code that still uses it directly
B allows drm-debug api to be converted incrementally, while still using __drm_debug & drm_debug_enabled() in other parts.
param_set_dyndbg() compares new vs old bits, and only updates prdbgs on changes. This maximally preserves the underlying state, which may have been customized via later echo $cmd >control. So if a user really wants to know that all prdbgs are set precisely, they must pre-clear then set.
dynamic_debug.h:
Add DEFINE_DYNAMIC_DEBUG_CATEGORIES() described above, and a stub throwing a BUILD_BUG (RFC) when used without DYNAMIC_DEBUG support.
Add structs dyndbg_bitdesc, dyndbg_bitmap_param to support the main macro, and several helper macros wrapping the given categories with ^prefix and ' ' suffix. This way the callback can be more broadly used, by using the right helper macro.
Also externs the struct kernel_param param_ops_dyndbg symbol, as is done in moduleparams.h for all the STANDARD params.
USAGE NOTES:
Using dyndbg to query on "format ^$prefix" requires that $prefix must be present in the compiled-in format string. Searching on "%s" does not define a useful set of callsites.
Using DEFINE_DYNAMIC_DEBUG_CATEGORIES wo support gets a BUILD_BUG. ISTM there is already action at a declarative distance, nobody needs mystery as to why the /sysfs thingy didn't appear.
Dyndbg is completely agnostic wrt the categorization scheme used, in order to play well with any prefix convention already in use in the codebase. Ad-hoc categories and sub-categories are implicitly allowed, author discipline and review is expected.
In fact, the ^anchor is not required; "format $floating_substr" is the default meaning. The _DD_cat_() helper macro adds the ^anchor, and a trailing space (see below for why).
Here are some examples: (these all need ^anchor to be practical)
"^1","^2","^3" 2 doesn't imply 1.
otherwize, sorta like printk levels
"^1:","^2:","^3:" are better, avoiding [1-9]\d+ ambiguity
"^hi:","^mid:","^low:" are reasonable, and imply independence
"^todo:","^rfc:" might be handy
"^A:".."^Z:" uhm, yeah
Hierarchical classes/categories are natural:
"^drm:<CAT>:" is used in a later commit
"^drm:<CAT>:<SUB>:" is a natural extension.
"^drm:atomic:fail:" has been proposed, sounds directly useful
High density "punctuation" tld classification is possible:
"^.","^:","^!","^#","^@", etc.
NB: in a real sense we abandon enum strictures here, and lose some compiler help, on spelling errs for example. Obviously "drm:" != "DRM:".
Some properties of a hierarchical category deserve explication:
Trailing spaces matter !
With 1..3-space ("drm: ", "drm:atomic: ", "drm:atomic:fail: "), the ":" doesn't terminate the search-space, the trailing space does. So a "drm:" search spec will match all DRM categories & subcategories, and will not be useful in an interface where all categories are already controlled together. That said, "drm:atomic:" & "drm:atomic: " are different, and both are useful in cases.
Ad-Hoc categories & sub-categories:
Ad-hoc categories are those format-prefixes already in use; both amdgpu and i915 have numerous (120,~1800) pr_debugs, most of these use a system, a small set (9,13) of prefixes, to categorize the output. Dyndbg already works on these, this patch just adds a bitmap knob.
ad-hoc sub-categories are slightly trickier.
If drm_dbg_atomic("fail: ...") is a macro:
pr_debug("drm:atomic:" " " format,...) // cpp-paste in a trailing space
We get "drm:atomic: fail:", with that undesirable embedded space; obviously not ideal wrt clear and simple prefixes.
a fix: drm_dbg_atomic_("fail: ..."); // trailing _ for ad-hoc subcat
Summarizing:
- "drm:kms: " & "drm:kms:" are different
- "drm:kms" also different - includes drm:kms2:
- "drm:kms:\t" also different - could be troublesome
- "drm:kms:*" doesn't work, no wildcard on format atm.
Order matters in DEFINE_DYNAMIC_DEBUG_CATEGORIES(... @bit_descs)
Since bits are/will-stay applied 0-N, the later bits can countermand the earlier ones, but it is tricky - consider;
DD_CATs(... "drm:atomic:", "drm:atomic:fail:" ) // misleading
The 1st search-term is misleading, because it includes (modifies) subcategories, but then 2nd overrides it. So don't do that.
---
v5:
. rename to DEFINE_DYNAMIC_DEBUG_CATEGORIES from DEFINE_DYNDBG_BITMAP . in set_dyndbg, replace hardcoded "i915" w kp->mod->name . static inline the stubs
. const *str in structs, const array. - Emil
. dyndbg: add do-nothing DEFINE_DYNAMIC_DEBUG_CATEGORIES if !DD_CORE . call MOD_PARM_DESC(name, "$desc") for users
. simplify callback, remove bit-change detection
. config errs reported by <[email protected]>
v6:
. return rc, bitmap->, snprintf, ws - Andy Shevchenko
. s/chgct/matches/ - old varname is misleading
. move code off file bottom to a "better" place
. change ##fsname to ##var for less generic varname (ie: not "debug") . add KP_MOD_NAME workaround for !CONFIG_MODULES
. move forward decl down to where its needed
v7:
. use kp->arg, dont need kp->data or previous patch-1 - jbaron . use client's ulong for bits, share state
. throw BUILD_BUG if DEFINE_DYNAMIC_DEBUG_CATEGORIES used wo support
v8:
. drop help field from dyndbg_bitdesc
. move ^ constraint from callback to helper macro: _DD_cat_ . add other helper macros
--- include/linux/dynamic_debug.h | 62 ++++++++++++++++++++++++++++ lib/dynamic_debug.c | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+)
include/linux/dynamic_debug.h +62 -0
@@ -181,6 +181,10 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, KERN_DEBUG, prefix_str, prefix_type, \ rowsize, groupsize, buf, len, ascii) +struct kernel_param ; +int param_set_dyndbg (const char *instr,const struct kernel_param *kp); +int param_get_dyndbg (char *buffer,const struct kernel_param *kp); +#else /* !CONFIG_DYNAMIC_DEBUG_CORE */ #include <linux/string.h>
@@ -227,6 +231,64 @@ static inline int dynamic_debug_exec_queries(const char *query, const char *modnreturn 0 ; } +struct kernel_param ; +static inline int param_set_dyndbg (const char *instr,const struct kernel_param *kp) +{return 0 ; } +static inline int param_get_dyndbg (char *buffer,const struct kernel_param *kp) +{return 0 ; } +#endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ +struct dyndbg_bitdesc { +const char *match;/* search format for this substr */ +}; + +struct dyndbg_bitmap_param { +unsigned long *bits;/* ref to shared state */ +struct dyndbg_bitdesc map[];/* indexed by bitpos */ +}; + +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) +/** +* DEFINE_DYNAMIC_DEBUG_CATEGORIES() - bitmap control of categorized prdbgs +* @fsname: parameter basename under /sys +* @_var: C-identifier holding bitmap +* @desc: string summarizing the controls provided +* @...: list of struct dyndbg_bitdesc initializations +* +* Intended for modules with substantial use of "categorized" prdbgs +* (those with some systematic prefix in the format string), this lets +* modules using pr_debug to control them in groups according to their +* format prefixes, and map them to bits 0-N of a sysfs control point. +* Each @... gives the index and prefix map. +*/ +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, _var, desc, ...) \ + MODULE_PARM_DESC(fsname, desc); \ + static struct dyndbg_bitmap_param ddcats_##_var = \ + { .bits = &(_var), .map = { __VA_ARGS__, { .match = NULL }}}; \ + module_param_cb(fsname, ¶m_ops_dyndbg, &ddcats_##_var, 0644) + +/* helper macros provide combos of ^prefix and ' ' postfix */ +#define _DD_cat_ (N , pfx) [N] = { .match = "^" pfx " " } +#define _DD_cats_ (N , pfx) [N] = { .match = "^" pfx } +#define _DD_subtr_ (N , flt) [N] = { .match = flt } + +extern const struct kernel_param_ops param_ops_dyndbg; + +#elif (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && !defined(DYNAMIC_DEBUG_MODULE )) + +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, var, bitmap_desc, ...) \ + BUILD_BUG_ON_MSG(1, "you need -DDYNAMIC_DEBUG_MODULE in compile") +#define _DD_cat_ (pfx) +#define _DD_cats_ (N , pfx) +#define _DD_subtr_ (N , flt) +#else +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, var, bitmap_desc, ...) \ + BUILD_BUG_ON_MSG(1, "CONFIG_DYNAMIC_DEBUG needed to use this macro: " #var) +#define _DD_cat_ (pfx) +#define _DD_cats_ (pfx) +#define _DD_subtr_ (N , flt) +#endif +#endif
lib/dynamic_debug.c +76 -0
82 lines not on this page · raw message
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 9/16 drm: fix doc grammar error
In reply to Jim Cromieno code changes, good for rc
--- include/drm/drm_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_drv.h +1 -1
@@ -522,7 +522,7 @@ void *__devm_drm_dev_alloc(struct device *parent,* @type: the type of the struct which contains struct &drm_device * @member: the name of the &drm_device within @type. * -* This allocates and initialize a new DRM device. No device registration is done. +* This allocates and initializes a new DRM device. No device registration is done. * Call drm_dev_register() to advertice the device to user space and register it * with other core subsystems. This should be done last in the device * initialization sequence to make sure userspace can't access an inconsistent
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 10/16 i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes
In reply to Jim CromieTaking embedded spaces out of existing prefixes makes them better class-prefixes; simplifying the extra quoting needed otherwise:
$> echo format "^gvt: core:" +p >control
Dropping the internal spaces means any trailing space in a query will more clearly terminate the prefix being searched for.
Consider a generic drm-debug example:
# turn off ATOMIC reports echo format "^drm:atomic: " -p > control
# turn off all ATOMIC:* reports, including any sub-categories echo format "^drm:atomic:" -p > control
# turn on ATOMIC:FAIL: reports echo format "^drm:atomic:fail: " +p > control
Removing embedded spaces in the class-prefixes simplifies the corresponding match-prefix. This means that "quoted" match-prefixes are only needed when the trailing space is desired, in order to exclude explicitly sub-categorized pr-debugs; in this example, "drm:atomic:fail:".
RFC: maybe the prefix catenation should paste in the " " class-prefix terminator explicitly. A pr_debug_() flavor could exclude the " ", allowing ad-hoc sub-categorization by appending for example, "fail:" to "drm:atomic:" without the default " " insertion.
---
v8:
. fix patchwork CI warning
--- drivers/gpu/drm/i915/gvt/debug.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gvt/debug.h +9 -9
@@ -36,30 +36,30 @@ do { \ } while (0) #define gvt_dbg_core(fmt, args...) \ - pr_debug("gvt: core: "fmt, ##args) + pr_debug("gvt:core: " fmt, ##args) #define gvt_dbg_irq(fmt, args...) \ - pr_debug("gvt: irq: "fmt, ##args) + pr_debug("gvt:irq: " fmt, ##args) #define gvt_dbg_mm(fmt, args...) \ - pr_debug("gvt: mm: "fmt, ##args) + pr_debug("gvt:mm: " fmt, ##args) #define gvt_dbg_mmio(fmt, args...) \ - pr_debug("gvt: mmio: "fmt, ##args) + pr_debug("gvt:mmio: " fmt, ##args) #define gvt_dbg_dpy(fmt, args...) \ - pr_debug("gvt: dpy: "fmt, ##args) + pr_debug("gvt:dpy: " fmt, ##args) #define gvt_dbg_el(fmt, args...) \ - pr_debug("gvt: el: "fmt, ##args) + pr_debug("gvt:el: " fmt, ##args) #define gvt_dbg_sched(fmt, args...) \ - pr_debug("gvt: sched: "fmt, ##args) + pr_debug("gvt:sched: " fmt, ##args) #define gvt_dbg_render(fmt, args...) \ - pr_debug("gvt: render: "fmt, ##args) + pr_debug("gvt:render: " fmt, ##args) #define gvt_dbg_cmd(fmt, args...) \ - pr_debug("gvt: cmd: "fmt, ##args) + pr_debug("gvt:cmd: " fmt, ##args)#endif
Signature · 1 line
2.31.1
Re: [PATCH v8 10/16] i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes
Quoted 73 lines · Jim Cromie
Taking embedded spaces out of existing prefixes makes them better class-prefixes; simplifying the extra quoting needed otherwise:
$> echo format "^gvt: core:" +p >control
Dropping the internal spaces means any trailing space in a query will more clearly terminate the prefix being searched for.
Consider a generic drm-debug example:
# turn off ATOMIC reports echo format "^drm:atomic: " -p > control# turn off all ATOMIC:* reports, including any sub-categories echo format "^drm:atomic:" -p > control# turn on ATOMIC:FAIL: reports echo format "^drm:atomic:fail: " +p > controlRemoving embedded spaces in the class-prefixes simplifies the corresponding match-prefix. This means that "quoted" match-prefixes are only needed when the trailing space is desired, in order to exclude explicitly sub-categorized pr-debugs; in this example, "drm:atomic:fail:".
RFC: maybe the prefix catenation should paste in the " " class-prefix terminator explicitly. A
pr_debug_()flavor could exclude the " ", allowing ad-hoc sub-categorization by appending for example, "fail:" to "drm:atomic:" without the default " " insertion.Signed-off-by Jim Cromie <[email protected]>---
v8:
. fix patchwork CI warning--- drivers/gpu/drm/i915/gvt/debug.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/gvt/debug.h +7
-7@@ -36,30 +36,30 @@ do { \ } while (0) #define gvt_dbg_core(fmt, args...) \ - pr_debug("gvt: core: "fmt, ##args) + pr_debug("gvt:core: " fmt, ##args) #define gvt_dbg_irq(fmt, args...) \ - pr_debug("gvt: irq: "fmt, ##args) + pr_debug("gvt:irq: " fmt, ##args) #define gvt_dbg_mm(fmt, args...) \ - pr_debug("gvt: mm: "fmt, ##args) + pr_debug("gvt:mm: " fmt, ##args) #define gvt_dbg_mmio(fmt, args...) \ - pr_debug("gvt: mmio: "fmt, ##args) + pr_debug("gvt:mmio: " fmt, ##args) #define gvt_dbg_dpy(fmt, args...) \ - pr_debug("gvt: dpy: "fmt, ##args) + pr_debug("gvt:dpy: " fmt, ##args) #define gvt_dbg_el(fmt, args...) \ - pr_debug("gvt: el: "fmt, ##args) + pr_debug("gvt:el: " fmt, ##args) #define gvt_dbg_sched(fmt, args...) \ - pr_debug("gvt: sched: "fmt, ##args) + pr_debug("gvt:sched: " fmt, ##args)
drivers/gpu/drm/i915/gvt/debug.h do { \ · line 65
Quoted 10 lines
drivers/gpu/drm/i915/gvt/debug.h +2
-2#define gvt_dbg_render(fmt, args...) \ - pr_debug("gvt: render: "fmt, ##args) + pr_debug("gvt:render: " fmt, ##args) #define gvt_dbg_cmd(fmt, args...) \ - pr_debug("gvt: cmd: "fmt, ##args) + pr_debug("gvt:cmd: " fmt, ##args)#endif
Looks good to me. Thanks!
Jim Cromie
maintainerPATCH v8 11/16 i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES for existing prdbgs
In reply to Jim CromieThe gvt component of this driver has ~120 pr_debugs, in 9 categories quite similar to those in DRM. Following the interface model of drm.debug, add a parameter to map bits to these categorizations.
DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug,
"dyndbg bitmap desc", _DD_cat_(0, "gvt:cmd:"), _DD_cat_(1, "gvt:core:"), _DD_cat_(2, "gvt:dpy:"), _DD_cat_(3, "gvt:el:"), _DD_cat_(4, "gvt:irq:"), _DD_cat_(5, "gvt:mm:"), _DD_cat_(6, "gvt:mmio:"), _DD_cat_(7, "gvt:render:"), _DD_cat_(8, "gvt:sched:"));
If CONFIG_DYNAMIC_DEBUG_CORE=y, then gvt/Makefile adds -DDYNAMIC_DEBUG_MODULE to cflags, which CONFIG_DYNAMIC_DEBUG=n (CORE-only) builds need. This is redone more comprehensively soon.
---
v5:
. static decl of vector of bit->class descriptors - Emil.V . relocate gvt-makefile chunk from elsewhere
v7:
. move ccflags addition up to i915/Makefile from i915/gvt
v8:
. relocate DDD_CAT decl code into intel_gvt.c - Tvrtko
cflags back to i915/Makefile
. add -DDYNAMIC_DEBUG_MODULE to support DYNAMIC_DEBUG_CORE-only builds
heres unchanged? footprint:
bash-5.1# for m in i915 amdgpu nouveau; do modprobe $m; done
dyndbg: 1 debug prints in module drm dyndbg: 2 debug prints in module ttm dyndbg: 8 debug prints in module video dyndbg: 167 debug prints in module i915 dyndbg: 2339 debug prints in module amdgpu [drm] amdgpu kernel modesetting enabled. amdgpu: CRAT table disabled by module option amdgpu: Virtual CRAT table created for CPU amdgpu: Topology: Add CPU node dyndbg: 3 debug prints in module wmi dyndbg: 3 debug prints in module nouveau --- drivers/gpu/drm/i915/Makefile | 2 ++ drivers/gpu/drm/i915/intel_gvt.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
drivers/gpu/drm/i915/Makefile +2 -0
@@ -295,6 +295,8 @@ i915-y += intel_gvt.o include $(src)/gvt/Makefile endif +ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DDYNAMIC_DEBUG_MODULE + obj-$(CONFIG_DRM_I915) += i915.o obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
drivers/gpu/drm/i915/intel_gvt.c +34 -0
@@ -162,3 +162,37 @@ void intel_gvt_resume(struct drm_i915_private *dev_priv)if (intel_gvt_active (dev_priv))intel_gvt_pm_resume (dev_priv->gvt); } + +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG ) + +unsigned long __gvt_debug; +EXPORT_SYMBOL (__gvt_debug); + +#define help_ (_N, _cat) "\t Bit-" #_N ":\t" _cat "\n" + +#define I915_GVT_CATEGORIES (name) \ + " Enable debug output via /sys/module/i915/parameters/" #name \ + ", where each bit enables a debug category.\n" \ + help_(0, "gvt:cmd:") \ + help_(1, "gvt:core:") \ + help_(2, "gvt:dpy:") \ + help_(3, "gvt:el:") \ + help_(4, "gvt:irq:") \ + help_(5, "gvt:mm:") \ + help_(6, "gvt:mmio:") \ + help_(7, "gvt:render:") \ + help_(8, "gvt:sched:") + +DEFINE_DYNAMIC_DEBUG_CATEGORIES (debug_gvt, __gvt_debug, +I915_GVT_CATEGORIES (debug_gvt), +_DD_cat_ (0 ,"gvt:cmd:" ), +_DD_cat_ (1 ,"gvt:core:" ), +_DD_cat_ (2 ,"gvt:dpy:" ), +_DD_cat_ (3 ,"gvt:el:" ), +_DD_cat_ (4 ,"gvt:irq:" ), +_DD_cat_ (5 ,"gvt:mm:" ), +_DD_cat_ (6 ,"gvt:mmio:" ), +_DD_cat_ (7 ,"gvt:render:" ), +_DD_cat_ (8 ,"gvt:sched:" )); + +#endif
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 12/16 amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES on existing prdbgs
In reply to Jim Cromielogger_types.h defines many DC_LOG_*() categorized debug wrappers. Most of these already use DRM debug API, so are controllable using drm.debug, but others use a bare pr_debug("$prefix: .."), with 1 of 13 different class-prefixes matching ~/^\[[_A-Z]+\]:/
Use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create a sysfs location which maps from bits to these 13 sets of categorized pr_debugs to en/disable.
Makefile adds -DDYNAMIC_DEBUG_MODULE for CONFIG_DYNAMIC_DEBUG_CORE, otherwise BUILD_BUG_ON triggers (obvious misuses are better than mysterious ones).
Anyway heres a baseline, of existing prdbg use.
Each callsite costs 56 bytes of kernel .data
amdgpu has "extra" prdbgs due to macro expansion.
(see repeating linenos in control)
(it also has substantial use of drm.debug)
- tedious fix but clear size payoff, as a separate patch, later.
bash-5.1# for m in i915 amdgpu nouveau; do modprobe $m; done
dyndbg: 1 debug prints in module drm dyndbg: 2 debug prints in module ttm dyndbg: 8 debug prints in module video dyndbg: 167 debug prints in module i915 dyndbg: 2339 debug prints in module amdgpu dyndbg: 3 debug prints in module wmi dyndbg: 3 debug prints in module nouveau
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 + .../gpu/drm/amd/display/dc/core/dc_debug.c | 43 ++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/Makefile +2 -0
@@ -38,6 +38,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd +ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DYNAMIC_DEBUG_MODULE + amdgpu-y := amdgpu_drv.o # add KMS driver
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +42 -1
50 lines not on this page · raw message
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 13/16 drm_print: add choice to use dynamic debug in drm-debug
In reply to Jim Cromiedrm's debug system writes 10 distinct categories of messages to syslog using a small API[1]: drm_dbg*(10 names), DRM_DEV_DEBUG*(3 names), DRM_DEBUG*(8 names). There are thousands of these callsites, each categorized in this systematized way.
These callsites can be enabled at runtime by their category, each controlled by a bit in drm.debug (/sys/modules/drm/parameter/debug). In the current "basic" implementation, drm_debug_enabled() tests these bits in __drm_debug each time an API[1] call is executed; while cheap individually, the costs accumulate with uptime.
This patch uses dynamic-debug with (required) jump-label to patch enabled calls onto their respective NOOP slots, avoiding all runtime bit-checks of __drm_debug by drm_debug_enabled().
Dynamic debug has no concept of category, but we can emulate one by replacing enum categories with a set of prefix-strings; "drm:core:", "drm:kms:" "drm:driver:" etc, and prepend them (at compile time) to the given formats.
Then we can use:
echo module drm format "^drm:core: " +p > control
to enable the whole category with one query.
This conversion yields many new prdbg callsites:
dyndbg: 207 debug prints in module drm_kms_helper
dyndbg: 376 debug prints in module drm
dyndbg: 1811 debug prints in module i915
dyndbg: 3917 debug prints in module amdgpu
Each site costs 56 bytes of .data, which is a big increase for drm modules, so CONFIG_DRM_USE_DYNAMIC_DEBUG makes it optional.
CONFIG_JUMP_LABEL is also required, to get the promised optimizations.
The "basic" -> "dyndbg" switchover is layered into the macro scheme
A. A "prefix" version of DRM_UT_<CATs> map, named DRM_DBG_CAT_<CATs>
"basic": DRM_DBG_CAT_<CATs> <=== DRM_UT_<CATs>. Identity map. "dyndbg":
#define DRM_DBG_CAT_KMS "drm:kms: "
#define DRM_DBG_CAT_PRIME "drm:prime: "
#define DRM_DBG_CAT_ATOMIC "drm:atomic: "
In v3, had older name, DRM_DBG_CLASS_<CATs> was countered, I had agreed, but this seems better still; CATEGORY is already DRM's term-of-art, and adding a near-synonym 'CLASS' only adds ambiguity.
DRM_UT_* are preserved, since theyre used elsewhere. Since the callback maintains its state in __drm_debug, drm_debug_enabled() will stay synchronized, and continue to work. We can address them separately if they are called enough to be worth fixing.
B. drm_dev_dbg() & drm_debug() are interposed with macros
basic: forward to renamed fn, with args preserved
enabled: redirect to pr_debug, dev_dbg, with CATEGORY format catenated
This is where drm_debug_enabled() is avoided. The prefix is prepended at compile-time, no category at runtime.
C. API[1] uses DRM_DBG_CAT_<CAT>s
These already use (B), now they use (A) too instead of DRM_UT_<CAT>, to get the correct token type for "basic" and "dyndbg" configs.
D. use DEFINE_DYNAMIC_DEBUG_CATEGORIES()
This defines the map using DRM_CAT_<CAT>s, and creates the /sysfs bitmap to control those categories.
CONFIG_DRM_USE_DYNAMIC_DEBUG is also used to adjust amdgpu, i915 makefiles to add -DDYNAMIC_DEBUG_MODULE; it includes the current CONFIG_DYNAMIC_DEBUG_CORE and is enabled by the user.
NOTES:
Because the dyndbg callback is keeping state in __drm_debug, it synchronizes with drm_debug_enabled() and its remaining users; the switchover should be transparent.
Code Review is expected to catch the lack of correspondence between bit=>prefix definitions (the selector) and the prefixes used in the API[1] layer above pr_debug()
I've coded the categories using the _DD_cat_() macro, which adds the ^anchor and trailing space. This excludes any sub-categories added later. This convention protects any "drm:atomic:fail:" callsites from getting stomped on by echo 0 > debug. Other categories could differ, but we need some default.
Dyndbg requires that the prefix be in the compiled-in format string; run-time prefixing evades callsite selection by category.
pr_debug("%s: ...", __func__, ...) // not idealUnfortunately __func__ is not a macro, and cannot be catenated at preprocess/compile time.
If you want that, you might consider +mfl flags instead;
---
v5:
. use DEFINE_DYNAMIC_DEBUG_CATEGORIES in drm_print.c
. s/DRM_DBG_CLASS_/DRM_DBG_CAT_/ - dont need another term
. default=y in Kconfig entry - per @DanVet
. move some commit-log prose to dyndbg commit
. add-prototyes to (param_get/set)_dyndbg
. more wrinkles found by <[email protected]>
. relocate ratelimit chunk from elsewhere
v6:
. add kernel doc
. fix cpp paste, drop '#'
v7:
. change __drm_debug to long, to fit with DEFINE_DYNAMIC_DEBUG_CATEGORIES . add -DDYNAMIC_DEBUG_MODULE to ccflags if DRM_USE_DYNAMIC_DEBUG v8:
. adapt to altered ^ insertion
. add mem cost numbers to kconfig
. kdoc improvements (I hope)
--- drivers/gpu/drm/Kconfig | 26 ++++ drivers/gpu/drm/Makefile | 3 + drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/drm_print.c | 53 ++++++--- drivers/gpu/drm/i915/Makefile | 2 +- include/drm/drm_print.h | 177 ++++++++++++++++++++++------ 6 files changed, 210 insertions(+), 53 deletions(-)
drivers/gpu/drm/Kconfig +26 -0
@@ -57,6 +57,32 @@ config DRM_DEBUG_MM If in doubt, say "N". +config DRM_USE_DYNAMIC_DEBUG + bool "use dynamic debug to implement drm.debug" + default y + depends on DRM + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + depends on JUMP_LABEL + help + The "basic" drm.debug facility does a lot of unlikely + bit-field tests at runtime; while cheap individually, the + cost accumulates. DYNAMIC_DEBUG can patch pr_debug()s into + NOOP slots, in a running kernel, so avoids those bit-test + overheads, and is therefore recommended by default. + + DRM_USE_DYNAMIC_DEBUG converts "basic" to "dyndbg", this + creates many new dyndbg callsites (56 bytes each), which + significantly increases drm* module .data, so is optional. + On an x86-64 kernel, with a config derived from fedora, that + price is: + #prdbgs KiB #with DRM_USE_DYNAMIC_DEBUG=y + kernel 3079 166k + drm 1 .06k 376 21k + drm_kms_helper 207 12k + i915 167 9.3k 1811 101k + amdgpu 2339 130k 3917 220k + nouveau 3 .17k 105 ~60k + config DRM_DEBUG_SELFTEST tristate "kselftests for DRM" depends on DRM
drivers/gpu/drm/Makefile +3 -0
@@ -20,6 +20,9 @@ drm-y := drm_aperture.o drm_auth.o drm_cache.o \ drm_client_modeset.o drm_atomic_uapi.o drm_hdcp.o \ drm_managed.o drm_vblank_work.o +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +ccflags-y += -DDYNAMIC_DEBUG_MODULE +#endif drm-$(CONFIG_DRM_LEGACY) += drm_agpsupport.o drm_bufs.o drm_context.o drm_dma.o \ drm_legacy_misc.o drm_lock.o drm_memory.o drm_scatter.o \ drm_vm.o
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -38,7 +38,7 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd -ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DYNAMIC_DEBUG_MODULE amdgpu-y := amdgpu_drv.o
drivers/gpu/drm/drm_print.c +37 -16
86 lines not on this page · raw message
drivers/gpu/drm/i915/Makefile +1 -1
@@ -295,7 +295,7 @@ i915-y += intel_gvt.o include $(src)/gvt/Makefile endif -ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DDYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE obj-$(CONFIG_DRM_I915) += i915.o obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
include/drm/drm_print.h +142 -35
283 lines not on this page · raw message
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 14/16 drm_print: instrument drm_debug_enabled
In reply to Jim CromieDuplicate drm_debug_enabled() code into both "basic" and "dyndbg" ifdef branches. Then add a pr_debug("todo: ...") into the "dyndbg" branch.
Then convert the "dyndbg" branch's code to a macro, so that the pr_debug() get its callsite info from the invoking function, instead of from drm_debug_enabled() itself.
This gives us unique callsite info for the 8 remaining users of drm_debug_enabled(), and lets us enable them individually to see how much logging traffic they generate. The oft-visited callsites can then be reviewed for runtime cost and possible optimizations.
Heres what we get:
bash-5.1# modprobe drm
dyndbg: 384 debug prints in module drm
bash-5.1# grep todo: /proc/dynamic_debug/controldrivers/gpu/drm/drm_edid.c:1843 [drm]connector_bad_edid =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_print.c:309 [drm]___drm_dbg =p "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_print.c:286 [drm]__drm_dev_dbg =p "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_vblank.c:1491 [drm]drm_vblank_restore =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_vblank.c:787 [drm]drm_crtc_vblank_helper_get_vblank_timestamp_internal =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_vblank.c:410 [drm]drm_crtc_accurate_vblank_count =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_atomic_uapi.c:1457 [drm]drm_mode_atomic_ioctl =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_edid_load.c:178 [drm]edid_load =_ "todo: maybe avoid via dyndbg\012"
At quick glance, edid won't qualify, drm_print might, drm_vblank is strongest chance, maybe atomic-ioctl too.
---
--- include/drm/drm_print.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
include/drm/drm_print.h +11 -6
@@ -381,6 +381,11 @@ enum drm_debug_category {#define DRM_DBG_CAT_DP DRM_UT_DP#define DRM_DBG_CAT_DRMRES DRM_UT_DRMRES +static inline bool drm_debug_enabled (enum drm_debug_category category) +{ +return unlikely (__drm_debug & category); +} +#else /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ /* join prefix + format in cpp so dyndbg can see it */
@@ -414,12 +419,13 @@ enum drm_debug_category {#define DRM_DBG_CAT_DP "drm:dp:"#define DRM_DBG_CAT_DRMRES "drm:res:" -#endif /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ +#define drm_debug_enabled (category) \ + ({ \ + pr_debug("todo: maybe avoid via dyndbg\n"); \ + unlikely(__drm_debug & (category)); \ + }) -static inline bool drm_debug_enabled (enum drm_debug_category category) -{ -return unlikely (__drm_debug & category); -} +#endif /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ /* * struct device based logging
@@ -569,7 +575,6 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,#define drm_dbg_drmres (drm, fmt, ...) \ drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_DRMRES, fmt, ##__VA_ARGS__) -/* * printk based logging *
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 15/16 amdgpu_ucode: reduce number of pr_debug calls
In reply to Jim CromieThere are blocks of DRM_DEBUG calls, consolidate their args into single calls. With dynamic-debug in use, each callsite consumes 56 bytes of callsite data, and this patch removes about 65 calls, so it saves ~3.5kb.
no functional changes.
RFC: this creates multi-line log messages, does that break any syslog conventions ?
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 293 ++++++++++++---------- 1 file changed, 158 insertions(+), 135 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +158 -135
@@ -30,17 +30,26 @@static void amdgpu_ucode_print_common_hdr (const struct common_firmware_header *hdr) { -DRM_DEBUG ("size_bytes: %u\n" ,le32_to_cpu (hdr->size_bytes)); -DRM_DEBUG ("header_size_bytes: %u\n" ,le32_to_cpu (hdr->header_size_bytes)); -DRM_DEBUG ("header_version_major: %u\n" ,le16_to_cpu (hdr->header_version_major)); -DRM_DEBUG ("header_version_minor: %u\n" ,le16_to_cpu (hdr->header_version_minor)); -DRM_DEBUG ("ip_version_major: %u\n" ,le16_to_cpu (hdr->ip_version_major)); -DRM_DEBUG ("ip_version_minor: %u\n" ,le16_to_cpu (hdr->ip_version_minor)); -DRM_DEBUG ("ucode_version: 0x%08x\n" ,le32_to_cpu (hdr->ucode_version)); -DRM_DEBUG ("ucode_size_bytes: %u\n" ,le32_to_cpu (hdr->ucode_size_bytes)); -DRM_DEBUG ("ucode_array_offset_bytes: %u\n" , -le32_to_cpu (hdr->ucode_array_offset_bytes)); -DRM_DEBUG ("crc32: 0x%08x\n" ,le32_to_cpu (hdr->crc32)); +DRM_DEBUG ("size_bytes: %u\n" +"header_size_bytes: %u\n" +"header_version_major: %u\n" +"header_version_minor: %u\n" +"ip_version_major: %u\n" +"ip_version_minor: %u\n" +"ucode_version: 0x%08x\n" +"ucode_size_bytes: %u\n" +"ucode_array_offset_bytes: %u\n" +"crc32: 0x%08x\n" , +le32_to_cpu (hdr->size_bytes), +le32_to_cpu (hdr->header_size_bytes), +le16_to_cpu (hdr->header_version_major), +le16_to_cpu (hdr->header_version_minor), +le16_to_cpu (hdr->ip_version_major), +le16_to_cpu (hdr->ip_version_minor), +le32_to_cpu (hdr->ucode_version), +le32_to_cpu (hdr->ucode_size_bytes), +le32_to_cpu (hdr->ucode_array_offset_bytes), +le32_to_cpu (hdr->crc32)); }void amdgpu_ucode_print_mc_hdr (const struct common_firmware_header *hdr)
@@ -55,9 +64,9 @@ void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr)const struct mc_firmware_header_v1_0 *mc_hdr = container_of(hdr, struct mc_firmware_header_v1_0, header); -DRM_DEBUG ("io_debug_size_bytes: %u\n" , -le32_to_cpu (mc_hdr->io_debug_size_bytes)); -DRM_DEBUG ("io_debug_array_offset_bytes: %u\n" , +DRM_DEBUG ("io_debug_size_bytes: %u\n" +"io_debug_array_offset_bytes: %u\n" , +le32_to_cpu (mc_hdr->io_debug_size_bytes),le32_to_cpu (mc_hdr->io_debug_array_offset_bytes)); }else {DRM_ERROR ("Unknown MC ucode version: %u.%u\n" , version_major, version_minor);
@@ -82,13 +91,17 @@ void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr)switch (version_minor) {case 0 : v2_0_hdr = container_of(hdr, struct smc_firmware_header_v2_0, v1_0.header); -DRM_DEBUG ("ppt_offset_bytes: %u\n" ,le32_to_cpu (v2_0_hdr->ppt_offset_bytes)); -DRM_DEBUG ("ppt_size_bytes: %u\n" ,le32_to_cpu (v2_0_hdr->ppt_size_bytes)); +DRM_DEBUG ("ppt_offset_bytes: %u\n" +"ppt_size_bytes: %u\n" , +le32_to_cpu (v2_0_hdr->ppt_offset_bytes), +le32_to_cpu (v2_0_hdr->ppt_size_bytes));break ;case 1 : v2_1_hdr = container_of(hdr, struct smc_firmware_header_v2_1, v1_0.header); -DRM_DEBUG ("pptable_count: %u\n" ,le32_to_cpu (v2_1_hdr->pptable_count)); -DRM_DEBUG ("pptable_entry_offset: %u\n" ,le32_to_cpu (v2_1_hdr->pptable_entry_offset)); +DRM_DEBUG ("pptable_count: %u\n" +"pptable_entry_offset: %u\n" , +le32_to_cpu (v2_1_hdr->pptable_count), +le32_to_cpu (v2_1_hdr->pptable_entry_offset));break ;default :break ;
@@ -111,10 +124,12 @@ void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr)const struct gfx_firmware_header_v1_0 *gfx_hdr = container_of(hdr, struct gfx_firmware_header_v1_0, header); -DRM_DEBUG ("ucode_feature_version: %u\n" , -le32_to_cpu (gfx_hdr->ucode_feature_version)); -DRM_DEBUG ("jt_offset: %u\n" ,le32_to_cpu (gfx_hdr->jt_offset)); -DRM_DEBUG ("jt_size: %u\n" ,le32_to_cpu (gfx_hdr->jt_size)); +DRM_DEBUG ("ucode_feature_version: %u\n" +"jt_offset: %u\n" +"jt_size: %u\n" , +le32_to_cpu (gfx_hdr->ucode_feature_version), +le32_to_cpu (gfx_hdr->jt_offset), +le32_to_cpu (gfx_hdr->jt_size)); }else {DRM_ERROR ("Unknown GFX ucode version: %u.%u\n" , version_major, version_minor); }
@@ -132,82 +147,88 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr)const struct rlc_firmware_header_v1_0 *rlc_hdr = container_of(hdr, struct rlc_firmware_header_v1_0, header); -DRM_DEBUG ("ucode_feature_version: %u\n" , -le32_to_cpu (rlc_hdr->ucode_feature_version)); -DRM_DEBUG ("save_and_restore_offset: %u\n" , -le32_to_cpu (rlc_hdr->save_and_restore_offset)); -DRM_DEBUG ("clear_state_descriptor_offset: %u\n" , -le32_to_cpu (rlc_hdr->clear_state_descriptor_offset)); -DRM_DEBUG ("avail_scratch_ram_locations: %u\n" , -le32_to_cpu (rlc_hdr->avail_scratch_ram_locations)); -DRM_DEBUG ("master_pkt_description_offset: %u\n" , +DRM_DEBUG ("ucode_feature_version: %u\n" +"save_and_restore_offset: %u\n" +"clear_state_descriptor_offset: %u\n" +"avail_scratch_ram_locations: %u\n" +"master_pkt_description_offset: %u\n" , +le32_to_cpu (rlc_hdr->ucode_feature_version), +le32_to_cpu (rlc_hdr->save_and_restore_offset), +le32_to_cpu (rlc_hdr->clear_state_descriptor_offset), +le32_to_cpu (rlc_hdr->avail_scratch_ram_locations),le32_to_cpu (rlc_hdr->master_pkt_description_offset)); + }else if (version_major ==2 ) {const struct rlc_firmware_header_v2_0 *rlc_hdr = container_of(hdr, struct rlc_firmware_header_v2_0, header); -DRM_DEBUG ("ucode_feature_version: %u\n" , -le32_to_cpu (rlc_hdr->ucode_feature_version)); -DRM_DEBUG ("jt_offset: %u\n" ,le32_to_cpu (rlc_hdr->jt_offset)); -DRM_DEBUG ("jt_size: %u\n" ,le32_to_cpu (rlc_hdr->jt_size)); -DRM_DEBUG ("save_and_restore_offset: %u\n" , -le32_to_cpu (rlc_hdr->save_and_restore_offset)); -DRM_DEBUG ("clear_state_descriptor_offset: %u\n" , -le32_to_cpu (rlc_hdr->clear_state_descriptor_offset)); -DRM_DEBUG ("avail_scratch_ram_locations: %u\n" , -le32_to_cpu (rlc_hdr->avail_scratch_ram_locations)); -DRM_DEBUG ("reg_restore_list_size: %u\n" , -le32_to_cpu (rlc_hdr->reg_restore_list_size)); -DRM_DEBUG ("reg_list_format_start: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_format_start)); -DRM_DEBUG ("reg_list_format_separate_start: %u\n" , +DRM_DEBUG ("ucode_feature_version: %u\n" +"jt_offset: %u\n" +"jt_size: %u\n" +"save_and_restore_offset: %u\n" +"clear_state_descriptor_offset: %u\n" +"avail_scratch_ram_locations: %u\n" +"reg_restore_list_size: %u\n" +"reg_list_format_start: %u\n" +"reg_list_format_separate_start: %u\n" , +le32_to_cpu (rlc_hdr->ucode_feature_version), +le32_to_cpu (rlc_hdr->jt_offset), +le32_to_cpu (rlc_hdr->jt_size), +le32_to_cpu (rlc_hdr->save_and_restore_offset), +le32_to_cpu (rlc_hdr->clear_state_descriptor_offset), +le32_to_cpu (rlc_hdr->avail_scratch_ram_locations), +le32_to_cpu (rlc_hdr->reg_restore_list_size), +le32_to_cpu (rlc_hdr->reg_list_format_start),le32_to_cpu (rlc_hdr->reg_list_format_separate_start)); -DRM_DEBUG ("starting_offsets_start: %u\n" , -le32_to_cpu (rlc_hdr->starting_offsets_start)); -DRM_DEBUG ("reg_list_format_size_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_format_size_bytes)); -DRM_DEBUG ("reg_list_format_array_offset_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_format_array_offset_bytes)); -DRM_DEBUG ("reg_list_size_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_size_bytes)); -DRM_DEBUG ("reg_list_array_offset_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_array_offset_bytes)); -DRM_DEBUG ("reg_list_format_separate_size_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_format_separate_size_bytes)); -DRM_DEBUG ("reg_list_format_separate_array_offset_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_format_separate_array_offset_bytes)); -DRM_DEBUG ("reg_list_separate_size_bytes: %u\n" , -le32_to_cpu (rlc_hdr->reg_list_separate_size_bytes)); -DRM_DEBUG ("reg_list_separate_array_offset_bytes: %u\n" , + +DRM_DEBUG ("starting_offsets_start: %u\n" +"reg_list_format_size_bytes: %u\n" +"reg_list_format_array_offset_bytes: %u\n" +"reg_list_size_bytes: %u\n" +"reg_list_array_offset_bytes: %u\n" +"reg_list_format_separate_size_bytes: %u\n" +"reg_list_format_separate_array_offset_bytes: %u\n" +"reg_list_separate_size_bytes: %u\n" +"reg_list_separate_array_offset_bytes: %u\n" , +le32_to_cpu (rlc_hdr->starting_offsets_start), +le32_to_cpu (rlc_hdr->reg_list_format_size_bytes), +le32_to_cpu (rlc_hdr->reg_list_format_array_offset_bytes), +le32_to_cpu (rlc_hdr->reg_list_size_bytes), +le32_to_cpu (rlc_hdr->reg_list_array_offset_bytes), +le32_to_cpu (rlc_hdr->reg_list_format_separate_size_bytes), +le32_to_cpu (rlc_hdr->reg_list_format_separate_array_offset_bytes), +le32_to_cpu (rlc_hdr->reg_list_separate_size_bytes),le32_to_cpu (rlc_hdr->reg_list_separate_array_offset_bytes)); +if (version_minor ==1 ) {const struct rlc_firmware_header_v2_1 *v2_1 = container_of(rlc_hdr, struct rlc_firmware_header_v2_1, v2_0); -DRM_DEBUG ("reg_list_format_direct_reg_list_length: %u\n" , -le32_to_cpu (v2_1->reg_list_format_direct_reg_list_length)); -DRM_DEBUG ("save_restore_list_cntl_ucode_ver: %u\n" , -le32_to_cpu (v2_1->save_restore_list_cntl_ucode_ver)); -DRM_DEBUG ("save_restore_list_cntl_feature_ver: %u\n" , -le32_to_cpu (v2_1->save_restore_list_cntl_feature_ver)); -DRM_DEBUG ("save_restore_list_cntl_size_bytes %u\n" , -le32_to_cpu (v2_1->save_restore_list_cntl_size_bytes)); -DRM_DEBUG ("save_restore_list_cntl_offset_bytes: %u\n" , -le32_to_cpu (v2_1->save_restore_list_cntl_offset_bytes)); -DRM_DEBUG ("save_restore_list_gpm_ucode_ver: %u\n" , -le32_to_cpu (v2_1->save_restore_list_gpm_ucode_ver)); -DRM_DEBUG ("save_restore_list_gpm_feature_ver: %u\n" , -le32_to_cpu (v2_1->save_restore_list_gpm_feature_ver)); -DRM_DEBUG ("save_restore_list_gpm_size_bytes %u\n" , -le32_to_cpu (v2_1->save_restore_list_gpm_size_bytes)); -DRM_DEBUG ("save_restore_list_gpm_offset_bytes: %u\n" , -le32_to_cpu (v2_1->save_restore_list_gpm_offset_bytes)); -DRM_DEBUG ("save_restore_list_srm_ucode_ver: %u\n" , -le32_to_cpu (v2_1->save_restore_list_srm_ucode_ver)); -DRM_DEBUG ("save_restore_list_srm_feature_ver: %u\n" , -le32_to_cpu (v2_1->save_restore_list_srm_feature_ver)); -DRM_DEBUG ("save_restore_list_srm_size_bytes %u\n" , -le32_to_cpu (v2_1->save_restore_list_srm_size_bytes)); -DRM_DEBUG ("save_restore_list_srm_offset_bytes: %u\n" , + +DRM_DEBUG ("reg_list_format_direct_reg_list_length: %u\n" +"save_restore_list_cntl_ucode_ver: %u\n" +"save_restore_list_cntl_feature_ver: %u\n" +"save_restore_list_cntl_size_bytes %u\n" +"save_restore_list_cntl_offset_bytes: %u\n" +"save_restore_list_gpm_ucode_ver: %u\n" +"save_restore_list_gpm_feature_ver: %u\n" +"save_restore_list_gpm_size_bytes %u\n" +"save_restore_list_gpm_offset_bytes: %u\n" +"save_restore_list_srm_ucode_ver: %u\n" +"save_restore_list_srm_feature_ver: %u\n" +"save_restore_list_srm_size_bytes %u\n" +"save_restore_list_srm_offset_bytes: %u\n" , +le32_to_cpu (v2_1->reg_list_format_direct_reg_list_length), +le32_to_cpu (v2_1->save_restore_list_cntl_ucode_ver), +le32_to_cpu (v2_1->save_restore_list_cntl_feature_ver), +le32_to_cpu (v2_1->save_restore_list_cntl_size_bytes), +le32_to_cpu (v2_1->save_restore_list_cntl_offset_bytes), +le32_to_cpu (v2_1->save_restore_list_gpm_ucode_ver), +le32_to_cpu (v2_1->save_restore_list_gpm_feature_ver), +le32_to_cpu (v2_1->save_restore_list_gpm_size_bytes), +le32_to_cpu (v2_1->save_restore_list_gpm_offset_bytes), +le32_to_cpu (v2_1->save_restore_list_srm_ucode_ver), +le32_to_cpu (v2_1->save_restore_list_srm_feature_ver), +le32_to_cpu (v2_1->save_restore_list_srm_size_bytes),le32_to_cpu (v2_1->save_restore_list_srm_offset_bytes)); } }else {
@@ -227,12 +248,14 @@ void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr)const struct sdma_firmware_header_v1_0 *sdma_hdr = container_of(hdr, struct sdma_firmware_header_v1_0, header); -DRM_DEBUG ("ucode_feature_version: %u\n" , -le32_to_cpu (sdma_hdr->ucode_feature_version)); -DRM_DEBUG ("ucode_change_version: %u\n" , -le32_to_cpu (sdma_hdr->ucode_change_version)); -DRM_DEBUG ("jt_offset: %u\n" ,le32_to_cpu (sdma_hdr->jt_offset)); -DRM_DEBUG ("jt_size: %u\n" ,le32_to_cpu (sdma_hdr->jt_size)); +DRM_DEBUG ("ucode_feature_version: %u\n" +"ucode_change_version: %u\n" +"jt_offset: %u\n" +"jt_size: %u\n" , +le32_to_cpu (sdma_hdr->ucode_feature_version), +le32_to_cpu (sdma_hdr->ucode_change_version), +le32_to_cpu (sdma_hdr->jt_offset), +le32_to_cpu (sdma_hdr->jt_size));if (version_minor >=1 ) {const struct sdma_firmware_header_v1_1 *sdma_v1_1_hdr = container_of(sdma_hdr, struct sdma_firmware_header_v1_1, v1_0);
@@ -256,36 +279,36 @@ void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr)const struct psp_firmware_header_v1_0 *psp_hdr = container_of(hdr, struct psp_firmware_header_v1_0, header); -DRM_DEBUG ("ucode_feature_version: %u\n" , -le32_to_cpu (psp_hdr->sos.fw_version)); -DRM_DEBUG ("sos_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr->sos.offset_bytes)); -DRM_DEBUG ("sos_size_bytes: %u\n" , +DRM_DEBUG ("ucode_feature_version: %u\n" +"sos_offset_bytes: %u\n" +"sos_size_bytes: %u\n" , +le32_to_cpu (psp_hdr->sos.fw_version), +le32_to_cpu (psp_hdr->sos.offset_bytes),le32_to_cpu (psp_hdr->sos.size_bytes));if (version_minor ==1 ) {const struct psp_firmware_header_v1_1 *psp_hdr_v1_1 = container_of(psp_hdr, struct psp_firmware_header_v1_1, v1_0); -DRM_DEBUG ("toc_header_version: %u\n" , -le32_to_cpu (psp_hdr_v1_1->toc.fw_version)); -DRM_DEBUG ("toc_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_1->toc.offset_bytes)); -DRM_DEBUG ("toc_size_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_1->toc.size_bytes)); -DRM_DEBUG ("kdb_header_version: %u\n" , -le32_to_cpu (psp_hdr_v1_1->kdb.fw_version)); -DRM_DEBUG ("kdb_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_1->kdb.offset_bytes)); -DRM_DEBUG ("kdb_size_bytes: %u\n" , +DRM_DEBUG ("toc_header_version: %u\n" +"toc_offset_bytes: %u\n" +"toc_size_bytes: %u\n" +"kdb_header_version: %u\n" +"kdb_offset_bytes: %u\n" +"kdb_size_bytes: %u\n" , +le32_to_cpu (psp_hdr_v1_1->toc.fw_version), +le32_to_cpu (psp_hdr_v1_1->toc.offset_bytes), +le32_to_cpu (psp_hdr_v1_1->toc.size_bytes), +le32_to_cpu (psp_hdr_v1_1->kdb.fw_version), +le32_to_cpu (psp_hdr_v1_1->kdb.offset_bytes),le32_to_cpu (psp_hdr_v1_1->kdb.size_bytes)); }if (version_minor ==2 ) {const struct psp_firmware_header_v1_2 *psp_hdr_v1_2 = container_of(psp_hdr, struct psp_firmware_header_v1_2, v1_0); -DRM_DEBUG ("kdb_header_version: %u\n" , -le32_to_cpu (psp_hdr_v1_2->kdb.fw_version)); -DRM_DEBUG ("kdb_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_2->kdb.offset_bytes)); -DRM_DEBUG ("kdb_size_bytes: %u\n" , +DRM_DEBUG ("kdb_header_version: %u\n" +"kdb_offset_bytes: %u\n" +"kdb_size_bytes: %u\n" , +le32_to_cpu (psp_hdr_v1_2->kdb.fw_version), +le32_to_cpu (psp_hdr_v1_2->kdb.offset_bytes),le32_to_cpu (psp_hdr_v1_2->kdb.size_bytes)); }if (version_minor ==3 ) {
@@ -293,23 +316,23 @@ void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr) container_of(psp_hdr, struct psp_firmware_header_v1_1, v1_0);const struct psp_firmware_header_v1_3 *psp_hdr_v1_3 = container_of(psp_hdr_v1_1, struct psp_firmware_header_v1_3, v1_1); -DRM_DEBUG ("toc_header_version: %u\n" , -le32_to_cpu (psp_hdr_v1_3->v1_1.toc.fw_version)); -DRM_DEBUG ("toc_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_3->v1_1.toc.offset_bytes)); -DRM_DEBUG ("toc_size_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_3->v1_1.toc.size_bytes)); -DRM_DEBUG ("kdb_header_version: %u\n" , -le32_to_cpu (psp_hdr_v1_3->v1_1.kdb.fw_version)); -DRM_DEBUG ("kdb_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_3->v1_1.kdb.offset_bytes)); -DRM_DEBUG ("kdb_size_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_3->v1_1.kdb.size_bytes)); -DRM_DEBUG ("spl_header_version: %u\n" , -le32_to_cpu (psp_hdr_v1_3->spl.fw_version)); -DRM_DEBUG ("spl_offset_bytes: %u\n" , -le32_to_cpu (psp_hdr_v1_3->spl.offset_bytes)); -DRM_DEBUG ("spl_size_bytes: %u\n" , +DRM_DEBUG ("toc_header_version: %u\n" +"toc_offset_bytes: %u\n" +"toc_size_bytes: %u\n" +"kdb_header_version: %u\n" +"kdb_offset_bytes: %u\n" +"kdb_size_bytes: %u\n" +"spl_header_version: %u\n" +"spl_offset_bytes: %u\n" +"spl_size_bytes: %u\n" , +le32_to_cpu (psp_hdr_v1_3->v1_1.toc.fw_version), +le32_to_cpu (psp_hdr_v1_3->v1_1.toc.offset_bytes), +le32_to_cpu (psp_hdr_v1_3->v1_1.toc.size_bytes), +le32_to_cpu (psp_hdr_v1_3->v1_1.kdb.fw_version), +le32_to_cpu (psp_hdr_v1_3->v1_1.kdb.offset_bytes), +le32_to_cpu (psp_hdr_v1_3->v1_1.kdb.size_bytes), +le32_to_cpu (psp_hdr_v1_3->spl.fw_version), +le32_to_cpu (psp_hdr_v1_3->spl.offset_bytes),le32_to_cpu (psp_hdr_v1_3->spl.size_bytes)); } }else {
@@ -330,9 +353,9 @@ void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr)const struct gpu_info_firmware_header_v1_0 *gpu_info_hdr = container_of(hdr, struct gpu_info_firmware_header_v1_0, header); -DRM_DEBUG ("version_major: %u\n" , -le16_to_cpu (gpu_info_hdr->version_major)); -DRM_DEBUG ("version_minor: %u\n" , +DRM_DEBUG ("version_major: %u\n" +"version_minor: %u\n" , +le16_to_cpu (gpu_info_hdr->version_major),le16_to_cpu (gpu_info_hdr->version_minor)); }else {DRM_ERROR ("Unknown gpu_info ucode version: %u.%u\n" , version_major, version_minor);
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v8 16/16 nouveau: fold multiple DRM_DEBUG_DRIVERs together
In reply to Jim CromieWith DRM_USE_DYNAMIC_DEBUG, each callsite record requires 56 bytes. We can combine 12 into one here and save ~620 bytes.
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 36 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +23 -13
@@ -1245,19 +1245,29 @@ nouveau_drm_pci_table[] = {static void nouveau_display_options (void ) { -DRM_DEBUG_DRIVER ("Loading Nouveau with parameters:\n" ); - -DRM_DEBUG_DRIVER ("... tv_disable : %d\n" , nouveau_tv_disable); -DRM_DEBUG_DRIVER ("... ignorelid : %d\n" , nouveau_ignorelid); -DRM_DEBUG_DRIVER ("... duallink : %d\n" , nouveau_duallink); -DRM_DEBUG_DRIVER ("... nofbaccel : %d\n" , nouveau_nofbaccel); -DRM_DEBUG_DRIVER ("... config : %s\n" , nouveau_config); -DRM_DEBUG_DRIVER ("... debug : %s\n" , nouveau_debug); -DRM_DEBUG_DRIVER ("... noaccel : %d\n" , nouveau_noaccel); -DRM_DEBUG_DRIVER ("... modeset : %d\n" , nouveau_modeset); -DRM_DEBUG_DRIVER ("... runpm : %d\n" , nouveau_runtime_pm); -DRM_DEBUG_DRIVER ("... vram_pushbuf : %d\n" , nouveau_vram_pushbuf); -DRM_DEBUG_DRIVER ("... hdmimhz : %d\n" , nouveau_hdmimhz); +DRM_DEBUG_DRIVER ("Loading Nouveau with parameters:\n" +"... tv_disable : %d\n" +"... ignorelid : %d\n" +"... duallink : %d\n" +"... nofbaccel : %d\n" +"... config : %s\n" +"... debug : %s\n" +"... noaccel : %d\n" +"... modeset : %d\n" +"... runpm : %d\n" +"... vram_pushbuf : %d\n" +"... hdmimhz : %d\n" + , nouveau_tv_disable + , nouveau_ignorelid + , nouveau_duallink + , nouveau_nofbaccel + , nouveau_config + , nouveau_debug + , nouveau_noaccel + , nouveau_modeset + , nouveau_runtime_pm + , nouveau_vram_pushbuf + , nouveau_hdmimhz); }static const struct dev_pm_ops nouveau_pm_ops = {
Signature · 1 line
2.31.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for use DYNAMIC_DEBUG to implement DRM.debug (rev3)
In reply to Jim Cromie== Series Details ==
== Series Details ==
Series: use DYNAMIC_DEBUG to implement DRM.debug (rev3)
URL : https://patchwork.freedesktop.org/series/93914/
State : failure
== Summary ==
Applying: dyndbg: add module to a vpr-info in dd-exec-queries
Applying: dyndbg: pr-info in boot-param should say so
Applying: dyndbg: rationalize verbosity
Applying: dyndbg: use alt-quotes in vpr-infos, not those user might use
Applying: dyndbg: vpr-info on remove-module complete, not starting
Applying: dyndbg: no vpr-info on empty queries
Applying: dyndbg-doc: fix bootparam usage example
Applying: dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES bitmap and callbacks
Applying: drm: fix doc grammar error
Applying: i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes
Applying: i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES for existing prdbgs
Applying: amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES on existing prdbgs
Applying: drm_print: add choice to use dynamic debug in drm-debug
error: sha1 information is lacking or useless (drivers/gpu/drm/amd/amdgpu/Makefile).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0013 drm_print: add choice to use dynamic debug in drm-debug When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
[email protected]
maintainerRe: [Intel-gfx] ✗ Fi.CI.BUILD: failure for use DYNAMIC_DEBUG to implement DRM.debug (rev3)
Quoted 21 lines · Patchwork
== Series Details ==
Series: use
DYNAMIC_DEBUGto implement DRM.debug (rev3)
URL : https://patchwork.freedesktop.org/series/93914/
State : failure== Summary ==
Applying: dyndbg: add module to a vpr-info in dd-exec-queries
Applying: dyndbg: pr-info in boot-param should say so
Applying: dyndbg: rationalize verbosity
Applying: dyndbg: use alt-quotes in vpr-infos, not those user might use
Applying: dyndbg: vpr-info on remove-module complete, not starting
Applying: dyndbg: no vpr-info on empty queries
Applying: dyndbg-doc: fix bootparam usage example
Applying: dyndbg: addDEFINE_DYNAMIC_DEBUG_CATEGORIESbitmap and callbacks
Applying: drm: fix doc grammar error
Applying: i915/gvt: remove spaces inpr_debug"gvt: core:" etc prefixes
Applying: i915/gvt: useDEFINE_DYNAMIC_DEBUG_CATEGORIESfor existing prdbgs
Applying: amdgpu: useDEFINE_DYNAMIC_DEBUG_CATEGORIESon existing prdbgs
Quoted 10 lines
Applying:
drm_print: add choice to use dynamic debug in drm-debug
error: sha1 information is lacking or useless (drivers/gpu/drm/amd/amdgpu/Makefile).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0013drm_print: add choice to use dynamic debug in drm-debug When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
it looks like some conflict, patchset is against 5.14. I copied branch and it applied clean to master, drm-tip so I have nothing to look at.
is this a transient error ?