use dynamic-debug under drm.debug api
Subsystems (6)
Jim Cromie
maintainercover use dynamic-debug under drm.debug api
hi Jason, Greg, Daniel, DRM-everyone
drm.debug api provides ~23 macros to issue 10 categories of debug messages, each enabled by a bit in /sys/module/drm/parameters/debug. drm_debug_enabled(category) tests these bits at runtime; while cheap individually, the costs accumulate.
Daniel,
I think this revision addresses most of your early review, a lot has changed since. Heres the link:
https://patchwork.freedesktop.org/patch/443989/
For CONFIG_DRM_USE_DYNAMIC_DEBUG=y, this patchset obsoletes those runtime tests (inside drm_*dbg) by wrapping the 2 fns in one of the dynamic_func_call* Factory macros. The config dependence is due to the .data footprint cost of the tables; AMDGPU has ~4k callsites, at 56 bytes each.
This patchset creates entries in /proc/dynamic_debug/control for each callsite, and each has .class_id = macros' category. Those entries, and a new query keyword, allow (1st):
# 1=DRM_UT_KMS (iirc)
#> echo "module drm class 1 +p > /proc/dynamic_debug/control
Then equivalently:
# except it also clears other flags #> echo 0x01 > /sys/module/drm/parameters/debug
series overview:
dyndbg:
- fix a bug in dyndbg static_key toggling, @stable cc'd
- adds support for distinct classes to dyndbg (new,unused feature)
- add DECLARE_DYNAMIC_DEBUG_CLASSBITS macro and callbacks
to implement bitmap -> classid sysfs knob
dyndbg:
- drops exported fn: dynamic_debug_exec_queries()
any potential users would just use macro, or a tweak on it.
- improve info-msg to print both "old -> new" flags
drm:
- adapts drm debug category to dyndbg.class_id
- wraps drm_*dbg() in a dyndbg Factory macro to get NOOP optimized debugs this disconnects drm.debug sysfs knob
- uses DECLARE_DYNAMIC_DEBUG_CLASSBITS macro
this reconnects sysfs knob
This could be -v12, but the focus and subject has wandered a bit, and patchwork CI had multiple different notions of the version.
Noteworthy changes:
- no tracefs stuff here, refocus
In contrast, the previous drm.debug approach:
- replaced drm_dbg & drm_devdbg with calls to pr_debug & dev_dbg this preserved the optional decorations: module:function:line:
- used DRM_UT_CORE => "drm:core:" prefix-string, cpp cat'd to formats this made sites selectable by matching to that format prefix
This version:
- .class_id is easier to explain, and no config/format-string diffs
- wraps drm_dbg & drm_devdbg callsites for jumplabel enablement efficiency was original goal.
- loses the optional decorations.
drm has its own logmsg standards, doesn't need decorations slapped on
later: could recast flags for drm specific decorations
This is based on 5.17-rc4, for no particular reason.
Its also here: in (dd-drm branch)
ghlinux-ro https://github.com/jimc/linux.git (fetch)
Jim Cromie (13):
dyndbg: fix static_branch manipulation @stable
dyndbg: add class_id field and query support
dyndbg: add DEFINE_DYNAMIC_DEBUG_CLASSBITS macro and callbacks
dyndbg: drop EXPORTed dynamic_debug_exec_queries
dyndbg: improve change-info to have old and new
dyndbg: abstract dyndbg_site_is_printing
drm_print: condense enum drm_debug_category
drm_print: interpose drm_*dbg with forwarding macros
drm_print: wrap drm_*_dbg in dyndbg jumplabel
drm_print: refine drm_debug_enabled for dyndbg+jump-label
drm_print: prefer bare printk KERN_DEBUG on generic fn
drm_print: add _ddebug desc to drm_*dbg prototypes
drm_print: use DEFINE_DYNAMIC_DEBUG_CLASSBITS for drm.debug
.../admin-guide/dynamic-debug-howto.rst | 7 + drivers/gpu/drm/Kconfig | 12 ++ drivers/gpu/drm/Makefile | 2 + drivers/gpu/drm/drm_print.c | 56 ++++--- include/drm/drm_print.h | 80 +++++++--- include/linux/dynamic_debug.h | 113 +++++++++++--- lib/dynamic_debug.c | 140 ++++++++++++++---- 7 files changed, 323 insertions(+), 87 deletions(-)
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 1/13 dyndbg: fix static_branch manipulation
In https://lore.kernel.org/lkml/[email protected]/
Vincent's patch commented on, and worked around, a bug toggling static_branch's, when a 2nd PRINTK-ish flag was added. The bug results in a premature static_branch_disable when the 1st of 2 flags was disabled.
The cited commit computed newflags, but then in the JUMP_LABEL block, did not use that result, but used just one of the terms in it. Using newflags instead made the code work properly.
This is Vincents test-case, reduced. It needs the 2nd flag to work properly, but it's explanatory here.
pt_test() {
echo 5 > /sys/module/dynamic_debug/verbose
site="module tcp" # just one callsite
echo " $site =_ " > /proc/dynamic_debug/control # clear it
# A B ~A ~B
for flg in +T +p "-T #broke here" -p; do
echo " $site $flg " > /proc/dynamic_debug/control
done;
# A B ~B ~A
for flg in +T +p "-p #broke here" -T; do
echo " $site $flg " > /proc/dynamic_debug/control
done
}pt_test
--- lib/dynamic_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/dynamic_debug.c +3 -2
@@ -211,10 +211,11 @@ static int ddebug_change(const struct ddebug_query *query,continue ;#ifdef CONFIG_JUMP_LABEL if (dp->flags & _DPRINTK_FLAGS_PRINT) { -if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT)) +if (!(newflags & _DPRINTK_FLAGS_PRINT))static_branch_disable (&dp->key.dd_key_true); - }else if (modifiers->flags & _DPRINTK_FLAGS_PRINT) + }else if (newflags & _DPRINTK_FLAGS_PRINT) {static_branch_enable (&dp->key.dd_key_true); + }#endif dp->flags = newflags; v4pr_info("changed %s:%d [%s]%s =%s\n",
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 2/13 dyndbg: add class_id field and query support
In reply to Jim CromieDRM defines/uses 10 enum drm_debug_category's to create exclusive classes of debug messages. To support this directly in dynamic-debug, add the following:
- struct _ddebug.class_id:4 - 4 bits is enough
- define _DPRINTK_SITE_UNCLASSED 15 - see below
and the query support:
- struct _ddebug_query.class_id
- ddebug_parse_query - looks for "class" keyword, then calls..
- parse_class - accepts uint: 0-15, sets query.class_id and marker
- vpr_info_dq - displays new field
- ddebug_proc_show - append column with "cls:%d" if !UNCLASSED
With the patch, this command enables current/unclassed callsites:
#> echo drm class 15 +p > /proc/dynamic_debug/control
parse_class() accepts 0 .. _DPRINTK_SITE_UNCLASSED, which allows the
Quoted 1 line
control interface to explicitly manipulate unclassed callsites.
After parsing keywords, ddebug_parse_query() sets .class_id=15, iff it wasnt explicitly set. This allows future classed/categorized callsites to be untouched by legacy (class unaware) queries.
DEFINE_DYNAMIC_DEBUG_METADATA gets _CLS(cls,) suffix and arg, and initializes the new .class_id=cls field. The old name gets the default.
Then, these _CLS(cls,...) modifications are repeated up through the stack of *dynamic_func_call* macros that use the METADATA initializer, so as to actually supply the category into it.
NOTES:
_DPRINTK_SITE_UNCLASSED: this symbol is used to initialize all existing/unclassed pr-debug callsites. Normally, the default would be zero, but DRM_UT_CORE "uses" that value, in the sense that 0 is exposed as a bit position in drm.debug. Using 15 allows identity mapping from category to class, avoiding fiddly offsets.
fixup class-id preset
fix2
--- .../admin-guide/dynamic-debug-howto.rst | 7 +++ include/linux/dynamic_debug.h | 54 ++++++++++++++----- lib/dynamic_debug.c | 48 ++++++++++++++--- 3 files changed, 88 insertions(+), 21 deletions(-)
Documentation/admin-guide/dynamic-debug-howto.rst +7 -0
@@ -35,6 +35,7 @@ Dynamic debug has even more useful features: - line number (including ranges of line numbers) - module name - format string + - class number:0-15 * Provides a debugfs control file: ``<debugfs>/dynamic_debug/control`` which can be read to display the complete list of known debug
@@ -143,6 +144,7 @@ against. Possible keywords are::: 'module' string | 'format' string | 'line' line-range + 'class' integer:[0-15] line-range ::= lineno | '-'lineno |
@@ -217,6 +219,11 @@ line line -1605 // the 1605 lines from line 1 to line 1605 line 1600- // all lines from line 1600 to the end of the file +class + This expects a single integer in range: 0-15. + 15 is used/reserved for existing/unclassed callsites, + and is defaulted in unless specified to >control + The flags specification comprises a change operation followed by one or more flag characters. The change operation is one of the characters::
include/linux/dynamic_debug.h +41 -13
101 lines not on this page · raw message
lib/dynamic_debug.c +40 -8
90 lines not on this page · raw message
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 3/13 dyndbg: add DEFINE_DYNAMIC_DEBUG_CLASSBITS macro and callbacks
In reply to Jim CromieDEFINE_DYNAMIC_DEBUG_CLASSBITS(fsname, var, bitmap_desc, classes..) allows users to create a drm.debug style (bitmap) sysfs interface, to control sets of pr_debug's according to their .class_id's
This wraps existing "class" keyword and behavior:
echo "module drm -p ; module drm class 0 +p ; module drm class 2 +p" >control
With the macro in use, this is equivalent:
echo 0x05 > /sys/module/drm/parameters/debug
To use:
DEFINE_DYNAMIC_DEBUG_CLASSBITS(debug, __drm_debug, "pmfl",
"drm.debug - bits => categories:", /* vector of uint:4 symbols, ala enum drm_debug_category, 15 is EOL */ DRM_UT_CORE, DRM_UT_DRIVER, DRM_UT_KMS ... );
The 3rd arg is a string with any of the dyndbg.flags [pmflt_]+ Full exposure of the flags here lets the module author:
- fully customize/take-over the decorations of enabled sites. generally leaving decorations to user is preferred.
- aim the debug-stream:
now printk, later tracefs.
using both together means more work (p or T, in practice) iface doesn't care about new flags added later
- declare 2 separate sysfs-knobs, one each for p, T, if desired.
- decorations are per callsite,
shared across sysfs-knobs for any controlled classes
To support the macro, the patch adds:
- int param_set_dyndbg_classbits()
- int param_get_dyndbg_classbits()
- struct kernel_param_ops param_ops_dyndbg_classbits
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 vector of classes (drm.debug "categories") being controlled
This in-line vector of constants (uint [0-14]) specifies a sequence of controlling bits (by position, starting at 0) with the values naming the class_id's mapped to that bit.
A value of _DPRINTK_SITE_UNCLASSED terminates the vector processing by param_set_dyndbg_classbits(), and is appended by the macro to insure a defined termination after max 15 classes are applied.
Technically, the vector is a flex-array, but its size is practically limited to max 15 in length (repeats are pointless).
B- a pointer to the user module's ulong holding the bits/state.
By accessing client's bit-state, we coordinate with existing code that still uses drm_debug_enabled(), so they work unchanged. The change to ulong allows use of BIT() etc.
NOTES:
_DPRINTK_SITE_UNCLASSED = 15, ie 2**CLS_BITS-1, deserves special mention; it already marks all existing pr-debug callsites, only the new drm.debug callsites are initialized to other (DRM_UT_*) values.
_DPRINTK_SITE_UNCLASSED is used in param_set_dyndbg_classbits() to limit the range of bits that are processed to what fits in uint:4. It also terminates the class-id list passed into the macro, so dont use it halfway through your list of classes-to-control.
param_set_dyndbg_classbits() compares new vs old bits, and only updates each class on changes. This maximally preserves the underlying state, which may have been customized at some point via echo $cmd >control. So if users really want to know that all prdbgs are set precisely, they must pre-clear then set.
Identity mapping in (A) is encouraged. Your vector should exclude 15, if used, it terminates the list prematurely; any following bit mappings will be ignored (it is the default/non category).
The whole (A) vector/list passed to the macro is:
- not strictly needed: 0-N bits are scanned, only N is needed in the macro interface to do this, not the whole list.
- 0-N list allows juggling the bit->class map Identity map is preferred.
15 terminates list if used. (macro impl does this)
That said, (A) is self-documenting; the explicit list is greppable, 'DRM_UT_*' provides lots of clues. Further, it could be upgraded, something like:
_pick_sym_(DRM_UT_CORE, "mumble something useful about CORE debug")
_pick_sym_(a,b) a // gives us what we need here_pick_help_(a,b) #a " : " b // mod-info fodder
--- include/linux/dynamic_debug.h | 50 +++++++++++++++++++++++ lib/dynamic_debug.c | 77 +++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+)
include/linux/dynamic_debug.h +50 -0
@@ -209,6 +209,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_classbits (const char *instr,const struct kernel_param *kp); +int param_get_dyndbg_classbits (char *buffer,const struct kernel_param *kp); +#else /* !CONFIG_DYNAMIC_DEBUG_CORE */ #include <linux/string.h>
@@ -255,6 +259,52 @@ static inline int dynamic_debug_exec_queries(const char *query, const char *modnreturn 0 ; } +struct kernel_param ; +static inline int param_set_dyndbg_classbits (const char *instr,const struct kernel_param *kp) +{return 0 ; } +static inline int param_get_dyndbg_classbits (char *buffer,const struct kernel_param *kp) +{return 0 ; } +#endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ +#define FLAGS_LEN 8 +struct dyndbg_classbits_param { +unsigned long *bits;/* ref to shared state */ +const char flags[FLAGS_LEN ];/* toggle these flags on bit-changes */ +const int classes[];/* indexed by bitpos */ +}; + +#if defined(CONFIG_DYNAMIC_DEBUG ) || defined(CONFIG_DYNAMIC_DEBUG_CORE ) +/** +* DEFINE_DYNAMIC_DEBUG_CLASSBITS() - bitmap control of classed pr_debugs +* @sysname: sysfs-node name +* @_var: C-identifier holding bit-vector (Bits 0-14 are usable) +* @_flgs: string with dyndbg flags: 'p' and/or 'T', and maybe "fmlt" also. +* @desc: string summarizing the controls provided +* @classes: vector of callsite.class_id's (uint:4, 15 is reserved) +* +* This macro implements a DRM.debug API style bitmap, mapping bits +* 0-14 to classes of prdbg's, as initialized in their .class_id fields. +* @_flgs chooses the debug recipient; p - syslog, T - tracefs, and +* can include log decorations; m - module, f - function, l - line_num +*/ +#define DEFINE_DYNAMIC_DEBUG_CLASSBITS (fsname, _var, _flgs, desc, ...) \ + MODULE_PARM_DESC(fsname, desc); \ + static struct dyndbg_classbits_param ddcats_##_var = { \ + .bits = &(_var), \ + .flags = _flgs, \ + .classes = { __VA_ARGS__, _DPRINTK_SITE_UNCLASSED } \ + }; \ + module_param_cb(fsname, ¶m_ops_dyndbg_classbits, \ + &ddcats_##_var, 0644) + +extern const struct kernel_param_ops param_ops_dyndbg_classbits; + +#else /* no dyndbg configured, throw error on macro use */ + +#define DEFINE_DYNAMIC_DEBUG_CLASSBITS (fsname, var, bitmap_desc, ...) \ + BUILD_BUG_ON_MSG(1, "CONFIG_DYNAMIC_DEBUG* needed to use this macro: " #fsname) + +#endif +#endif
lib/dynamic_debug.c +77 -0
83 lines not on this page · raw message
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 4/13 dyndbg: drop EXPORTed dynamic_debug_exec_queries
In reply to Jim CromieThis exported fn is effectively obsoleted by Commit:HEAD~2, so remove it.
The export was added here:
commit a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()") commit 4c0d77828d4f ("dyndbg: export ddebug_exec_queries")
Its intent was to allow drm.debug to use the exported function to implement its drm.debug bitmap api using dynamic_debug.
Instead, HEAD~2 implements the bitmap inside dyndbg, and exposes it in a macro declarator, and HEAD~1 uses the macro to connect __drm_debug to the supporting callbacks.
Since there are no other expected users, and any prospects would likely reuse the bitmap or a straightforward extension of it, we can drop this function until its really needed.
This also drops the CONFIG_DYNAMIC_DEBUG=N stub-func, and its pr_warn(), which I avoided in 2012, then added in 2020 :-/
--- include/linux/dynamic_debug.h | 9 --------- lib/dynamic_debug.c | 29 ----------------------------- 2 files changed, 38 deletions(-)
include/linux/dynamic_debug.h +0 -9
@@ -60,9 +60,6 @@ struct _ddebug {#if defined(CONFIG_DYNAMIC_DEBUG_CORE ) -/* exported for module authors to exercise >control */ -int dynamic_debug_exec_queries (const char *query,const char *modname); -int ddebug_add_module (struct _ddebug *tab,unsigned int n,const char *modname);extern int ddebug_remove_module (const char *mod_name);
@@ -253,12 +250,6 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, rowsize, groupsize, buf, len, ascii); \ }while (0 ) -static inline int dynamic_debug_exec_queries(const char *query, const char *modname) -{ -pr_warn ("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n" ); -return 0 ; -} - struct kernel_param;static inline int param_set_dyndbg_classbits (const char *instr,const struct kernel_param *kp) {return 0 ; }
lib/dynamic_debug.c +0 -29
@@ -582,35 +582,6 @@ static int ddebug_exec_queries(char *query, const char *modname)return nfound; } -/** -* dynamic_debug_exec_queries - select and change dynamic-debug prints -* @query: query-string described in admin-guide/dynamic-debug-howto -* @modname: string containing module name, usually &module.mod_name -* -* This uses the >/proc/dynamic_debug/control reader, allowing module -* authors to modify their dynamic-debug callsites. The modname is -* canonically struct module.mod_name, but can also be null or a -* module-wildcard, for example: "drm*". -*/ -int dynamic_debug_exec_queries (const char *query,const char *modname) -{ -int rc; -char *qry;/* writable copy of query */ - -if (!query) { -pr_err ("non-null query/command string expected\n" ); -return -EINVAL ; - } - qry =kstrndup (query,PAGE_SIZE ,GFP_KERNEL ); -if (!qry) -return -ENOMEM ; - - rc =ddebug_exec_queries (qry, modname); -kfree (qry); -return rc; -} -EXPORT_SYMBOL_GPL (dynamic_debug_exec_queries); -#ifdef CONFIG_MODULES #define KP_MOD_NAME kp->mod->name#else
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 5/13 dyndbg: improve change-info to have old and new
In reply to Jim Cromiemove site.flag update after the v4pr_info("change") message, and improve the message to print both old and new flag values.
Heres new form:
dyndbg: changed net/ipv4/tcp.c:2424 [tcp]tcp_recvmsg_locked pT -> _
--- lib/dynamic_debug.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
lib/dynamic_debug.c +6 -5
@@ -158,7 +158,7 @@ static int ddebug_change(const struct ddebug_query *query,struct ddebug_table *dt;unsigned int newflags;unsigned int nfound =0 ; -struct flagsbuf fbuf; +struct flagsbuf fbuf, nbuf;/* search for matching ddebugs */ mutex_lock (&ddebug_lock);
@@ -223,11 +223,12 @@ static int ddebug_change(const struct ddebug_query *query, static_branch_enable(&dp->key.dd_key_true); }#endif +v4pr_info ("changed %s:%d [%s]%s %s -> %s\n" , +trim_prefix (dp->filename), dp->lineno, + dt->mod_name, dp->function, +ddebug_describe_flags (dp->flags, &fbuf), +ddebug_describe_flags (newflags, &nbuf)); dp->flags = newflags; -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)); } }mutex_unlock (&ddebug_lock);
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 6/13 dyndbg: abstract dyndbg_site_is_printing
In reply to Jim CromieHide flags test in a macro.
no functional changes.
--- include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dynamic_debug.h +1 -1
@@ -56,7 +56,7 @@ struct _ddebug {#endif } __attribute__((aligned(8))); - +#define dyndbg_site_is_printing (desc) (desc->flags & _DPRINTK_FLAGS_PRINT)#if defined(CONFIG_DYNAMIC_DEBUG_CORE )
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 7/13 drm_print: condense enum drm_debug_category
In reply to Jim Cromieenum drm_debug_category has 10 "classes", explicitly initialized with 0x-bitmasks which could be simplified as BIT(X)s. But lets go
further: use natural enumeration (int, starting at 0), and do the BIT(cat) in drm_debug_enabled(cat) at runtime.
While this slightly pessimizes the bit-test, the category now fits in 4 bits, allowing it in struct _ddebug.class_id:4. This sets us up to adapt drm to use dyndbg with JUMP_LABEL, thus avoiding all those bit-tests anyway.
--- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
include/drm/drm_print.h +11 -11
@@ -279,49 +279,49 @@ enum drm_debug_category {* @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ -DRM_UT_CORE =0x01 , +DRM_UT_CORE ,/** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ -DRM_UT_DRIVER =0x02 , +DRM_UT_DRIVER ,/** * @DRM_UT_KMS: Used in the modesetting code. */ -DRM_UT_KMS =0x04 , +DRM_UT_KMS ,/** * @DRM_UT_PRIME: Used in the prime code. */ -DRM_UT_PRIME =0x08 , +DRM_UT_PRIME ,/** * @DRM_UT_ATOMIC: Used in the atomic code. */ -DRM_UT_ATOMIC =0x10 , +DRM_UT_ATOMIC ,/** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ -DRM_UT_VBL =0x20 , +DRM_UT_VBL ,/** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ -DRM_UT_STATE =0x40 , +DRM_UT_STATE ,/** * @DRM_UT_LEASE: Used in the lease code. */ -DRM_UT_LEASE =0x80 , +DRM_UT_LEASE ,/** * @DRM_UT_DP: Used in the DP code. */ -DRM_UT_DP =0x100 , +DRM_UT_DP ,/** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, +DRM_UT_DRMRES };static inline bool drm_debug_enabled (enum drm_debug_category category) { -return unlikely (__drm_debug & category); +return unlikely (__drm_debug &BIT (category)); }/*
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 8/13 drm_print: interpose drm_*dbg with forwarding macros
In reply to Jim Cromiedrm_dev_dbg() & drm_dbg() sit below the categorized layer of the DRM debug API, and implement most of it. These are good places to insert dynamic-debug jump-label mechanics, allowing DRM to avoid the runtime cost of drm_debug_enabled().
Set up for this by changing the func names by adding '__' prefixes, and define forwarding macros to the new names.
no functional changes.
memory cost baseline: (unchanged)
bash-5.1# drms_load
[ 9.220389] dyndbg: 1 debug prints in module drm [ 9.224426] ACPI: bus type drm_connector registered [ 9.302192] dyndbg: 2 debug prints in module ttm [ 9.305033] dyndbg: 8 debug prints in module video [ 9.627563] dyndbg: 127 debug prints in module i915 [ 9.721505] AMD-Vi: AMD IOMMUv2 functionality not available on this system - This is not a bug. [ 10.091345] dyndbg: 2196 debug prints in module amdgpu [ 10.106589] [drm] amdgpu kernel modesetting enabled. [ 10.107270] amdgpu: CRAT table not found [ 10.107926] amdgpu: Virtual CRAT table created for CPU [ 10.108398] amdgpu: Topology: Add CPU node [ 10.168507] dyndbg: 3 debug prints in module wmi [ 10.329587] dyndbg: 3 debug prints in module nouveau
--- drivers/gpu/drm/drm_print.c | 10 +++++----- include/drm/drm_print.h | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_print.c +5 -5
@@ -256,8 +256,8 @@ void drm_dev_printk(const struct device *dev, const char *level, }EXPORT_SYMBOL (drm_dev_printk); -void drm_dev_dbg (const struct device *dev,enum drm_debug_category category, -const char *format, ...) +void __drm_dev_dbg (const struct device *dev,enum drm_debug_category category, +const char *format, ...) {struct va_format vaf;va_list args;
@@ -278,9 +278,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,va_end (args); } -EXPORT_SYMBOL (drm_dev_dbg); +EXPORT_SYMBOL (__drm_dev_dbg); -void __drm_dbg (enum drm_debug_category category,const char *format, ...) +void ___drm_dbg (enum drm_debug_category category,const char *format, ...) {struct va_format vaf;va_list args;
@@ -297,7 +297,7 @@ void __drm_dbg(enum drm_debug_category category, const char *format, ...)va_end (args); } -EXPORT_SYMBOL (__drm_dbg); +EXPORT_SYMBOL (___drm_dbg);void __drm_err (const char *format, ...) {
include/drm/drm_print.h +7 -2
@@ -334,7 +334,7 @@ __printf(3, 4)void drm_dev_printk (const struct device *dev,const char *level,const char *format, ...); __printf(3, 4) -void drm_dev_dbg (const struct device *dev,enum drm_debug_category category, +void __drm_dev_dbg (const struct device *dev,enum drm_debug_category category,const char *format, ...);/**
@@ -383,6 +383,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, } \ }) +#define drm_dev_dbg (dev, cat, fmt, ...) \ + __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__) +/** * DRM_DEV_DEBUG() - Debug output for generic drm code *
@@ -484,10 +487,12 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,*/ __printf(2, 3) -void __drm_dbg (enum drm_debug_category category,const char *format, ...); +void ___drm_dbg (enum drm_debug_category category,const char *format, ...); __printf(1, 2)void __drm_err (const char *format, ...); +#define __drm_dbg (fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__) +/* Macros to make printk easier */ #define _DRM_PRINTK (once, level, fmt, ...) \
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 9/13 drm_print: wrap drm_*_dbg in dyndbg jumplabel
In reply to Jim CromieFor CONFIG_DRM_USE_DYNAMIC_DEBUG=y, wrap drm_dbg() & drm_dev_dbg() in one of dyndbg's Factory macros: _dynamic_func_call_no_desc(). This makes the (~4000) callsites controllable, typically by class:
# 0 is DRM_UT_CORE
#> echo module drm class 0 +p > /proc/dynamic_debug/control
=N: keeps direct forwarding: drm_*_dbg -> __drm_*_dbg()
I added the CONFIG_DRM_USE_DYNAMIC_DEBUG item because of the .data footprint cost of per-callsite control; 56 bytes/site * ~2k,4k callsites (for i915, amdgpu), which is significant enough that a user might not want it. Using CONFIG_DYNAMIC_DEBUG_CORE only eliminates the builtin portion, leaving only drm modules, but still 200k of module data is a lot.
--- drivers/gpu/drm/Kconfig | 12 ++++++++++++ drivers/gpu/drm/Makefile | 2 ++ include/drm/drm_print.h | 12 ++++++++++++ 3 files changed, 26 insertions(+)
drivers/gpu/drm/Kconfig +12 -0
@@ -63,6 +63,18 @@ 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 + Use dynamic-debug to avoid drm_debug_enabled() runtime overheads. + Due to callsite counts in DRM drivers (~4k in amdgpu) and 56 + bytes per callsite, the .data costs can be substantial, and + are therefore configurable. + config DRM_DEBUG_SELFTEST tristate "kselftests for DRM" depends on DRM
drivers/gpu/drm/Makefile +2 -0
@@ -3,6 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE + drm-y := drm_aperture.o drm_auth.o drm_cache.o \ drm_file.o drm_gem.o drm_ioctl.o \ drm_drv.o \
include/drm/drm_print.h +12 -0
@@ -383,8 +383,14 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, } \ }) +#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG )#define drm_dev_dbg (dev, cat, fmt, ...) \ __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__) +#else +#define drm_dev_dbg (dev, cat, fmt, ...) \ + _dynamic_func_call_no_desc(fmt, __drm_dev_dbg, \ + dev, cat, fmt, ##__VA_ARGS__) +#endif /** * DRM_DEV_DEBUG() - Debug output for generic drm code
@@ -491,7 +497,13 @@ void ___drm_dbg(enum drm_debug_category category, const char *format, ...); __printf(1, 2)void __drm_err (const char *format, ...); +#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG )#define __drm_dbg (fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__) +#else +#define __drm_dbg (cat, fmt, ...) \ + _dynamic_func_call_no_desc(fmt, ___drm_dbg, \ + cat, fmt, ##__VA_ARGS__) +#endif /* Macros to make printk easier */
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 10/13 drm_print: refine drm_debug_enabled for dyndbg+jump-label
In reply to Jim CromieIn order to use dynamic-debug's jump-label optimization in drm-debug, its clarifying to refine drm_debug_enabled into 3 uses:
1. drm_debug_enabled - legacy, public
2. __drm_debug_enabled - optimized for dyndbg jump-label enablement.
3. _drm_debug_enabled - pr_debug instrumented, observable
1. The legacy version always checks the bits.
2. is privileged, for use by __drm_dbg(), __drm_dev_dbg(), which do an early return unless the category is enabled (free of call/NOOP side effects). For dyndbg builds, debug callsites are selectively "pre-enabled", so __drm_debug_enabled() short-circuits to true there. Remaining callers of 1 may be able to use 2, case by case.
3. is 1st wrapped in a macro, with a pr_debug, which reports each usage in /proc/dynamic_debug/control, making it observable in the logs. The macro lets the pr_debug see the real caller, not an inline function.
When plugged into 1, it identified ~10 remaining callers of the function, leading to the follow-on cleanup patch, and would allow activating the pr_debugs, estimating the callrate, and the potential savings by using the wrapper macro. It is unused ATM, but it fills out the picture.
--- drivers/gpu/drm/drm_print.c | 4 ++-- include/drm/drm_print.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_print.c +2 -2
@@ -262,7 +262,7 @@ 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)) +if (!__drm_debug_enabled (category))return ;va_start (args, format);
@@ -285,7 +285,7 @@ void ___drm_dbg(enum drm_debug_category category, const char *format, ...)struct va_format vaf;va_list args; -if (!drm_debug_enabled (category)) +if (!__drm_debug_enabled (category))return ;va_start (args, format);
include/drm/drm_print.h +28 -0
@@ -319,11 +319,39 @@ enum drm_debug_category { DRM_UT_DRMRES }; +/* +* 3 name flavors of drm_debug_enabled: +* drm_debug_enabled - public/legacy, always checks bits +* _drm_debug_enabled - instrumented to observe call-rates, est overheads. +* __drm_debug_enabled - privileged - knows jump-label state, can short-circuit +*/ static inline bool drm_debug_enabled (enum drm_debug_category category) {return unlikely (__drm_debug &BIT (category)); } +/* +* Wrap fn in macro, so that the pr_debug sees the actual caller, not +* the inline fn. Using this name creates a callsite entry / control +* point in /proc/dynamic_debug/control. +*/ +#define _drm_debug_enabled (category) \ + ({ \ + pr_debug("todo: maybe avoid via dyndbg\n"); \ + drm_debug_enabled(category); \ + }) + +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG ) +/* +* dyndbg is wrapping the drm.debug API, so as to avoid the runtime +* bit-test overheads of drm_debug_enabled() in those api calls. +* In this case, executed callsites are known enabled, so true. +*/ +#define __drm_debug_enabled (category) true +#else +#define __drm_debug_enabled (category) drm_debug_enabled(category) +#endif +/* * struct device based logging *
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 11/13 drm_print: prefer bare printk KERN_DEBUG on generic fn
In reply to Jim Cromiedrm_print.c calls pr_debug() just once, from __drm_printfn_debug(), which is a generic/service fn. The callsite is compile-time enabled by DEBUG in both DYNAMIC_DEBUG=y/n builds.
For dyndbg builds, reverting this callsite back to bare printk is correcting a few anti-features:
1- callsite is generic, serves multiple drm users.
its hardwired on currently
could accidentally: #> echo -p > /proc/dynamic_debug/control
2- optional "decorations" by dyndbg are unhelpful/misleading
they describe only the generic site, not end users
IOW, 1,2 are unhelpful at best, and possibly confusing.
reverting yields a nominal data and text shrink:
text data bss dec hex filename
462583 36604 54592 553779 87333 /lib/modules/5.16.0-rc4-lm1-00008-ged3eac8ceeea/kernel/drivers/gpu/drm/drm.ko 462515 36532 54592 553639 872a7 /lib/modules/5.16.0-rc4-lm1-00009-g6ce0b88d2539-dirty/kernel/drivers/gpu/drm/drm.ko
NB: this was noticed using _drm_debug_enabled(), added earlier.
--- drivers/gpu/drm/drm_print.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_print.c +2 -3
@@ -23,8 +23,6 @@* Rob Clark <[email protected]> */ -#define DEBUG /* for pr_debug() */ -#include <linux/stdarg.h> #include <linux/io.h>
@@ -162,7 +160,8 @@ EXPORT_SYMBOL(__drm_printfn_info);void __drm_printfn_debug (struct drm_printer *p,struct va_format *vaf) { -pr_debug ("%s %pV" , p->prefix, vaf); +/* pr_debug callsite decorations are unhelpful here */ +printk (KERN_DEBUG "%s %pV" , p->prefix, vaf); }EXPORT_SYMBOL (__drm_printfn_debug);
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 12/13 drm_print: add _ddebug desc to drm_*dbg prototypes
In reply to Jim CromieAdd a struct _ddebug ptr to drm_dbg() and drm_dev_dbg() protos.
And upgrade the current use of _dynamic_func_call_no_desc(); ie drop the '_no_desc', since the factory macro's callees (these 2 functions) are now expecting the arg.
This lets those functions act more like pr_debug(). It also means that these functions don't just get the decorations from an underlying implementation. DRM already has standards for logging/messaging; tossing optional decorations on top may not help.
use that info
provide it to dyndbg [1], which can then
control debug enablement and decoration for all those drm.debug callsites.
For CONFIG_DRM_USE_DYNAMIC_DEBUG=N, just pass null.
NB: desc->class_id is redundant with category, but !!desc dependent.
--- drivers/gpu/drm/drm_print.c | 23 +++++++++++++---------- include/drm/drm_print.h | 23 ++++++++++++----------- 2 files changed, 25 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_print.c +13 -10
@@ -255,8 +255,8 @@ void drm_dev_printk(const struct device *dev, const char *level, }EXPORT_SYMBOL (drm_dev_printk); -void __drm_dev_dbg (const struct device *dev,enum drm_debug_category category, -const char *format, ...) +void __drm_dev_dbg (struct _ddebug *desc,const struct device *dev, +enum drm_debug_category category,const char *format, ...) {struct va_format vaf;va_list args;
@@ -264,22 +264,25 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,if (!__drm_debug_enabled (category))return ; +/* we know we are printing for either syslog, tracefs, or both */ va_start (args, format); vaf.fmt = format; vaf.va = &args; -if (dev) -dev_printk (KERN_DEBUG , dev,"[" DRM_NAME ":%ps] %pV" , -__builtin_return_address (0 ), &vaf); -else -printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , -__builtin_return_address (0 ), &vaf); - +if (dev) { +if (dyndbg_site_is_printing (desc)) +dev_printk (KERN_DEBUG , dev,"[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }else { +if (dyndbg_site_is_printing (desc)) +printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }va_end (args); }EXPORT_SYMBOL (__drm_dev_dbg); -void ___drm_dbg (enum drm_debug_category category,const char *format, ...) +void ___drm_dbg (struct _ddebug *desc,enum drm_debug_category category,const char *format, ...) {struct va_format vaf;va_list args;
include/drm/drm_print.h +12 -11
@@ -31,6 +31,7 @@#include <linux/seq_file.h> #include <linux/device.h> #include <linux/debugfs.h> +#include <linux/dynamic_debug.h> #include <drm/drm.h>
@@ -361,9 +362,9 @@ static inline bool drm_debug_enabled(enum drm_debug_category category) __printf(3, 4)void drm_dev_printk (const struct device *dev,const char *level,const char *format, ...); -__printf(3, 4) -void __drm_dev_dbg (const struct device *dev,enum drm_debug_category category, -const char *format, ...); +__printf(4, 5) +void __drm_dev_dbg (struct _ddebug *desc,const struct device *dev, +enum drm_debug_category category,const char *format, ...);/** * DRM_DEV_ERROR() - Error output.
@@ -413,11 +414,11 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG )#define drm_dev_dbg (dev, cat, fmt, ...) \ - __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__) + __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)#else #define drm_dev_dbg (dev, cat, fmt, ...) \ - _dynamic_func_call_no_desc(fmt, __drm_dev_dbg, \ - dev, cat, fmt, ##__VA_ARGS__) + _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg, \ + dev, cat, fmt, ##__VA_ARGS__)#endif /**
@@ -520,17 +521,17 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,* Prefer drm_device based logging over device or prink based logging. */ -__printf(2, 3) -void ___drm_dbg (enum drm_debug_category category,const char *format, ...); +__printf(3, 4) +void ___drm_dbg (struct _ddebug *desc,enum drm_debug_category category,const char *format, ...); __printf(1, 2)void __drm_err (const char *format, ...);#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG ) -#define __drm_dbg (fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__) +#define __drm_dbg (fmt, ...) ___drm_dbg(NULL, fmt, ##__VA_ARGS__)#else #define __drm_dbg (cat, fmt, ...) \ - _dynamic_func_call_no_desc(fmt, ___drm_dbg, \ - cat, fmt, ##__VA_ARGS__) + _dynamic_func_call_cls(cat, fmt, ___drm_dbg, \ + cat, fmt, ##__VA_ARGS__)#endif /* Macros to make printk easier */
Signature · 1 line
2.35.1
Jim Cromie
maintainerPATCH 13/13 drm_print: use DEFINE_DYNAMIC_DEBUG_CLASSBITS for drm.debug
In reply to Jim Cromieif CONFIG_DRM_USE_DYNAMIC_DEBUG=y, use new macro to create the sysfs bitmap to control drm.debug callsites.
DEFINE_DYNAMIC_DEBUG_CLASSBITS( debug, __drm_debug, "p",
"drm.debug - control summary", /* inline vector of _ddebug.class_id's to be controlled, max 14 vals */ DRM_UT_CORE, DRM_UT_DRIVER, DRM_UT_KMS, DRM_UT_PRIME, DRM_UT_ATOMIC, DRM_UT_VBL, DRM_UT_STATE, DRM_UT_LEASE, DRM_UT_DP, DRM_UT_DRMRES );
NOTES:
The @_flgs used here is "p", so this bitmap enables input to syslog only, matching legacy behavior.
Also, no "fmlt" decorator flags are used here; that is discouraged, as it then toggles those flags along with the "p". This would overwrite any customizations a user added since the sysfs-knob was last used. Still, there may be cases/reasons.
_ddebug.class_id is uint:4, values 0-14 are valid. 15 is reserved for non-classified callsites (regular pr_debugs). Using it terminates the scan, don't use it halfway through your list.
--- drivers/gpu/drm/drm_print.c | 20 ++++++++++++++++++-- include/drm/drm_print.h | 4 ++-- 2 files changed, 20 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_print.c +18 -2
@@ -38,7 +38,7 @@* __drm_debug: Enable debug output. * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details. */ -unsigned int __drm_debug; +unsigned long __drm_debug;EXPORT_SYMBOL (__drm_debug); MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
@@ -50,7 +50,23 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat"\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n" "\t\tBit 7 (0x80) will enable LEASE messages (leasing code)\n" "\t\tBit 8 (0x100) will enable DP messages (displayport code)"); -module_param_named (debug, __drm_debug, int,0600 ); + +#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG ) +module_param_named (debug, __drm_debug, ulong,0600 ); +#else +DEFINE_DYNAMIC_DEBUG_CLASSBITS (debug, __drm_debug,"p" , +"enable drm.debug categories - 1 bit per category" , +DRM_UT_CORE , +DRM_UT_DRIVER , +DRM_UT_KMS , +DRM_UT_PRIME , +DRM_UT_ATOMIC , +DRM_UT_VBL , +DRM_UT_STATE , +DRM_UT_LEASE , +DRM_UT_DP , +DRM_UT_DRMRES ); +#endif void __drm_puts_coredump (struct drm_printer *p,const char *str) {
include/drm/drm_print.h +2 -2
@@ -36,7 +36,7 @@#include <drm/drm.h> /* Do *not* use outside of drm_print.[ch]! */ -extern unsigned int __drm_debug; +extern unsigned long __drm_debug;/** * DOC: print
@@ -527,7 +527,7 @@ __printf(1, 2)void __drm_err (const char *format, ...);#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG ) -#define __drm_dbg (fmt, ...) ___drm_dbg(NULL, fmt, ##__VA_ARGS__) +#define __drm_dbg (cat, fmt, ...) ___drm_dbg(NULL, cat, fmt, ##__VA_ARGS__)#else #define __drm_dbg (cat, fmt, ...) \ _dynamic_func_call_cls(cat, fmt, ___drm_dbg, \
Signature · 1 line
2.35.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for use dynamic-debug under drm.debug api (rev2)
In reply to Jim Cromie== Series Details ==
== Series Details ==
Series: use dynamic-debug under drm.debug api (rev2)
URL : https://patchwork.freedesktop.org/series/100289/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
c2ed9cc02d9c dyndbg: fix static_branch manipulation
a8f6c71f283e dyndbg: add class_id field and query support
-:141: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects?
#141: FILE: include/linux/dynamic_debug.h:142:
+#define __dynamic_func_call_cls(id, cls, fmt, func, ...) do { \
+ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \
+ if (DYNAMIC_DEBUG_BRANCH(id)) \
+ func(&id, ##__VA_ARGS__); \
} while (0)-:151: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #151: FILE: include/linux/dynamic_debug.h:148:
+#define __dynamic_func_call_no_desc_cls(id, cls, fmt, func, ...) do { \
+ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \
+ if (DYNAMIC_DEBUG_BRANCH(id)) \
+ func(__VA_ARGS__); \
} while (0)
total: 0 errors, 0 warnings, 2 checks, 216 lines checked3a4e3b60eacf dyndbg: add DEFINE_DYNAMIC_DEBUG_CLASSBITS macro and callbacks
-:13: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #13:
echo "module drm -p ; module drm class 0 +p ; module drm class 2 +p" >control
-:164: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'fsname' - possible side-effects? #164: FILE: include/linux/dynamic_debug.h:291:
+#define DEFINE_DYNAMIC_DEBUG_CLASSBITS(fsname, _var, _flgs, desc, ...) \
+ MODULE_PARM_DESC(fsname, desc); \
+ static struct dyndbg_classbits_param ddcats_##_var = { \
+ .bits = &(_var), \
+ .flags = _flgs, \
+ .classes = { __VA_ARGS__, _DPRINTK_SITE_UNCLASSED } \
+ }; \
+ module_param_cb(fsname, ¶m_ops_dyndbg_classbits, \
+ &ddcats_##_var, 0644)
-:227: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #227: FILE: lib/dynamic_debug.c:649:
+ for (i = 0; i < _DPRINTK_SITE_UNCLASSED &&
+ dcp->classes[i] < _DPRINTK_SITE_UNCLASSED; i++) {
-:228: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #228: FILE: lib/dynamic_debug.c:650:
+ dcp->classes[i] < _DPRINTK_SITE_UNCLASSED; i++) {
+
total: 0 errors, 1 warnings, 3 checks, 145 lines checked63c1eb03d319 dyndbg: drop EXPORTed dynamic_debug_exec_queries
-:9: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #9:
commit a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()")
total: 0 errors, 1 warnings, 0 checks, 56 lines checked523e64e179fa dyndbg: improve change-info to have old and newe2b2197bb80e dyndbg: abstract dyndbg_site_is_printing
-:20: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'desc' may be better as '(desc)' to avoid precedence issues #20: FILE: include/linux/dynamic_debug.h:59:
+#define dyndbg_site_is_printing(desc) (desc->flags & _DPRINTK_FLAGS_PRINT)
total: 0 errors, 0 warnings, 1 checks, 8 lines checked d701d41dd224 drm_print: condense enum drm_debug_category bbfe74b86e22 drm_print: interpose drm_*dbg with forwarding macros -:80: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #80: FILE: include/drm/drm_print.h:338:
+void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
const char *format, ...);
total: 0 errors, 0 warnings, 1 checks, 59 lines checked 13edef385bee drm_print: wrap drm_*_dbg in dyndbg jumplabel
-:72: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'fmt' - possible side-effects? #72: FILE: include/drm/drm_print.h:390:
+#define drm_dev_dbg(dev, cat, fmt, ...) \
+ _dynamic_func_call_no_desc(fmt, __drm_dev_dbg, \
+ dev, cat, fmt, ##__VA_ARGS__)
-:86: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'fmt' - possible side-effects? #86: FILE: include/drm/drm_print.h:503:
+#define __drm_dbg(cat, fmt, ...) \
+ _dynamic_func_call_no_desc(fmt, ___drm_dbg, \
+ cat, fmt, ##__VA_ARGS__)
total: 0 errors, 0 warnings, 2 checks, 53 lines checked6cea91e13186 drm_print: refine drm_debug_enabled for dyndbg+jump-label534cea23990c drm_print: prefer bare printk KERN_DEBUG on generic fn
-:25: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #25:
462583 36604 54592 553779 87333 /lib/modules/5.16.0-rc4-lm1-00008-ged3eac8ceeea/kernel/drivers/gpu/drm/drm.ko
-:51: WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ... #51: FILE: drivers/gpu/drm/drm_print.c:164:
+ printk(KERN_DEBUG "%s %pV", p->prefix, vaf);
total: 0 errors, 2 warnings, 0 checks, 17 lines checked a052ebcff18b drm_print: add _ddebug desc to drm_*dbg prototypes -:61: WARNING:PREFER_DEV_LEVEL: Prefer dev_dbg(... to dev_printk(KERN_DEBUG, ... #61: FILE: drivers/gpu/drm/drm_print.c:274:
+ dev_printk(KERN_DEBUG, dev, "[" DRM_NAME ":%ps] %pV",
-:65: WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ... #65: FILE: drivers/gpu/drm/drm_print.c:278:
+ printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
total: 0 errors, 2 warnings, 0 checks, 98 lines checked 338e0af8179a drm_print: use DEFINE_DYNAMIC_DEBUG_CLASSBITS for drm.debug -:62: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #62: FILE: drivers/gpu/drm/drm_print.c:58:
+DEFINE_DYNAMIC_DEBUG_CLASSBITS(debug, __drm_debug, "p",
+ "enable drm.debug categories - 1 bit per category",
total: 0 errors, 0 warnings, 1 checks, 48 lines checked
[email protected]
maintainerRe: ✗ Fi.CI.CHECKPATCH: warning for use dynamic-debug under drm.debug api (rev2)
Quoted 23 lines · Patchwork
== Series Details ==
Series: use dynamic-debug under drm.debug api (rev2)
URL : https://patchwork.freedesktop.org/series/100289/
State : warning== Summary ==
$ dim checkpatch origin/drm-tip c2ed9cc02d9c dyndbg: fix static_branch manipulation a8f6c71f283e dyndbg: add class_id field and query support -:141: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #141: FILE: include/linux/dynamic_debug.h:142:(quoted diff) +4
-1+#define __dynamic_func_call_cls(id, cls, fmt, func, ...) do { \ + DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(id)) \ + func(&id, ##__VA_ARGS__); \ } while (0) -:151: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects?#151: FILE:
include/linux/dynamic_debug.h:148:
Review
Quoted 5 lines
(quoted diff) +4
-0+#define __dynamic_func_call_no_desc_cls(id, cls, fmt, func, ...) do { \ + DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(id)) \ + func(__VA_ARGS__); \ } while (0)
Can I get a pass on this ?
the usual approach doesnt work:
+ typeof(id) id = (id); \
it appears to be due to the outer / wrapping macro inserting the __UNIQUE_ID(ddebug)
which gets expanded 2x, giving:
| ^~~~~~~~
/home/jimc/projects/lx/linux.git/include/linux/compiler-gcc.h:42:45:
note: previous definition of ‘__UNIQUE_ID_ddebug437’ with type ‘int’
42 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_,
prefix), __COUNTER__)
| ^~~~~~~~~~~~/home/jimc/projects/lx/linux.git/include/linux/dynamic_debug.h:230:20:
note: in definition of macro ‘__dynamic_func_call_cls’
230 | typeof(id) id = (id); \
Moreover, these 2 macros imitate existing macros,
which would suffer the same WARNING.
My macro-fu is insufficient,
can anyone suggest a clean way to fix this warning ?
tia
Jim
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for use dynamic-debug under drm.debug api (rev2)
In reply to Jim Cromie== Series Details ==
== Series Details ==
Series: use dynamic-debug under drm.debug api (rev2)
URL : https://patchwork.freedesktop.org/series/100289/
State : warning
== Summary ==
$ dim sparse --fast origin/drm-tip Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately.
[email protected]
maintainerRe: [Intel-gfx] ✗ Fi.CI.SPARSE: warning for use dynamic-debug under drm.debug api (rev2)
Quoted 7 lines · Patchwork
== Series Details ==
Series: use dynamic-debug under drm.debug api (rev2)
URL : https://patchwork.freedesktop.org/series/100289/
State : warning
Quoted 7 lines
== Summary ==
$ dim sparse --fast origin/drm-tip Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately.
why a warning ?
is there a report missing ? suppressed by fastmode ?
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for use dynamic-debug under drm.debug api (rev2)
In reply to Jim Cromie== Series Details ==
== Series Details ==
Series: use dynamic-debug under drm.debug api (rev2)
URL : https://patchwork.freedesktop.org/series/100289/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_11306 -> Patchwork_22448
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_22448 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_22448, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/index.html
Participating hosts (50 -> 45)
------------------------------
Missing (5): shard-tglu fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_22448:
### IGT changes ###
#### Possible regressions ####
* igt@gem_exec_suspend@basic-s3@smem:
- fi-cml-u2: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-cml-u2/igt@gem_exec_suspend@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-cml-u2/igt@gem_exec_suspend@[email protected]
Known issues
------------
Here are the changes found in Patchwork_22448 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@cs-gfx:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271]) +17 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-kbl-soraka/igt@amdgpu/[email protected]
* igt@amdgpu/amd_cs_nop@nop-compute0:
- fi-pnv-d510: NOTRUN -> [SKIP][4] ([fdo#109271]) +17 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-pnv-d510/igt@amdgpu/[email protected]
* igt@amdgpu/amd_cs_nop@sync-fork-compute0:
- fi-snb-2600: NOTRUN -> [SKIP][5] ([fdo#109271]) +17 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-snb-2600/igt@amdgpu/[email protected]
* igt@gem_exec_suspend@basic-s3:
- fi-skl-6600u: NOTRUN -> [INCOMPLETE][6] ([i915#4547])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-skl-6600u/igt@[email protected]
* igt@gem_lmem_swapping@random-engines:
- fi-ivb-3770: NOTRUN -> [SKIP][7] ([fdo#109271]) +35 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-ivb-3770/igt@[email protected]
* igt@i915_selftest@live@hangcheck:
- bat-dg1-5: [PASS][8] -> [DMESG-FAIL][9] ([i915#4494] / [i915#4957])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/bat-dg1-5/igt@i915_selftest@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/bat-dg1-5/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@requests:
- fi-blb-e6850: [PASS][10] -> [DMESG-FAIL][11] ([i915#5026])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-blb-e6850/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-blb-e6850/igt@i915_selftest@[email protected]
* igt@kms_chamelium@dp-hpd-fast:
- fi-ivb-3770: NOTRUN -> [SKIP][12] ([fdo#109271] / [fdo#111827]) +8 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-ivb-3770/igt@[email protected]
* igt@runner@aborted:
- fi-blb-e6850: NOTRUN -> [FAIL][13] ([fdo#109271] / [i915#2403] / [i915#2426] / [i915#4312])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-blb-e6850/igt@[email protected]
- fi-bdw-5557u: NOTRUN -> [FAIL][14] ([i915#2426] / [i915#4312])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-bdw-5557u/igt@[email protected]
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- fi-blb-e6850: [FAIL][15] ([i915#3194]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-blb-e6850/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-blb-e6850/igt@[email protected]
* igt@i915_pm_rps@basic-api:
- bat-dg1-5: [FAIL][17] ([i915#4032]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/bat-dg1-5/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/bat-dg1-5/igt@[email protected]
* igt@i915_selftest@live@gem_contexts:
- fi-kbl-soraka: [DMESG-WARN][19] -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-kbl-soraka/igt@i915_selftest@live@gem_contexts.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-kbl-soraka/igt@i915_selftest@live@gem_contexts.html
* igt@i915_selftest@live@gt_pm:
- {fi-jsl-1}: [DMESG-FAIL][21] ([i915#1886]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-jsl-1/igt@i915_selftest@live@gt_pm.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-jsl-1/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@hangcheck:
- fi-snb-2600: [INCOMPLETE][23] ([i915#3921]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-snb-2600/igt@i915_selftest@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-snb-2600/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@requests:
- fi-pnv-d510: [DMESG-FAIL][25] ([i915#2927] / [i915#4528]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-pnv-d510/igt@i915_selftest@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-pnv-d510/igt@i915_selftest@[email protected]
* igt@kms_busy@basic@modeset:
- bat-adlp-4: [DMESG-WARN][27] ([i915#3576]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/bat-adlp-4/igt@kms_busy@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/bat-adlp-4/igt@kms_busy@[email protected]
#### Warnings ####
* igt@runner@aborted:
- fi-skl-6600u: [FAIL][29] ([i915#1436] / [i915#4312]) -> [FAIL][30] ([i915#2722] / [i915#4312])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11306/fi-skl-6600u/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/fi-skl-6600u/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2403]: https://gitlab.freedesktop.org/drm/intel/issues/2403
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#2927]: https://gitlab.freedesktop.org/drm/intel/issues/2927
[i915#3194]: https://gitlab.freedesktop.org/drm/intel/issues/3194
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3576]: https://gitlab.freedesktop.org/drm/intel/issues/3576
[i915#3921]: https://gitlab.freedesktop.org/drm/intel/issues/3921
[i915#4032]: https://gitlab.freedesktop.org/drm/intel/issues/4032
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4494]: https://gitlab.freedesktop.org/drm/intel/issues/4494
[i915#4528]: https://gitlab.freedesktop.org/drm/intel/issues/4528
[i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
[i915#4957]: https://gitlab.freedesktop.org/drm/intel/issues/4957
[i915#5026]: https://gitlab.freedesktop.org/drm/intel/issues/5026
Build changes
-------------
* Linux: CI_DRM_11306 -> Patchwork_22448
CI-20190529: 20190529
CI_DRM_11306: 0eb492df610222f39eb2ad5a903626dd3ad9aea2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6361: 2372a4beb6a33c5f0799a4a8ccbb93794f52dbca @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_22448: 338e0af8179af1afd024cdebefc95eb49637e16f @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
338e0af8179a drm_print: use DEFINE_DYNAMIC_DEBUG_CLASSBITS for drm.debug a052ebcff18b drm_print: add _ddebug desc to drm_*dbg prototypes 534cea23990c drm_print: prefer bare printk KERN_DEBUG on generic fn 6cea91e13186 drm_print: refine drm_debug_enabled for dyndbg+jump-label 13edef385bee drm_print: wrap drm_*_dbg in dyndbg jumplabel bbfe74b86e22 drm_print: interpose drm_*dbg with forwarding macros d701d41dd224 drm_print: condense enum drm_debug_category e2b2197bb80e dyndbg: abstract dyndbg_site_is_printing 523e64e179fa dyndbg: improve change-info to have old and new 63c1eb03d319 dyndbg: drop EXPORTed dynamic_debug_exec_queries 3a4e3b60eacf dyndbg: add DEFINE_DYNAMIC_DEBUG_CLASSBITS macro and callbacks a8f6c71f283e dyndbg: add class_id field and query support c2ed9cc02d9c dyndbg: fix static_branch manipulation
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/index.html
[email protected]
maintainerRe: [Intel-gfx] ✗ Fi.CI.BAT: failure for use dynamic-debug under drm.debug api (rev2)
Quoted 30 lines · Patchwork
Patch Details
Series:use dynamic-debug under drm.debug api (rev2) URL:https://patchwork.freedesktop.org/series/100289/ State:failure Details:https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/index.htmlCI Bug Log - changes from
CI_DRM_11306->Patchwork_22448Summary
FAILURE
Serious unknown changes coming with
Patchwork_22448absolutely need to be verified manually.If you think the reported changes have nothing to do with the changes introduced in
Patchwork_22448, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22448/index.html
Participating hosts (50 -> 45)
Missing (5): shard-tglu fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus
Possible new issues
Here are the unknown changes that may have been introduced in
Patchwork_22448:
Quoted 7 lines
IGT changes
Possible regressions
igt@gem_exec_suspend@basic-s3@smem:
fi-cml-u2: PASS -> INCOMPLETE
this one's incomplete cuz of an ext4 boot problem and panic. unrelated.
<2>[ 77.549595] EXT4-fs error (device sda2): ext4_journal_check_start:83: comm dmesg: Detected aborted journal <3>[ 77.549651] Buffer I/O error on dev sda2, logical block 58228736, lost sync page write <2>[ 77.549684] EXT4-fs error (device sda2): ext4_journal_check_start:83: comm rs:main Q:Reg: Detected aborted journal <3>[ 77.550560] JBD2: Error -5 detected when updating journal superblock for sda2-8. <3>[ 77.553593] Buffer I/O error on dev sda2, logical block 0, lost sync page write <3>[ 77.554225] EXT4-fs (sda2): I/O error while writing superblock <3>[ 77.554229] EXT4-fs (sda2): I/O error while writing superblock <0>[ 77.554869] Kernel panic - not syncing: EXT4-fs (device sda2): panic forced after error <0>[ 78.581703] Shutting down cpus with NMI <0>[ 78.581733] Kernel Offset: disabled <4>[ 78.581785] CPU: 5 PID: 957 Comm: dmesg Not tainted
5.17.0-rc6-CI-Patchwork_22448+ #1
Quoted 6 lines
Known issues
Here are the changes found in
Patchwork_22448that come from known issues:
c2ed9cc02d9cdyndbg: fixstatic_branchmanipulation