use DYNAMIC_DEBUG to implement DRM.debug
Subsystems (10)
Jim Cromie
maintainerv6 cover use DYNAMIC_DEBUG to implement DRM.debug
This patchset does 3 main things.
Adds DEFINE_DYNAMIC_DEBUG_CATEGORIES to define bitmap => category control of pr_debugs, and to create their sysfs entries.
Uses it in amdgpu, i915 to control existing pr_debugs according to their ad-hoc categorizations.
Plugs dyndbg into drm-debug framework, in a configurable manner.
v6: cleans up per v5 feedback, and adds RFC stuff:
- test_dynamic_debug.ko: uses tracer facility added in v5:8/9
- prototype print-once & rate-limiting
Hopefully adding RFC stuff doesnt distract too much.
Jim Cromie (11):
moduleparam: add data member to struct kernel_param
dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES and callbacks i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create "gvt:core:"
etc categories
amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES to control categorized
pr_debugs
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
dyndbg: RFC add debug-trace callback, selftest with it. RFC
dyndbg: RFC add print-once and print-ratelimited features. RFC.
drivers/gpu/drm/Kconfig | 13 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 293 ++++++++------- .../gpu/drm/amd/display/dc/core/dc_debug.c | 44 ++- drivers/gpu/drm/drm_print.c | 49 ++- drivers/gpu/drm/i915/gvt/Makefile | 4 + drivers/gpu/drm/i915/gvt/debug.h | 18 +- drivers/gpu/drm/i915/i915_params.c | 35 ++ drivers/gpu/drm/nouveau/nouveau_drm.c | 36 +- include/drm/drm_print.h | 148 ++++++-- include/linux/dynamic_debug.h | 81 ++++- include/linux/moduleparam.h | 11 +- lib/Kconfig.debug | 11 + lib/Makefile | 1 + lib/dynamic_debug.c | 336 ++++++++++++++++-- lib/test_dynamic_debug.c | 279 +++++++++++++++ 15 files changed, 1117 insertions(+), 242 deletions(-) create mode 100644 lib/test_dynamic_debug.c
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v6 1/11 moduleparam: add data member to struct kernel_param
Add a const void* data member to the struct, to allow attaching private data that will be used soon by a setter method (via kp->data) to perform more elaborate actions.
To attach the data at compile time, add new macros:
module_param_cb_data() derives from module_param_cb(), adding data param, and latter is redefined to use former.
It calls __module_param_call_with_data(), which accepts new data param and inits .data with it. Re-define __module_param_call() to use it.
Use of this new data member will be rare, it might be worth redoing this as a separate/sub-type to de-bloat the base case.
---
v6:
. const void* data - <[email protected]>
. better macro names s/_cbd/_cb_data/, s/_wdata/_with_data/ . more const, no cast - Willy
--- include/linux/moduleparam.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
include/linux/moduleparam.h +9 -2
@@ -78,6 +78,7 @@ struct kernel_param {const struct kparam_string *str;const struct kparam_array *arr; }; +const void *data; };extern const struct kernel_param __start___param[], __stop___param[];
@@ -175,6 +176,9 @@ struct kparam_array#define module_param_cb (name, ops, arg, perm) \ __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0) +#define module_param_cb_data (name, ops, arg, perm, data) \ + __module_param_call_with_data(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0, data) +#define module_param_cb_unsafe (name, ops, arg, perm) \ __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ KERNEL_PARAM_FL_UNSAFE)
@@ -284,14 +288,17 @@ struct kparam_array/* This is the fundamental function for registering boot/module parameters. */ -#define __module_param_call (prefix, name, ops, arg, perm, level, flags) \ +#define __module_param_call (prefix, name, ops, arg, perm, level, flags) \ + __module_param_call_with_data(prefix, name, ops, arg, perm, level, flags, NULL) + +#define __module_param_call_with_data (prefix, name, ops, arg, perm, level, flags, data) \/* Default value instead of permissions? */ \ static const char __param_str_##name[] = prefix #name; \ static struct kernel_param __moduleparam_const __param_##name \ __used __section("__param") \ __aligned(__alignof__(struct kernel_param)) \ = { __param_str_##name, THIS_MODULE, ops, \ - VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } } + VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg }, data }/* Obsolete - use module_param_cb() */ #define module_param_call (name, _set, _get, arg, perm) \
Signature · 1 line
2.31.1
Jason Baron
maintainerRe: [PATCH v6 01/11] moduleparam: add data member to struct kernel_param
Quoted 30 lines · Jim Cromie
Add a const void* data member to the struct, to allow attaching private data that will be used soon by a setter method (via
kp->data) to perform more elaborate actions.To attach the data at compile time, add new macros:
module_param_cb_data()derives frommodule_param_cb(), adding data param, and latter is redefined to use former.It calls
__module_param_call_with_data(), which accepts new data param and inits .data with it. Re-define__module_param_call()to use it.Use of this new data member will be rare, it might be worth redoing this as a separate/sub-type to de-bloat the base case.
Signed-off-by Jim Cromie <[email protected]>---
v6:
. const void* data - <[email protected]>
. better macro names s/_cbd/_cb_data/, s/_wdata/_with_data/ . more const, no cast - Willy--- include/linux/moduleparam.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)include/linux/moduleparam.h +0
-0
include/linux/moduleparam.h struct kernel_param { · line 83
Quoted 6 lines
include/linux/moduleparam.h +1
-0@@ -78,6 +78,7 @@ struct kernel_param {const struct kparam_string *str;const struct kparam_array *arr; }; +const void *data; };
I wonder if kp->arg can just be used for all this and avoid this patch entirely?
define something like:
struct dd_bitmap_param {
int bitmap;
struct dyndbg_bitdesc *bitmap_arr;
};and then just pass a pointer to it as 'arg' for module_param_cb? And then in the get/set callbacks you can use kp->bitmap and kp->bitmap_arr.
Thanks,
-Jason
Quoted 32 lines
include/linux/moduleparam.h +8
-2extern const struct kernel_param __start___param[], __stop___param[];@@ -175,6 +176,9 @@ struct kparam_array#define module_param_cb (name, ops, arg, perm) \ __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0) +#define module_param_cb_data (name, ops, arg, perm, data) \ + __module_param_call_with_data(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0, data) +#define module_param_cb_unsafe (name, ops, arg, perm) \ __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ KERNEL_PARAM_FL_UNSAFE)@@ -284,14 +288,17 @@ struct kparam_array/* This is the fundamental function for registering boot/module parameters. */ -#define __module_param_call (prefix, name, ops, arg, perm, level, flags) \ +#define __module_param_call (prefix, name, ops, arg, perm, level, flags) \ + __module_param_call_with_data(prefix, name, ops, arg, perm, level, flags, NULL) + +#define __module_param_call_with_data (prefix, name, ops, arg, perm, level, flags, data) \/* Default value instead of permissions? */ \ static const char __param_str_##name[] = prefix #name; \ static struct kernel_param __moduleparam_const __param_##name \ __used __section("__param") \ __aligned(__alignof__(struct kernel_param)) \ = { __param_str_##name, THIS_MODULE, ops, \ - VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } } + VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg }, data }/* Obsolete - use module_param_cb() */ #define module_param_call (name, _set, _get, arg, perm) \
[email protected]
maintainerRe: [PATCH v6 01/11] moduleparam: add data member to struct kernel_param
Quoted 16 lines · Jason Baron
Quoted 6 lines · Jim Cromie
Add a const void* data member to the struct, to allow attaching private data that will be used soon by a setter method (via
kp->data) to perform more elaborate actions.To attach the data at compile time, add new macros:
I wonder if
kp->argcan just be used for all this and avoid this patch entirely?define something like:
Quoted 8 lines
struct dd_bitmap_param { int bitmap; struct dyndbg_bitdesc *bitmap_arr; };and then just pass a pointer to it as 'arg' for
module_param_cb? And then in the get/set callbacks you can usekp->bitmapandkp->bitmap_arr.
yes, thanks, this is working out nicely.
I think I was thrown off by the arg name,
if it had been called data, it would have slapped me
Quoted 4 lines
Thanks,
-Jason
Jim Cromie
maintainerPATCH v6 2/11 dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES and callbacks
In reply to Jim CromieDEFINE_DYNAMIC_DEBUG_CATEGORIES(name, var, bitmap_desc, @bit_descs) allows users to define a drm.debug style (bitmap) sysfs interface, and to specify the desired mapping from bits[0-N] to the format-prefix'd pr_debug()s to be controlled.
DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug,
"i915/gvt bitmap desc",
/**
* search-prefixes, passed to dd-exec_queries
* defines bits 0-N in order.
* leading ^ is tacitly inserted (by callback currently)
* trailing space used here excludes subcats.
* helper macro needs more work
* macro to autogen ++$i, 0x%x$i ?
*/
_DD_cat_("gvt:cmd: "),
_DD_cat_("gvt:core: "),
_DD_cat_("gvt:dpy: "),
_DD_cat_("gvt:el: "),
_DD_cat_("gvt:irq: "),
_DD_cat_("gvt:mm: "),
_DD_cat_("gvt:mmio: "),
_DD_cat_("gvt:render: "),
_DD_cat_("gvt:sched: "));dynamic_debug.c: add 3 new elements:
- 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, All 3 are non-static and exported.
dynamic_debug.h:
Add DEFINE_DYNAMIC_DEBUG_CATEGORIES() described above, and a do-nothing stub.
Note that it also calls MODULE_PARM_DESC for the user, but expects the user to catenate all the bit-descriptions together (as is done in drm.debug), and in the following uses in amdgpu, i915.
This in the hope that someone can offer an auto-incrementing label-generating macro, producing "\tbit-4 0x10\t" etc, and can show how to apply it to __VA_ARGS__.
Also extern 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 the prefix be present in the compiled-in format string; where run-time prefixing is used, that format would be "%s...", which is not usefully selectable.
Adding structural query terms (func,file,lineno) could help (module is already done), but DEFINE_DYNAMIC_DEBUG_CATEGORIES can't do that now, adding it needs a better reason imo.
Dyndbg is completely agnostic wrt the categorization scheme used, to play well with any prefix convention already in use. Ad-hoc categories and sub-categories are implicitly allowed, author discipline and review is expected.
Here are some examples:
"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:","fixme:" might be handy
"A:".."Z:" uhm, yeah
Hierarchical classes/categories are natural:
"drm:<CAT>:" is used in later commit
"drm:<CAT>:<SUB>:" is a natural extension.
"drm:atomic:fail:" has been proposed, sounds directly useful
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 sub-categories:
These have a caveat wrt wrapper macros adding prefixes like "drm:atomic: "; the trailing space in the prefix means that drm_dbg_atomic("fail: ...") pastes as "drm:atomic: fail: ", which obviously isn't ideal wrt clear and simple bitmaps.
A possible solution is to have a FOO_() version of every FOO() macro which (anti-mnemonically) elides the trailing space, which is normally inserted by a modified FOO(). Doing this would enforce a policy decision that "debug categories will be space terminated", with an pressure-relief valve.
Summarizing:
- "drm:kms: " & "drm:kms:" are different
- "drm:kms" also different - includes drm:kms2:
- "drm:kms:\t" also different
- "drm:kms:*" doesn't work, no wildcard on format atm.
Order matters in DEFINE_DYNAMIC_DEBUG_CATEGORIES(... @bit_descs)
@bit_descs (array) position determines the bit mapping to the prefix, so to keep a stable map, new categories or 3rd level categories must be added to the end.
Since bits are/will-stay applied 0-N, the later bits can countermand the earlier ones, but its 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.
For "drm:atomic:fail:" in particular, its best not to add it into an existing bitmap, because the current setting would be lost at every (unrelated) write, and a separate bitmap is much more stable.
There is still plenty of bikeshedding to do.
---
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 safer varname construct . workaround for !CONFIG_MODULES
. move forward decl down to where its needed
--- include/linux/dynamic_debug.h | 52 +++++++++++++++++++++++- lib/dynamic_debug.c | 76 ++++++++++++++++++++++++++++++++--- 2 files changed, 121 insertions(+), 7 deletions(-)
include/linux/dynamic_debug.h +50 -2
@@ -51,8 +51,6 @@ struct _ddebug {#endif } __attribute__((aligned(8))); - -#if defined(CONFIG_DYNAMIC_DEBUG_CORE )/* exported for module authors to exercise >control */
@@ -181,6 +179,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 +229,52 @@ static inline int dynamic_debug_exec_queries(const char *query, const char *modnreturn 0 ; } +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 { +/* bitpos is inferred from index in containing array */ +const char *prefix; +const char *help; +}; + +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) +/** +* DEFINE_DYNAMIC_DEBUG_CATEGORIES() - define debug categories, bitmap, sysfs-knob +* @fsname: parameter basename under /sys +* @var: C-identifier holding state +* @_desc: string summarizing the controls provided +* @...: list of struct dyndbg_bitdesc initializations +* +* Defines /sys/modules/$modname/parameters/@fsname, and @bit_descs, +* which maps bits 0-N to categories of pr_debugs to be controlled. +* This is effectively write only, because controlled callsites can be +* further modified via >control. +* +* Also calls MODULE_PARM_DESC(fsname, _desc), with the intent to +* generate the bit_legend and apply it to the given bit_descs +*/ +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, var, _desc, ...) \ + MODULE_PARM_DESC(fsname, _desc); \ + static const struct dyndbg_bitdesc dyndbg_cats_##var[] = \ + { __VA_ARGS__, { NULL, NULL } }; \ + module_param_cb_data(fsname, ¶m_ops_dyndbg, &var, 0644, \ + &dyndbg_cats_##var) + +#define _DD_cat_ (pfx) { .prefix = pfx, .help = "help for " pfx } +#define _DD_cat_help_ (pfx) "\t " pfx "\t- help for " pfx "\n" + +extern const struct kernel_param_ops param_ops_dyndbg; +#else +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, var, bitmap_desc, ...) \ + MODULE_PARM_DESC(fsname, "auto: " bitmap_desc) +#define _DD_cat_ (pfx) +#define _DD_cat_help_ (pfx) +#endif +#endif
lib/dynamic_debug.c +71 -5
94 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v6 02/11] dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES and callbacks
Quoted 111 lines · Jim Cromie
DEFINE_DYNAMIC_DEBUG_CATEGORIES(name, var, bitmap_desc, @bit_descs)allows users to define a drm.debug style (bitmap) sysfs interface, and to specify the desired mapping from bits[0-N] to the format-prefix'd pr_debug()s to be controlled.DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt,
__gvt_debug,"i915/gvt bitmap desc", /** * search-prefixes, passed to dd-exec_queries * defines bits 0-N in order. * leading ^ is tacitly inserted (by callback currently) * trailing space used here excludes subcats. * helper macro needs more work * macro to autogen ++$i, 0x%x$i ? */ _DD_cat_("gvt:cmd: "), _DD_cat_("gvt:core: "), _DD_cat_("gvt:dpy: "), _DD_cat_("gvt:el: "), _DD_cat_("gvt:irq: "), _DD_cat_("gvt:mm: "), _DD_cat_("gvt:mmio: "), _DD_cat_("gvt:render: "), _DD_cat_("gvt:sched: "));
dynamic_debug.c: add 3 new elements:- int
param_set_dyndbg()
- intparam_get_dyndbg()
- structkernel_param_opsparam_ops_dyndbgFollowing the model of
kernel/params.cSTANDARD_PARAM_DEFS, All 3 are non-static and exported.
dynamic_debug.h:Add
DEFINE_DYNAMIC_DEBUG_CATEGORIES()described above, and a do-nothing stub.Note that it also calls
MODULE_PARM_DESCfor the user, but expects the user to catenate all the bit-descriptions together (as is done in drm.debug), and in the following uses in amdgpu, i915.This in the hope that someone can offer an auto-incrementing label-generating macro, producing "\tbit-4 0x10\t" etc, and can show how to apply it to
__VA_ARGS__.Also extern the struct
kernel_paramparam_ops_dyndbgsymbol, as is done inmoduleparams.hfor all the STANDARD params.USAGE NOTES:
Using dyndbg to query on "format ^$prefix" requires that the prefix be present in the compiled-in format string; where run-time prefixing is used, that format would be "%s...", which is not usefully selectable.
Adding structural query terms (func,file,lineno) could help (module is already done), but
DEFINE_DYNAMIC_DEBUG_CATEGORIEScan't do that now, adding it needs a better reason imo.Dyndbg is completely agnostic wrt the categorization scheme used, to play well with any prefix convention already in use. Ad-hoc categories and sub-categories are implicitly allowed, author discipline and review is expected.
Here are some examples:
"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:","fixme:" might be handy
"A:".."Z:" uhm, yeahHierarchical classes/categories are natural:
"drm:<CAT>:" is used in later commit "drm:<CAT>:<SUB>:" is a natural extension. "drm:atomic:fail:" has been proposed, sounds directly usefulSome 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 sub-categories:
These have a caveat wrt wrapper macros adding prefixes like "drm:atomic: "; the trailing space in the prefix means that
drm_dbg_atomic("fail: ...")pastes as "drm:atomic: fail: ", which obviously isn't ideal wrt clear and simple bitmaps.A possible solution is to have a
FOO_()version of everyFOO()macro which (anti-mnemonically) elides the trailing space, which is normally inserted by a modifiedFOO(). Doing this would enforce a policy decision that "debug categories will be space terminated", with an pressure-relief valve.Summarizing:
- "drm:kms: " & "drm:kms:" are different
- "drm:kms" also different - includes drm:kms2: - "drm:kms:\t" also different - "drm:kms:*" doesn't work, no wildcard on format atm.
Quoted 8 lines
Order matters in DEFINE_DYNAMIC_DEBUG_CATEGORIES(... @bit_descs)
@bit_descs (array) position determines the bit mapping to the prefix, so to keep a stable map, new categories or 3rd level categories must be added to the end.
Since bits are/will-stay applied 0-N, the later bits can countermand the earlier ones, but its tricky - consider;
it's
Quoted 10 lines
DD_CATs(... "drm:atomic:", "drm:atomic:fail:" ) // misleadingThe 1st search-term is misleading, because it includes (modifies) subcategories, but then 2nd overrides it. So don't do that.
For "drm:atomic:fail:" in particular, its best not to add it into an existing bitmap, because the current setting would be lost at every (unrelated) write, and a separate bitmap is much more stable.
There is still plenty of bikeshedding to do.
...
include/linux/dynamic_debug.h struct _ddebug { · line 55
Quoted 6 lines
include/linux/dynamic_debug.h +0
-2@@ -51,8 +51,6 @@ struct _ddebug {#endif } __attribute__((aligned(8))); - -
stray change.
...
include/linux/dynamic_debug.h static inline int dynamic_debug_exec_queries(const char *query, const char *modn · line 235
Quoted 4 lines
include/linux/dynamic_debug.h +4
-0+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 ; }
Not sure if it's aligned with the style in this file, but usually we put { at the very beginning of the line.
...
lib/dynamic_debug.c static int ddebug_exec_query(char *query_string, const char *modname) · line 518
Quoted 9 lines
lib/dynamic_debug.c +5
-4-/* handle multiple queries in query string, continue on error, return -last error or number of matching callsites. Module name is either -in param (for boot arg) or perhaps in query string. -*/ +/* +* handle multiple queries in query string, continue on error, return +* last error or number of matching callsites. Module name is either +* in param (for boot arg) or perhaps in query string. +*/
Doesn't belong to the patch, split it separately.
...
Quoted 1 line
+
vpr_info("query %d: \"%s\" %s\n", i, query, (modname) ? modname : "");
too many parentheses. Also may use
modname ?: ""
form (but not all maintainers are happy with it).
...
Quoted 10 lines
lib/dynamic_debug.c +10
-0+if (!bitmap) { +pr_err ("set_dyndbg: no bits=>queries map\n" ); +return -EINVAL ; + } + rc =kstrtoul (instr,0 , &inbits); +if (rc) { +pr_err ("set_dyndbg: failed\n" ); +return rc; + } +vpr_info ("set_dyndbg: input 0x%lx\n" , inbits);
lib/dynamic_debug.c int dynamic_debug_exec_queries(const char *query, const char *modname) · line 619
Quoted 10 lines
lib/dynamic_debug.c +10
-0+ +for (i =0 ; bitmap->prefix; i++, bitmap++) { +snprintf (query,FMT_QUERY_SIZE ,"format '^%s' %cp" , bitmap->prefix, +test_bit (i, &inbits) ?'+' :'-' ); + + matches =ddebug_exec_queries (query,KP_MOD_NAME ); + +v2pr_info ("bit-%d: %d matches on '%s'\n" , i, matches, query); + totct += matches; + }
I'm wondering if there is a room to parse a bitmap as a bitmap.
...
lib/dynamic_debug.c int dynamic_debug_exec_queries(const char *query, const char *modname) · line 635
Quoted 4 lines
lib/dynamic_debug.c +4
-0+int param_get_dyndbg (char *buffer,const struct kernel_param *kp) +{ +return scnprintf (buffer,PAGE_SIZE ,"%u\n" , + *((unsigned int *)kp->arg));
One line?
Quoted 1 line
+}
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerRe: [PATCH v6 02/11] dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES and callbacks
Quoted 8 lines · Andy Shevchenko
Quoted 6 lines · Jim Cromie
DEFINE_DYNAMIC_DEBUG_CATEGORIES(name, var, bitmap_desc, @bit_descs)allows users to define a drm.debug style (bitmap) sysfs interface, and to specify the desired mapping from bits[0-N] to the format-prefix'd pr_debug()s to be controlled.
yes to everything, 1 question
Quoted 14 lines
Quoted 14 lines
lib/dynamic_debug.c +14
-0+if (!bitmap) { +pr_err ("set_dyndbg: no bits=>queries map\n" ); +return -EINVAL ; + } + rc =kstrtoul (instr,0 , &inbits); +if (rc) { +pr_err ("set_dyndbg: failed\n" ); +return rc; + } +vpr_info ("set_dyndbg: input 0x%lx\n" , inbits); + +for (i =0 ; bitmap->prefix; i++, bitmap++) { +snprintf (query,FMT_QUERY_SIZE ,"format '^%s' %cp" , bitmap->prefix, +test_bit (i, &inbits) ?'+' :'-' );
Quoted 9 lines
lib/dynamic_debug.c int dynamic_debug_exec_queries(const char *query, const char *modname) · line 619
Quoted 6 lines
lib/dynamic_debug.c +6
-0+ + matches =ddebug_exec_queries (query,KP_MOD_NAME ); + +v2pr_info ("bit-%d: %d matches on '%s'\n" , i, matches, query); + totct += matches; + }I'm wondering if there is a room to parse a bitmap as a bitmap.
I dont know what you mean here.
can you point to an example to crib from ?
thanks
Quoted 3 lines
--
With Best Regards,
Andy Shevchenko
Jason Baron
maintainerRe: [PATCH v6 02/11] dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES and callbacks
In reply to Jim CromieQuoted 309 lines · Jim Cromie
DEFINE_DYNAMIC_DEBUG_CATEGORIES(name, var, bitmap_desc, @bit_descs)allows users to define a drm.debug style (bitmap) sysfs interface, and to specify the desired mapping from bits[0-N] to the format-prefix'd pr_debug()s to be controlled.DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt,
__gvt_debug,"i915/gvt bitmap desc", /** * search-prefixes, passed to dd-exec_queries * defines bits 0-N in order. * leading ^ is tacitly inserted (by callback currently) * trailing space used here excludes subcats. * helper macro needs more work * macro to autogen ++$i, 0x%x$i ? */ _DD_cat_("gvt:cmd: "), _DD_cat_("gvt:core: "), _DD_cat_("gvt:dpy: "), _DD_cat_("gvt:el: "), _DD_cat_("gvt:irq: "), _DD_cat_("gvt:mm: "), _DD_cat_("gvt:mmio: "), _DD_cat_("gvt:render: "), _DD_cat_("gvt:sched: "));
dynamic_debug.c: add 3 new elements:- int
param_set_dyndbg()
- intparam_get_dyndbg()
- structkernel_param_opsparam_ops_dyndbgFollowing the model of
kernel/params.cSTANDARD_PARAM_DEFS, All 3 are non-static and exported.
dynamic_debug.h:Add
DEFINE_DYNAMIC_DEBUG_CATEGORIES()described above, and a do-nothing stub.Note that it also calls
MODULE_PARM_DESCfor the user, but expects the user to catenate all the bit-descriptions together (as is done in drm.debug), and in the following uses in amdgpu, i915.This in the hope that someone can offer an auto-incrementing label-generating macro, producing "\tbit-4 0x10\t" etc, and can show how to apply it to
__VA_ARGS__.Also extern the struct
kernel_paramparam_ops_dyndbgsymbol, as is done inmoduleparams.hfor all the STANDARD params.USAGE NOTES:
Using dyndbg to query on "format ^$prefix" requires that the prefix be present in the compiled-in format string; where run-time prefixing is used, that format would be "%s...", which is not usefully selectable.
Adding structural query terms (func,file,lineno) could help (module is already done), but
DEFINE_DYNAMIC_DEBUG_CATEGORIEScan't do that now, adding it needs a better reason imo.Dyndbg is completely agnostic wrt the categorization scheme used, to play well with any prefix convention already in use. Ad-hoc categories and sub-categories are implicitly allowed, author discipline and review is expected.
Here are some examples:
"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:","fixme:" might be handy
"A:".."Z:" uhm, yeahHierarchical classes/categories are natural:
"drm:<CAT>:" is used in later commit
"drm:<CAT>:<SUB>:" is a natural extension.
"drm:atomic:fail:" has been proposed, sounds directly usefulSome 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 sub-categories:
These have a caveat wrt wrapper macros adding prefixes like "drm:atomic: "; the trailing space in the prefix means that
drm_dbg_atomic("fail: ...")pastes as "drm:atomic: fail: ", which obviously isn't ideal wrt clear and simple bitmaps.A possible solution is to have a
FOO_()version of everyFOO()macro which (anti-mnemonically) elides the trailing space, which is normally inserted by a modifiedFOO(). Doing this would enforce a policy decision that "debug categories will be space terminated", with an pressure-relief valve.Summarizing:
- "drm:kms: " & "drm:kms:" are different
- "drm:kms" also different - includes drm:kms2:
- "drm:kms:\t" also different
- "drm:kms:*" doesn't work, no wildcard on format atm.Order matters in DEFINE_DYNAMIC_DEBUG_CATEGORIES(... @bit_descs)
@bit_descs (array) position determines the bit mapping to the prefix, so to keep a stable map, new categories or 3rd level categories must be added to the end.
Since bits are/will-stay applied 0-N, the later bits can countermand the earlier ones, but its tricky - consider;
DD_CATs(... "drm:atomic:", "drm:atomic:fail:" ) // misleadingThe 1st search-term is misleading, because it includes (modifies) subcategories, but then 2nd overrides it. So don't do that.
For "drm:atomic:fail:" in particular, its best not to add it into an existing bitmap, because the current setting would be lost at every (unrelated) write, and a separate bitmap is much more stable.
There is still plenty of bikeshedding to do.
Signed-off-by Jim Cromie <[email protected]>---
v5:
. rename toDEFINE_DYNAMIC_DEBUG_CATEGORIESfromDEFINE_DYNDBG_BITMAP. inset_dyndbg, replace hardcoded "i915" wkp->mod->name. static inline the stubs
. const *str in structs, const array. - Emil
. dyndbg: add do-nothingDEFINE_DYNAMIC_DEBUG_CATEGORIESif !DD_CORE . callMOD_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 safer varname construct . workaround for !CONFIG_MODULES
. move forward decl down to where its needed--- include/linux/dynamic_debug.h | 52 +++++++++++++++++++++++- lib/dynamic_debug.c | 76 ++++++++++++++++++++++++++++++++--- 2 files changed, 121 insertions(+), 7 deletions(-)include/linux/dynamic_debug.h +50
-2@@ -51,8 +51,6 @@ struct _ddebug {#endif } __attribute__((aligned(8))); - -#if defined(CONFIG_DYNAMIC_DEBUG_CORE )/* exported for module authors to exercise >control */ @@ -181,6 +179,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 +229,52 @@ static inline int dynamic_debug_exec_queries(const char *query, const char *modnreturn 0 ; } +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 { +/* bitpos is inferred from index in containing array */ +const char *prefix; +const char *help; +}; + +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) +/** +* DEFINE_DYNAMIC_DEBUG_CATEGORIES() - define debug categories, bitmap, sysfs-knob +* @fsname: parameter basename under /sys +* @var: C-identifier holding state +* @_desc: string summarizing the controls provided +* @...: list of struct dyndbg_bitdesc initializations +* +* Defines /sys/modules/$modname/parameters/@fsname, and @bit_descs, +* which maps bits 0-N to categories of pr_debugs to be controlled. +* This is effectively write only, because controlled callsites can be +* further modified via >control. +* +* Also calls MODULE_PARM_DESC(fsname, _desc), with the intent to +* generate the bit_legend and apply it to the given bit_descs +*/ +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, var, _desc, ...) \ + MODULE_PARM_DESC(fsname, _desc); \ + static const struct dyndbg_bitdesc dyndbg_cats_##var[] = \ + { __VA_ARGS__, { NULL, NULL } }; \ + module_param_cb_data(fsname, ¶m_ops_dyndbg, &var, 0644, \ + &dyndbg_cats_##var) + +#define _DD_cat_ (pfx) { .prefix = pfx, .help = "help for " pfx } +#define _DD_cat_help_ (pfx) "\t " pfx "\t- help for " pfx "\n" + +extern const struct kernel_param_ops param_ops_dyndbg; +#else +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES (fsname, var, bitmap_desc, ...) \ + MODULE_PARM_DESC(fsname, "auto: " bitmap_desc) +#define _DD_cat_ (pfx) +#define _DD_cat_help_ (pfx) +#endif +#endif lib/dynamic_debug.c +51
-5@@ -511,10 +511,11 @@ static int ddebug_exec_query(char *query_string, const char *modname)return nfound; } -/* handle multiple queries in query string, continue on error, return -last error or number of matching callsites. Module name is either -in param (for boot arg) or perhaps in query string. -*/ +/* +* handle multiple queries in query string, continue on error, return +* last error or number of matching callsites. Module name is either +* in param (for boot arg) or perhaps in query string. +*/ static int ddebug_exec_queries (char *query,const char *modname) {char *split;@@ -529,7 +530,7 @@ static int ddebug_exec_queries(char *query, const char *modname)if (!query || !*query || *query =='#' )continue ; -vpr_info ("query %d: \"%s\"\n" , i, query); +vpr_info ("query %d: \"%s\" %s\n" , i, query, (modname) ? modname :"" ); rc =ddebug_exec_query (query, modname);if (rc <0 ) {@@ -577,6 +578,71 @@ int dynamic_debug_exec_queries(const char *query, const char *modname) }EXPORT_SYMBOL_GPL (dynamic_debug_exec_queries); +#ifdef MODULES +#define KP_MOD_NAME kp->mod->name +#else +#define KP_MOD_NAME NULL/* wildcard */ +#endif +#define FMT_QUERY_SIZE 128/* typically need <40 */ +/** +* param_set_dyndbg() - drm.debug style bits=>categories setter +* @instr: string echo>d to sysfs +* @kp: struct kernel_param* ->data has bitmap +* Exported to support DEFINE_DYNAMIC_DEBUG_CATEGORIES +*/ +int param_set_dyndbg (const char *instr,const struct kernel_param *kp) +{ +unsigned long inbits; +int rc, i, matches =0 , totct =0 ; +char query[FMT_QUERY_SIZE ]; +const struct dyndbg_bitdesc *bitmap = kp->data; + +if (!bitmap) { +pr_err ("set_dyndbg: no bits=>queries map\n" ); +return -EINVAL ; + } + rc =kstrtoul (instr,0 , &inbits); +if (rc) { +pr_err ("set_dyndbg: failed\n" ); +return rc; + } +vpr_info ("set_dyndbg: input 0x%lx\n" , inbits); + +for (i =0 ; bitmap->prefix; i++, bitmap++) { +snprintf (query,FMT_QUERY_SIZE ,"format '^%s' %cp" , bitmap->prefix, +test_bit (i, &inbits) ?'+' :'-' ); + + matches =ddebug_exec_queries (query,KP_MOD_NAME ); + +v2pr_info ("bit-%d: %d matches on '%s'\n" , i, matches, query); + totct += matches; + } +vpr_info ("total matches: %d\n" , totct); +return 0 ; +} +EXPORT_SYMBOL (param_set_dyndbg); + +/**
lib/dynamic_debug.c int dynamic_debug_exec_queries(const char *query, const char *modname) · line 635
Quoted 10 lines
lib/dynamic_debug.c +10
-0+* param_get_dyndbg() - drm.debug style bitmap to format-prefix categories +* @buffer: string returned to user via sysfs +* @kp: struct kernel_param* +* Exported to provide required .get interface, not useful. +* pr_debugs may be altered after .set via `echo $foo >control` +*/ +int param_get_dyndbg (char *buffer,const struct kernel_param *kp) +{ +return scnprintf (buffer,PAGE_SIZE ,"%u\n" , + *((unsigned int *)kp->arg));
If kp->arg is read here, don't we need to set too somewhere? I'm wondering if the 'get' can use one of the generic ones like param_get_int too? Instead of a special case here.
Thanks,
-Jason
Quoted 14 lines
lib/dynamic_debug.c +10
-0+} +EXPORT_SYMBOL (param_get_dyndbg); + +const struct kernel_param_ops param_ops_dyndbg = { + .set = param_set_dyndbg, + .get = param_get_dyndbg, +}; +/* support DEFINE_DYNAMIC_DEBUG_CATEGORIES users */ +EXPORT_SYMBOL (param_ops_dyndbg); +#define PREFIX_SIZE 64static int remaining (int wrote)
Jim Cromie
maintainerPATCH v6 3/11 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 nested 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:".
--- 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
Jim Cromie
maintainerPATCH v6 4/11 i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create "gvt:core:" etc categories
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",
{ "gvt:cmd: ", "command processing" },
{ "gvt:core: ", "core help" },
{ "gvt:dpy: ", "display help" },
{ "gvt:el: ", "help" },
{ "gvt:irq: ", "help" },
{ "gvt:mm: ", "help" },
{ "gvt:mmio: ", "help" },
{ "gvt:render: ", "help" },
{ "gvt:sched: " "help" });The actual patch has a few details different, cmd_help() macro emits the initialization construct.
if CONFIG_DRM_USE_DYNAMIC_DEBUG, then -DDYNAMIC_DEBUG_MODULE is added cflags, by gvt/Makefile.
---
v4+:
. static decl of vector of bit->class descriptors - Emil.V . relocate gvt-makefile chunk from elsewhere
--- drivers/gpu/drm/i915/gvt/Makefile | 4 ++++ drivers/gpu/drm/i915/i915_params.c | 35 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+)
drivers/gpu/drm/i915/gvt/Makefile +4 -0
@@ -7,3 +7,7 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \ ccflags-y += -I $(srctree)/$(src) -I $(srctree)/$(src)/$(GVT_DIR)/ i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE)) + +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +ccflags-y += -DDYNAMIC_DEBUG_MODULE +#endif
drivers/gpu/drm/i915/i915_params.c +35 -0
@@ -265,3 +265,38 @@ void i915_params_free(struct i915_params *params)I915_PARAMS_FOR_EACH (FREE );#undef FREE } + +#ifdef DRM_USE_DYNAMIC_DEBUG +/* todo: needs DYNAMIC_DEBUG_MODULE in some cases */ + +unsigned long __gvt_debug; +EXPORT_SYMBOL (__gvt_debug); + +#define _help (key) "\t \"" key "\"\t: help for " key "\n" + +#define I915_GVT_CATEGORIES (name) \ + " Enable debug output via /sys/module/i915/parameters/" #name \ + ", where each bit enables a debug category.\n" \ + _help("gvt:cmd:") \ + _help("gvt:core:") \ + _help("gvt:dpy:") \ + _help("gvt:el:") \ + _help("gvt:irq:") \ + _help("gvt:mm:") \ + _help("gvt:mmio:") \ + _help("gvt:render:") \ + _help("gvt:sched:") + +DEFINE_DYNAMIC_DEBUG_CATEGORIES (debug_gvt, __gvt_debug, +I915_GVT_CATEGORIES (debug_gvt), +_DD_cat_ ("gvt:cmd:" ), +_DD_cat_ ("gvt:core:" ), +_DD_cat_ ("gvt:dpy:" ), +_DD_cat_ ("gvt:el:" ), +_DD_cat_ ("gvt:irq:" ), +_DD_cat_ ("gvt:mm:" ), +_DD_cat_ ("gvt:mmio:" ), +_DD_cat_ ("gvt:render:" ), +_DD_cat_ ("gvt:sched:" )); + +#endif
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v6 5/11 amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES to control categorized pr_debugs
In reply to Jim Cromielogger_types.h defines many DC_LOG_*() categorized debug wrappers. Most of these use DRM debug API, so are controllable using drm.debug, but others use bare pr_debug("$prefix: .."), each with a different class-prefix matching "^\[\w+\]:"
Use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create a /sys debug_dc parameter, modinfos, and to specify a map from bits -> categorized pr_debugs to be controlled.
--- .../gpu/drm/amd/display/dc/core/dc_debug.c | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +43 -1
@@ -36,8 +36,50 @@#include "resource.h" -#define DC_LOGGER_INIT (logger) +#ifdef DRM_USE_DYNAMIC_DEBUG +/* define a drm.debug style dyndbg pr-debug control point */ +#include <linux/dynamic_debug.h> + +unsigned long __debug_dc; +EXPORT_SYMBOL (__debug_dc); + +#define _help_ (key) "\t " key "\t- help for " key "\n" + +/* Id like to do these inside DEFINE_DYNAMIC_DEBUG_CATEGORIES, if possible */ +#define DC_DYNDBG_BITMAP_DESC (name) \ + "Control pr_debugs via /sys/module/amdgpu/parameters/" #name \ + ", where each bit controls a debug category.\n" \ + _help_("[SURFACE]:") \ + _help_("[CURSOR]:") \ + _help_("[PFLIP]:") \ + _help_("[VBLANK]:") \ + _help_("[HW_LINK_TRAINING]:") \ + _help_("[HW_AUDIO]:") \ + _help_("[SCALER]:") \ + _help_("[BIOS]:") \ + _help_("[BANDWIDTH_CALCS]:") \ + _help_("[DML]:") \ + _help_("[IF_TRACE]:") \ + _help_("[GAMMA]:") \ + _help_("[SMU_MSG]:") + +DEFINE_DYNAMIC_DEBUG_CATEGORIES (debug_dc, __debug_dc, +DC_DYNDBG_BITMAP_DESC (debug_dc), +_DD_cat_ ("[CURSOR]:" ), +_DD_cat_ ("[PFLIP]:" ), +_DD_cat_ ("[VBLANK]:" ), +_DD_cat_ ("[HW_LINK_TRAINING]:" ), +_DD_cat_ ("[HW_AUDIO]:" ), +_DD_cat_ ("[SCALER]:" ), +_DD_cat_ ("[BIOS]:" ), +_DD_cat_ ("[BANDWIDTH_CALCS]:" ), +_DD_cat_ ("[DML]:" ), +_DD_cat_ ("[IF_TRACE]:" ), +_DD_cat_ ("[GAMMA]:" ), +_DD_cat_ ("[SMU_MSG]:" )); +#endif +#define DC_LOGGER_INIT (logger)#define SURFACE_TRACE (...) do {\ if (dc->debug.surface_trace) \
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v6 6/11 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_DEBUG*(8 names), DRM_DEV_DEBUG*(3 names). There are thousands of these callsites, each categorized by their authors.
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.
This patch uses dynamic-debug with jump-label to patch enabled calls onto their respective NOOP slots, avoiding all runtime bit-checks of __drm_debug.
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 ~2100 new callsites on my i7/i915 laptop:
dyndbg: 195 debug prints in module drm_kms_helper
dyndbg: 298 debug prints in module drm
dyndbg: 1630 debug prints in module i915
CONFIG_DRM_USE_DYNAMIC_DEBUG enables this, and is available if CONFIG_DYNAMIC_DEBUG or CONFIG_DYNAMIC_DEBUG_CORE is chosen, and if CONFIG_JUMP_LABEL is enabled; this because its required to get the promised optimizations.
The "basic" -> "dyndbg" switchover is layered into the macro scheme
A. use DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug, __drm_debug,
"DRM debug category-per-bit control",
{ "drm:core:", "enable CORE debug messages" }, { "drm:kms:", "enable KMS debug messages" }, ...);
B. A "classy" version of DRM_UT_<CATs> map, named DRM_DBG_CAT_<CATs>
DRM_DBG_CLASS_<CATs> was proposed, I had agreed, but reconsidered; CATEGORY is already DRM's term-of-art, and adding a near-synonym 'CLASS' only adds ambiguity.
"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: " DRM_UT_* are preserved, since theyre used elsewhere.
We can probably reduce its use further, but thats a separate thing.
C. 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
this is where drm_debug_enabled() is avoided. prefix is prepended at compile-time, no category at runtime.
D. API[1] uses DRM_DBG_CAT_<CAT>s
these already use (C), now they use (B) too,
to get the correct token type for "basic" and "dyndbg" configs.
NOTES:
Because the dyndbg callback is watching __drm_debug, it is coherent with drm_debug_enabled(), the switchover should be transparent.
Code Review is expected to catch 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 search-prefixes/categories with a trailing space, which 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 idealWith "lineno X" in a query, its possible to enable single callsites, but it is tedious, and useless in a category context.
Unfortunately __func__ is not a macro, and cannot be catenated at preprocess/compile time.
---
v6:
. add kernel doc
. fix cpp paste, drop '#'
v5:
. use DEFINE_DYNAMIC_DEBUG_CATEGORIES in drm_print.c . s/DRM_DBG_CLASS_/DRM_DBG_CAT_/ - dont need another term . default=y in KBuild 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
--- drivers/gpu/drm/Kconfig | 13 ++++ drivers/gpu/drm/drm_print.c | 49 +++++++++---- include/drm/drm_print.h | 142 ++++++++++++++++++++++++++++-------- 3 files changed, 160 insertions(+), 44 deletions(-)
drivers/gpu/drm/Kconfig +13 -0
@@ -57,6 +57,19 @@ 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 patches pr_debug()s in/out + of the running kernel, so avoids those bit-test overheads, + and is therefore recommended. + config DRM_DEBUG_SELFTEST tristate "kselftests for DRM" depends on DRM
drivers/gpu/drm/drm_print.c +35 -14
81 lines not on this page · raw message
include/drm/drm_print.h +112 -30
230 lines not on this page · raw message
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v6 7/11 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 its 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
include/drm/drm_print.h +11 -5
@@ -378,6 +378,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 */
@@ -397,12 +402,13 @@ enum drm_debug_category {#define DRM_DBG_CAT_DP "drm:dp: "#define DRM_DBG_CAT_DRMRES "drm:res: "/* not in MODULE_PARM_DESC */ -#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
Signature · 1 line
2.31.1
Jim Cromie
maintainerPATCH v6 8/11 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 ro 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 v6 9/11 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
@@ -1246,19 +1246,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
Jim Cromie
maintainerPATCH v6 10/11 dyndbg: RFC add debug-trace callback, selftest with it. RFC
In reply to Jim CromieSean Paul [email protected] proposed, in
https://patchwork.freedesktop.org/series/78133/
drm/trace: Mirror DRM debug logs to tracefs
That patchset's objective is to be able to independently steer some of the debug stream to an alternate tracing destination, by splitting drm_debug_enabled() into syslog & trace flavors, and enabling them separately with a drm.debug_trace knob.
2 advantages are identified:
- syslog is heavyweight, alternate stream is lighter
- steering selected categories separately means less traffic
Dynamic-Debug can do this better:
1- all work is behind jump-label's NOOP, Zero overhead when off.
2- perfect site selectivity, no unwanted traffic.
drm's debug categories are a general classification system, not one tailored to pick out the exact pool of pr_debugs to watch/trace.
With drm.debug built on dyndbg, the given "drm:<cat>:" system can be used to select a base trace-set, which can then be adjusted +/-, and/or augmented with unrelated pr_debugs that just happen to be useful. And this tweaking can be done at the command-line, and reduced to a script.
Then the string-prefix "drm:<cat>:" system can be extended to suit.
The basic elements:
- add a new struct _ddebug member: (*tracer)(char *format, ...)
- add a new T flag to enable tracer
- adjust the static-key-enable/disable condition for (p|T)
- if (p) before printk, since T enables too.
- if (T) call tracer if its true
= int dynamic_debug_register_tracer(query, modname, tracer); = int dynamic_debug_unregister_tracer(query, modname, cookie);
This new interface lets clients set/unset a tracer function on each callsite matching the query, for example: "drm:atomic:fail:".
Clients must unregister the same callsites they register, allowing protection of each client's dyndbg-state setup against overwrites by others, while allowing maximal sharing of 1 slot/callsite.
The internal call-chain gets some rework: it gets new void* tracer param, which dynamic_debug_exec_queries() hides from public.
And convert ddebug_exec_queries() to wrap __ddebug_exec_queries(), and move the query copy code to it.
public: passing down:
dynamic_debug_(un)register_tracer tracer
dynamic_debug_exec_queries tracer=NULL
calling:
ddebug_exec_queries copies ro-query, tracer
__ddebug_exec_queries modifies query, tracer
ddebug_exec_query modifies query, tracer
Then adjust most ddebug_exec_queries users to __ddebug_exec_queries
Intended Behavior: (things are in flux, RFC)
- register sets empty slot, doesn't overwrite
the query selects callsites, and sets +T (grammar requires +-action)
- register allows same-tracer over-set wo warn
2nd register can then enable superset, subset, disjoint set
- unregister clears slot if it matches cookie/tracer query selects set, -T (as tested) tolerates over-clears
- dd-exec-queries(+/-T) can modify the enablements not sure its needed, but it falls out..
The code is currently in-line in ddebug_change(), to be moved to separate fn, rc determines flow, may also veto/alter changes by altering flag-settings - tbd.
TBD: Im not sure what happens when exec-queries(+T) hits a site wo a tracer (silence I think. maybe not ideal).
SELFTEST: test_dynamic_debug.ko:
Uses the tracer facility to implement a selftest:
- DUT(x) calls a set of categorized pr_debugs x times
- A custom tracer counts the number of calls (of T-enabled pr_debugs),
- test registers the tracer on the function,
then iteratively:
manipulates dyndbg states via query-cmds
calls DUT(x)
counts enabled callsite executions
reports mismatches
- modprobe test_dynamic_debug broken_tracer=1
attaches a broken tracer: recursive on pr_debug
Bad Things Happen.
has thrown me interesting panics.
This needs more work. RFC.
waste of time due to use_bad_tracer properties ?
NOTES:
Next step: replace tracer member with a hashtable lookup, done only when T. Registration then becomes populating the hashtable; mod->name would make a good key, which would limit tracer mapping granularity to 1 registrant per module, but not enablement, which is still the per-callsite bit.
ERRORS (or WARNINGS):
It should be an error to +T a callsite which has no aux_print set (ie already registered with a query that selected that callsite). This tacitly enforces registration.
Then +T,-T can toggle those aux_print callsites (or subsets of them) to tailor the debug-stream for the purpose. Controlling flow is the best work limiter.
---
v5: (this patch sent after (on top of) v4)
. fix "too many arguments to function", and name the args:
int (*aux_print)(const char *fmt, char *prefix, char *label, void *);
prefix : is a slot for dynamic_emit_prefix, or for custom buffer insert label : for builtin-caller used by drm-trace-print
void* : vaf, add type constraint later.
. fix printk (to syslog) needs if (+p), since +T also enables . add prototypes for un/register_aux_print
. change iface names: s/aux_print/tracer/
. also s/trace_print/tracer/
. struct va_format *vaf - tighten further ?
v6: (this version)
. add test module
. add mod arg to *register, following exec_queries pattern . move code off file bottom to "better" spot
. move kdoc to c from h
__dxq
--- include/linux/dynamic_debug.h | 12 +- lib/Kconfig.debug | 11 ++ lib/Makefile | 1 + lib/dynamic_debug.c | 145 ++++++++++++++---- lib/test_dynamic_debug.c | 279 ++++++++++++++++++++++++++++++++++ 5 files changed, 418 insertions(+), 30 deletions(-) create mode 100644 lib/test_dynamic_debug.c
include/linux/dynamic_debug.h +11 -1
@@ -20,6 +20,7 @@ struct _ddebug {const char *function;const char *filename;const char *format; +int (*tracer)(const char *fmt,char *prefix,char *label,struct va_format *vaf); unsigned int lineno:18;/* * The flags field controls the behaviour at the callsite.
@@ -27,7 +28,11 @@ struct _ddebug {* writes commands to <debugfs>/dynamic_debug/control */ #define _DPRINTK_FLAGS_NONE 0 -#define _DPRINTK_FLAGS_PRINT (1<<0)/* printk() a message using the format */ +#define _DPRINTK_FLAGS_PRINT (1<<0)/* printk() a message */ +#define _DPRINTK_FLAGS_PRINT_TRACE (1<<5)/* call (*tracer) */ + +#define _DPRINTK_ENABLED (_DPRINTK_FLAGS_PRINT | _DPRINTK_FLAGS_PRINT_TRACE) +#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
@@ -277,4 +282,9 @@ extern const struct kernel_param_ops param_ops_dyndbg;#define _DD_cat_help_ (pfx)#endif +int dynamic_debug_register_tracer (const char *query,const char *mod, +int (*tracer)(const char *fmt,char *prefix,char *label,struct va_format *vaf)); +int dynamic_debug_unregister_tracer (const char *query,const char *mod, +int (*cookie)(const char *fmt,char *prefix,char *label,struct va_format *vaf)); +#endif
lib/Kconfig.debug +11 -0
@@ -2486,6 +2486,17 @@ config TEST_STATIC_KEYS If unsure, say N. +config TEST_DYNAMIC_DEBUG + tristate "Test DYNAMIC_DEBUG" + depends on m + depends on DYNAMIC_DEBUG + help + This module registers a tracer callback to count enabled + pr_debugs in a 'do_debugging' function, then alters their + enablements, calls the function, and compares counts. + + If unsure, say N. + config TEST_KMOD tristate "kmod stress tester" depends on m
lib/Makefile +1 -0
@@ -82,6 +82,7 @@ obj-$(CONFIG_TEST_SORT) += test_sort.o obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o +obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
lib/dynamic_debug.c +116 -29
245 lines not on this page · raw message
lib/test_dynamic_debug.c new file +279 -0
279 lines not on this page · raw message
Signature · 1 line
2.31.1
kernel test robot
build botRe: [PATCH v6 10/11] dyndbg: RFC add debug-trace callback, selftest with it. RFC
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Jim,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on linus/master v5.14-rc7 next-20210820] [cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jim-Cromie/use-DYNAMIC_DEBUG-to-implement-DRM-debug/20210823-062136 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: m68k-randconfig-r025-20210822 (attached as .config) compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4d886cec521fe5747753921aab07fa15dad79b3c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jim-Cromie/use-DYNAMIC_DEBUG-to-implement-DRM-debug/20210823-062136 git checkout 4d886cec521fe5747753921aab07fa15dad79b3c
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
lib/dynamic_debug.c: In function 'ddebug_exec_queries':
>> lib/dynamic_debug.c:593:9: error: 'query' undeclared (first use in this function); did you mean 'query_in'?
593 | query = kstrndup(query_in, PAGE_SIZE, GFP_KERNEL);
| ^~~~~
| query_in
lib/dynamic_debug.c:593:9: note: each undeclared identifier is reported only once for each function it appears in
lib/dynamic_debug.c: In function 'dynamic_debug_exec_queries':
>> lib/dynamic_debug.c:613:36: error: 'qry' undeclared (first use in this function); did you mean 'query'?
613 | return ddebug_exec_queries(qry, modname, NULL);
| ^~~
| query
lib/dynamic_debug.c: In function 'ddebug_exec_queries':
>> lib/dynamic_debug.c:611:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
611 | int dynamic_debug_exec_queries(const char *query, const char *modname)
| ^~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> lib/dynamic_debug.c:615:19: error: non-static declaration of 'dynamic_debug_exec_queries' follows static declaration
615 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:164:41: note: in expansion of macro '_EXPORT_SYMBOL'
164 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:615:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
615 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:611:5: note: previous definition of 'dynamic_debug_exec_queries' with type 'int(const char *, const char *)'
611 | int dynamic_debug_exec_queries(const char *query, const char *modname)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:164:41: note: in expansion of macro '_EXPORT_SYMBOL'
164 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:615:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
615 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
| ^~~~~~~~~~~~~~~~~
>> lib/dynamic_debug.c:659:15: error: non-static declaration of 'param_set_dyndbg' follows static declaration
659 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:659:1: note: in expansion of macro 'EXPORT_SYMBOL'
659 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:629:5: note: previous definition of 'param_set_dyndbg' with type 'int(const char *, const struct kernel_param *)'
629 | int param_set_dyndbg(const char *instr, const struct kernel_param *kp)
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:659:1: note: in expansion of macro 'EXPORT_SYMBOL'
659 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:673:15: error: non-static declaration of 'param_get_dyndbg' follows static declaration
673 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:673:1: note: in expansion of macro 'EXPORT_SYMBOL'
673 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:668:5: note: previous definition of 'param_get_dyndbg' with type 'int(char *, const struct kernel_param *)'
668 | int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:673:1: note: in expansion of macro 'EXPORT_SYMBOL'
673 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:680:15: error: extern declaration of 'param_ops_dyndbg' follows declaration with no linkage
680 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:680:1: note: in expansion of macro 'EXPORT_SYMBOL'
680 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:675:31: note: previous definition of 'param_ops_dyndbg' with type 'const struct kernel_param_ops'
675 | const struct kernel_param_ops param_ops_dyndbg = {
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:680:1: note: in expansion of macro 'EXPORT_SYMBOL'
680 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:684:12: error: invalid storage class for function 'remaining'
684 | static int remaining(int wrote)
| ^~~~~~~~~
>> lib/dynamic_debug.c:691:14: error: invalid storage class for function '__dynamic_emit_prefix'
691 | static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
| ^~~~~~~~~~~~~~~~~~~~~
>> lib/dynamic_debug.c:721:21: error: invalid storage class for function 'dynamic_emit_prefix'
721 | static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> lib/dynamic_debug.c:758:15: error: non-static declaration of '__dynamic_pr_debug' follows static declaration
758 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:758:1: note: in expansion of macro 'EXPORT_SYMBOL'
758 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:728:6: note: previous definition of '__dynamic_pr_debug' with type 'void(struct _ddebug *, const char *, ...)'
728 | void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:758:1: note: in expansion of macro 'EXPORT_SYMBOL'
758 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:787:15: error: non-static declaration of '__dynamic_dev_dbg' follows static declaration
787 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:787:1: note: in expansion of macro 'EXPORT_SYMBOL'
787 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:760:6: note: previous definition of '__dynamic_dev_dbg' with type 'void(struct _ddebug *, const struct device *, const char *, ...)'
760 | void __dynamic_dev_dbg(struct _ddebug *descriptor,
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:787:1: note: in expansion of macro 'EXPORT_SYMBOL'
787 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:866:19: error: invalid storage class for function 'ddebug_setup_query'
866 | static __init int ddebug_setup_query(char *str)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
>> lib/dynamic_debug.c:876:26: error: initializer element is not constant
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:321:46: note: in definition of macro '__setup_param'
321 | = { __setup_str_##unique_id, fn, early }
| ^~
lib/dynamic_debug.c:876:1: note: in expansion of macro '__setup'
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~
lib/dynamic_debug.c:876:26: note: (near initialization for '__setup_ddebug_setup_query.setup_func')
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:321:46: note: in definition of macro '__setup_param'
321 | = { __setup_str_##unique_id, fn, early }
| ^~
lib/dynamic_debug.c:876:1: note: in expansion of macro '__setup'
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~
lib/dynamic_debug.c:883:16: error: invalid storage class for function 'ddebug_proc_write'
883 | static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:914:24: error: invalid storage class for function 'ddebug_iter_first'
914 | static struct _ddebug *ddebug_iter_first(struct ddebug_iter *iter)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:933:24: error: invalid storage class for function 'ddebug_iter_next'
933 | static struct _ddebug *ddebug_iter_next(struct ddebug_iter *iter)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:955:14: error: invalid storage class for function 'ddebug_proc_start'
955 | static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:978:14: error: invalid storage class for function 'ddebug_proc_next'
978 | static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:997:12: error: invalid storage class for function 'ddebug_proc_show'
997 | static int ddebug_proc_show(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1023:13: error: invalid storage class for function 'ddebug_proc_stop'
1023 | static void ddebug_proc_stop(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1029:18: error: initializer element is not constant
1029 | .start = ddebug_proc_start,
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1029:18: note: (near initialization for 'ddebug_proc_seqops.start')
lib/dynamic_debug.c:1030:17: error: initializer element is not constant
1030 | .next = ddebug_proc_next,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1030:17: note: (near initialization for 'ddebug_proc_seqops.next')
lib/dynamic_debug.c:1031:17: error: initializer element is not constant
1031 | .show = ddebug_proc_show,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1031:17: note: (near initialization for 'ddebug_proc_seqops.show')
lib/dynamic_debug.c:1032:17: error: initializer element is not constant
1032 | .stop = ddebug_proc_stop
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1032:17: note: (near initialization for 'ddebug_proc_seqops.stop')
lib/dynamic_debug.c:1035:12: error: invalid storage class for function 'ddebug_proc_open'
1035 | static int ddebug_proc_open(struct inode *inode, struct file *file)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1043:17: error: initializer element is not constant
1043 | .open = ddebug_proc_open,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1043:17: note: (near initialization for 'ddebug_proc_fops.open')
lib/dynamic_debug.c:1047:18: error: initializer element is not constant
1047 | .write = ddebug_proc_write
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1047:18: note: (near initialization for 'ddebug_proc_fops.write')
lib/dynamic_debug.c:1051:22: error: initializer element is not constant
1051 | .proc_open = ddebug_proc_open,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1051:22: note: (near initialization for 'proc_fops.proc_open')
lib/dynamic_debug.c:1055:23: error: initializer element is not constant
1055 | .proc_write = ddebug_proc_write
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1055:23: note: (near initialization for 'proc_fops.proc_write')
lib/dynamic_debug.c:1091:12: error: invalid storage class for function 'ddebug_dyndbg_param_cb'
1091 | static int ddebug_dyndbg_param_cb(char *param, char *val,
| ^~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1112:12: error: invalid storage class for function 'ddebug_dyndbg_boot_param_cb'
1112 | static int ddebug_dyndbg_boot_param_cb(char *param, char *val,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1130:13: error: invalid storage class for function 'ddebug_table_free'
1130 | static void ddebug_table_free(struct ddebug_table *dt)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1159:13: error: invalid storage class for function 'ddebug_remove_all_tables'
1159 | static void ddebug_remove_all_tables(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1173:19: error: invalid storage class for function 'dynamic_debug_init_control'
1173 | static int __init dynamic_debug_init_control(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1196:19: error: invalid storage class for function 'dynamic_debug_init'
1196 | static int __init dynamic_debug_init(void)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c:1267:16: error: initializer element is not constant
1267 | early_initcall(dynamic_debug_init);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:250:55: note: in definition of macro '____define_initcall'
250 | __attribute__((__section__(__sec))) = fn;
| ^~vim +593 lib/dynamic_debug.c
584
585 static int ddebug_exec_queries(const char *query_in, const char *modname, void *tracer)
586 {
587 int rc;
588
589 if (!query_in) {
590 pr_err("non-null query/command string expected\n");
591 return -EINVAL;
592 }
> 593 query = kstrndup(query_in, PAGE_SIZE, GFP_KERNEL);
594 if (!query)
595 return -ENOMEM;
596
597 rc = __ddebug_exec_queries(query, modname, tracer);
598 kfree(query);
599 return rc;
600
601 /**
602 * dynamic_debug_exec_queries - select and change dynamic-debug prints
603 * @query: query-string described in admin-guide/dynamic-debug-howto
604 * @modname: string containing module name, usually &module.mod_name
605 *
606 * This uses the >/proc/dynamic_debug/control reader, allowing module
607 * authors to modify their dynamic-debug callsites. The modname is
608 * canonically struct module.name, but can also be null or a
609 * module-wildcard, for example: "drm*".
610 */
> 611 int dynamic_debug_exec_queries(const char *query, const char *modname)
612 {
> 613 return ddebug_exec_queries(qry, modname, NULL);
614 }
> 615 EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
616
617 #ifdef MODULES
618 #define KP_MOD_NAME kp->mod->name
619 #else
620 #define KP_MOD_NAME NULL /* wildcard */
621 #endif
622 #define FMT_QUERY_SIZE 128 /* typically need <40 */
623 /**
624 * param_set_dyndbg() - drm.debug style bits=>categories setter
625 * @instr: string echo>d to sysfs
626 * @kp: struct kernel_param* ->data has bitmap
627 * Exported to support DEFINE_DYNAMIC_DEBUG_CATEGORIES
628 */
629 int param_set_dyndbg(const char *instr, const struct kernel_param *kp)
630 {
631 unsigned long inbits;
632 int rc, i, matches = 0, totct = 0;
633 char query[FMT_QUERY_SIZE];
634 const struct dyndbg_bitdesc *bitmap = kp->data;
635
636 if (!bitmap) {
637 pr_err("set_dyndbg: no bits=>queries map\n");
638 return -EINVAL;
639 }
640 rc = kstrtoul(instr, 0, &inbits);
641 if (rc) {
642 pr_err("set_dyndbg: bad input: %s\n", instr);
643 return rc;
644 }
645 vpr_info("set_dyndbg: input 0x%lx\n", inbits);
646
647 for (i = 0; bitmap->prefix; i++, bitmap++) {
648 snprintf(query, FMT_QUERY_SIZE, "format '^%s' %cp", bitmap->prefix,
649 test_bit(i, &inbits) ? '+' : '-');
650
651 matches = __ddebug_exec_queries(query, KP_MOD_NAME, NULL);
652
653 v2pr_info("bit-%d: %d matches on '%s'\n", i, matches, query);
654 totct += matches;
655 }
656 vpr_info("total matches: %d\n", totct);
657 return 0;
658 }
> 659 EXPORT_SYMBOL(param_set_dyndbg);
660
661 /**
662 * param_get_dyndbg() - drm.debug style bitmap to format-prefix categories
663 * @buffer: string returned to user via sysfs
664 * @kp: struct kernel_param*
665 * Exported to provide required .get interface, not useful.
666 * pr_debugs may be altered after .set via `echo $foo >control`
667 */
668 int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
669 {
670 return scnprintf(buffer, PAGE_SIZE, "%u\n",
671 *((unsigned int *)kp->arg));
672 }
> 673 EXPORT_SYMBOL(param_get_dyndbg);
674
675 const struct kernel_param_ops param_ops_dyndbg = {
676 .set = param_set_dyndbg,
677 .get = param_get_dyndbg,
678 };
679 /* support DEFINE_DYNAMIC_DEBUG_CATEGORIES users */
> 680 EXPORT_SYMBOL(param_ops_dyndbg);
681
682 #define PREFIX_SIZE 64
683
> 684 static int remaining(int wrote)
685 {
686 if (PREFIX_SIZE - wrote > 0)
687 return PREFIX_SIZE - wrote;
688 return 0;
689 }
690
> 691 static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
692 {
693 int pos_after_tid;
694 int pos = 0;
695
696 if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
697 if (in_interrupt())
698 pos += snprintf(buf + pos, remaining(pos), "<intr> ");
699 else
700 pos += snprintf(buf + pos, remaining(pos), "[%d] ",
701 task_pid_vnr(current));
702 }
703 pos_after_tid = pos;
704 if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME)
705 pos += snprintf(buf + pos, remaining(pos), "%s:",
706 desc->modname);
707 if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
708 pos += snprintf(buf + pos, remaining(pos), "%s:",
709 desc->function);
710 if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
711 pos += snprintf(buf + pos, remaining(pos), "%d:",
712 desc->lineno);
713 if (pos - pos_after_tid)
714 pos += snprintf(buf + pos, remaining(pos), " ");
715 if (pos >= PREFIX_SIZE)
716 buf[PREFIX_SIZE - 1] = '\0';
717
718 return buf;
719 }
720
> 721 static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
722 {
723 if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY))
724 return __dynamic_emit_prefix(desc, buf);
725 return buf;
726 }
727
728 void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
729 {
730 va_list args;
731 struct va_format vaf;
732 char buf[PREFIX_SIZE] = "";
733
734 BUG_ON(!descriptor);
735 BUG_ON(!fmt);
736
737 va_start(args, fmt);
738
739 vaf.fmt = fmt;
740 vaf.va = &args;
741
742 if (descriptor->flags & _DPRINTK_ENABLED)
743 dynamic_emit_prefix(descriptor, buf);
744
745 if (descriptor->flags & _DPRINTK_FLAGS_PRINT)
746 printk(KERN_DEBUG "%s%pV", buf, &vaf);
747
748 if (descriptor->flags & _DPRINTK_FLAGS_PRINT_TRACE) {
749
750 if (descriptor->tracer) {
751 (*descriptor->tracer)("%s:%ps %pV", buf,
752 __builtin_return_address(0), &vaf);
753 }
754 /* else shouldn't matter, but maybe for consistency */
755 }
756 va_end(args);
757 }
> 758 EXPORT_SYMBOL(__dynamic_pr_debug);
759
760 void __dynamic_dev_dbg(struct _ddebug *descriptor,
761 const struct device *dev, const char *fmt, ...)
762 {
763 struct va_format vaf;
764 va_list args;
765
766 BUG_ON(!descriptor);
767 BUG_ON(!fmt);
768
769 va_start(args, fmt);
770
771 vaf.fmt = fmt;
772 vaf.va = &args;
773
774 if (!dev) {
775 printk(KERN_DEBUG "(NULL device *): %pV", &vaf);
776 } else {
777 char buf[PREFIX_SIZE] = "";
778
779 dev_printk_emit(LOGLEVEL_DEBUG, dev, "%s%s %s: %pV",
780 dynamic_emit_prefix(descriptor, buf),
781 dev_driver_string(dev), dev_name(dev),
782 &vaf);
783 }
784
785 va_end(args);
786 }
> 787 EXPORT_SYMBOL(__dynamic_dev_dbg);788
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v6 10/11] dyndbg: RFC add debug-trace callback, selftest with it. RFC
In reply to Jim Cromie[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Jim,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on linus/master v5.14-rc7 next-20210820] [cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jim-Cromie/use-DYNAMIC_DEBUG-to-implement-DRM-debug/20210823-062136 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: powerpc64-buildonly-randconfig-r002-20210822 (attached as .config) compiler: powerpc64le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4d886cec521fe5747753921aab07fa15dad79b3c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jim-Cromie/use-DYNAMIC_DEBUG-to-implement-DRM-debug/20210823-062136 git checkout 4d886cec521fe5747753921aab07fa15dad79b3c
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
lib/dynamic_debug.c: In function 'ddebug_exec_queries':
>> lib/dynamic_debug.c:593:9: error: 'query' undeclared (first use in this function); did you mean 'query_in'?
593 | query = kstrndup(query_in, PAGE_SIZE, GFP_KERNEL);
| ^~~~~
| query_in
lib/dynamic_debug.c:593:9: note: each undeclared identifier is reported only once for each function it appears in
lib/dynamic_debug.c: In function 'dynamic_debug_exec_queries':
>> lib/dynamic_debug.c:613:36: error: 'qry' undeclared (first use in this function); did you mean 'query'?
613 | return ddebug_exec_queries(qry, modname, NULL);
| ^~~
| query
lib/dynamic_debug.c: In function 'ddebug_exec_queries':
>> lib/dynamic_debug.c:611:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
611 | int dynamic_debug_exec_queries(const char *query, const char *modname)
| ^~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> lib/dynamic_debug.c:615:19: error: non-static declaration of 'dynamic_debug_exec_queries' follows static declaration
615 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:164:41: note: in expansion of macro '_EXPORT_SYMBOL'
164 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:615:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
615 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:611:5: note: previous definition of 'dynamic_debug_exec_queries' with type 'int(const char *, const char *)'
611 | int dynamic_debug_exec_queries(const char *query, const char *modname)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:164:41: note: in expansion of macro '_EXPORT_SYMBOL'
164 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:615:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
615 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
| ^~~~~~~~~~~~~~~~~
>> lib/dynamic_debug.c:659:15: error: non-static declaration of 'param_set_dyndbg' follows static declaration
659 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:659:1: note: in expansion of macro 'EXPORT_SYMBOL'
659 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:629:5: note: previous definition of 'param_set_dyndbg' with type 'int(const char *, const struct kernel_param *)'
629 | int param_set_dyndbg(const char *instr, const struct kernel_param *kp)
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:659:1: note: in expansion of macro 'EXPORT_SYMBOL'
659 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:673:15: error: non-static declaration of 'param_get_dyndbg' follows static declaration
673 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:673:1: note: in expansion of macro 'EXPORT_SYMBOL'
673 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:668:5: note: previous definition of 'param_get_dyndbg' with type 'int(char *, const struct kernel_param *)'
668 | int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:673:1: note: in expansion of macro 'EXPORT_SYMBOL'
673 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:680:15: error: extern declaration of 'param_ops_dyndbg' follows declaration with no linkage
680 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:680:1: note: in expansion of macro 'EXPORT_SYMBOL'
680 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:675:31: note: previous definition of 'param_ops_dyndbg' with type 'const struct kernel_param_ops'
675 | const struct kernel_param_ops param_ops_dyndbg = {
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:680:1: note: in expansion of macro 'EXPORT_SYMBOL'
680 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:684:12: error: invalid storage class for function 'remaining'
684 | static int remaining(int wrote)
| ^~~~~~~~~
>> lib/dynamic_debug.c:691:14: error: invalid storage class for function '__dynamic_emit_prefix'
691 | static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
| ^~~~~~~~~~~~~~~~~~~~~
>> lib/dynamic_debug.c:721:21: error: invalid storage class for function 'dynamic_emit_prefix'
721 | static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> lib/dynamic_debug.c:758:15: error: non-static declaration of '__dynamic_pr_debug' follows static declaration
758 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:758:1: note: in expansion of macro 'EXPORT_SYMBOL'
758 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:728:6: note: previous definition of '__dynamic_pr_debug' with type 'void(struct _ddebug *, const char *, ...)'
728 | void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:758:1: note: in expansion of macro 'EXPORT_SYMBOL'
758 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:787:15: error: non-static declaration of '__dynamic_dev_dbg' follows static declaration
787 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:787:1: note: in expansion of macro 'EXPORT_SYMBOL'
787 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:760:6: note: previous definition of '__dynamic_dev_dbg' with type 'void(struct _ddebug *, const struct device *, const char *, ...)'
760 | void __dynamic_dev_dbg(struct _ddebug *descriptor,
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
>> include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:787:1: note: in expansion of macro 'EXPORT_SYMBOL'
787 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:866:19: error: invalid storage class for function 'ddebug_setup_query'
866 | static __init int ddebug_setup_query(char *str)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
>> lib/dynamic_debug.c:876:26: error: initializer element is not constant
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:321:46: note: in definition of macro '__setup_param'
321 | = { __setup_str_##unique_id, fn, early }
| ^~
lib/dynamic_debug.c:876:1: note: in expansion of macro '__setup'
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~
lib/dynamic_debug.c:876:26: note: (near initialization for '__setup_ddebug_setup_query.setup_func')
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:321:46: note: in definition of macro '__setup_param'
321 | = { __setup_str_##unique_id, fn, early }
| ^~
lib/dynamic_debug.c:876:1: note: in expansion of macro '__setup'
876 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~
lib/dynamic_debug.c:883:16: error: invalid storage class for function 'ddebug_proc_write'
883 | static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:914:24: error: invalid storage class for function 'ddebug_iter_first'
914 | static struct _ddebug *ddebug_iter_first(struct ddebug_iter *iter)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:933:24: error: invalid storage class for function 'ddebug_iter_next'
933 | static struct _ddebug *ddebug_iter_next(struct ddebug_iter *iter)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:955:14: error: invalid storage class for function 'ddebug_proc_start'
955 | static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:978:14: error: invalid storage class for function 'ddebug_proc_next'
978 | static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:997:12: error: invalid storage class for function 'ddebug_proc_show'
997 | static int ddebug_proc_show(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1023:13: error: invalid storage class for function 'ddebug_proc_stop'
1023 | static void ddebug_proc_stop(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1029:18: error: initializer element is not constant
1029 | .start = ddebug_proc_start,
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1029:18: note: (near initialization for 'ddebug_proc_seqops.start')
lib/dynamic_debug.c:1030:17: error: initializer element is not constant
1030 | .next = ddebug_proc_next,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1030:17: note: (near initialization for 'ddebug_proc_seqops.next')
lib/dynamic_debug.c:1031:17: error: initializer element is not constant
1031 | .show = ddebug_proc_show,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1031:17: note: (near initialization for 'ddebug_proc_seqops.show')
lib/dynamic_debug.c:1032:17: error: initializer element is not constant
1032 | .stop = ddebug_proc_stop
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1032:17: note: (near initialization for 'ddebug_proc_seqops.stop')
lib/dynamic_debug.c:1035:12: error: invalid storage class for function 'ddebug_proc_open'
1035 | static int ddebug_proc_open(struct inode *inode, struct file *file)
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1043:17: error: initializer element is not constant
1043 | .open = ddebug_proc_open,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1043:17: note: (near initialization for 'ddebug_proc_fops.open')
lib/dynamic_debug.c:1047:18: error: initializer element is not constant
1047 | .write = ddebug_proc_write
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1047:18: note: (near initialization for 'ddebug_proc_fops.write')
lib/dynamic_debug.c:1051:22: error: initializer element is not constant
1051 | .proc_open = ddebug_proc_open,
| ^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1051:22: note: (near initialization for 'proc_fops.proc_open')
lib/dynamic_debug.c:1055:23: error: initializer element is not constant
1055 | .proc_write = ddebug_proc_write
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1055:23: note: (near initialization for 'proc_fops.proc_write')
lib/dynamic_debug.c:1091:12: error: invalid storage class for function 'ddebug_dyndbg_param_cb'
1091 | static int ddebug_dyndbg_param_cb(char *param, char *val,
| ^~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1112:12: error: invalid storage class for function 'ddebug_dyndbg_boot_param_cb'
1112 | static int ddebug_dyndbg_boot_param_cb(char *param, char *val,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1130:13: error: invalid storage class for function 'ddebug_table_free'
1130 | static void ddebug_table_free(struct ddebug_table *dt)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1159:13: error: invalid storage class for function 'ddebug_remove_all_tables'
1159 | static void ddebug_remove_all_tables(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1173:19: error: invalid storage class for function 'dynamic_debug_init_control'
1173 | static int __init dynamic_debug_init_control(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1196:19: error: invalid storage class for function 'dynamic_debug_init'
1196 | static int __init dynamic_debug_init(void)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c:1267:16: error: initializer element is not constant
1267 | early_initcall(dynamic_debug_init);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:250:55: note: in definition of macro '____define_initcall'
250 | __attribute__((__section__(__sec))) = fn;
| ^~vim +593 lib/dynamic_debug.c
584
585 static int ddebug_exec_queries(const char *query_in, const char *modname, void *tracer)
586 {
587 int rc;
588
589 if (!query_in) {
590 pr_err("non-null query/command string expected\n");
591 return -EINVAL;
592 }
> 593 query = kstrndup(query_in, PAGE_SIZE, GFP_KERNEL);
594 if (!query)
595 return -ENOMEM;
596
597 rc = __ddebug_exec_queries(query, modname, tracer);
598 kfree(query);
599 return rc;
600
601 /**
602 * dynamic_debug_exec_queries - select and change dynamic-debug prints
603 * @query: query-string described in admin-guide/dynamic-debug-howto
604 * @modname: string containing module name, usually &module.mod_name
605 *
606 * This uses the >/proc/dynamic_debug/control reader, allowing module
607 * authors to modify their dynamic-debug callsites. The modname is
608 * canonically struct module.name, but can also be null or a
609 * module-wildcard, for example: "drm*".
610 */
> 611 int dynamic_debug_exec_queries(const char *query, const char *modname)
612 {
> 613 return ddebug_exec_queries(qry, modname, NULL);
614 }
> 615 EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
616
617 #ifdef MODULES
618 #define KP_MOD_NAME kp->mod->name
619 #else
620 #define KP_MOD_NAME NULL /* wildcard */
621 #endif
622 #define FMT_QUERY_SIZE 128 /* typically need <40 */
623 /**
624 * param_set_dyndbg() - drm.debug style bits=>categories setter
625 * @instr: string echo>d to sysfs
626 * @kp: struct kernel_param* ->data has bitmap
627 * Exported to support DEFINE_DYNAMIC_DEBUG_CATEGORIES
628 */
629 int param_set_dyndbg(const char *instr, const struct kernel_param *kp)
630 {
631 unsigned long inbits;
632 int rc, i, matches = 0, totct = 0;
633 char query[FMT_QUERY_SIZE];
634 const struct dyndbg_bitdesc *bitmap = kp->data;
635
636 if (!bitmap) {
637 pr_err("set_dyndbg: no bits=>queries map\n");
638 return -EINVAL;
639 }
640 rc = kstrtoul(instr, 0, &inbits);
641 if (rc) {
642 pr_err("set_dyndbg: bad input: %s\n", instr);
643 return rc;
644 }
645 vpr_info("set_dyndbg: input 0x%lx\n", inbits);
646
647 for (i = 0; bitmap->prefix; i++, bitmap++) {
648 snprintf(query, FMT_QUERY_SIZE, "format '^%s' %cp", bitmap->prefix,
649 test_bit(i, &inbits) ? '+' : '-');
650
651 matches = __ddebug_exec_queries(query, KP_MOD_NAME, NULL);
652
653 v2pr_info("bit-%d: %d matches on '%s'\n", i, matches, query);
654 totct += matches;
655 }
656 vpr_info("total matches: %d\n", totct);
657 return 0;
658 }
> 659 EXPORT_SYMBOL(param_set_dyndbg);
660
661 /**
662 * param_get_dyndbg() - drm.debug style bitmap to format-prefix categories
663 * @buffer: string returned to user via sysfs
664 * @kp: struct kernel_param*
665 * Exported to provide required .get interface, not useful.
666 * pr_debugs may be altered after .set via `echo $foo >control`
667 */
668 int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
669 {
670 return scnprintf(buffer, PAGE_SIZE, "%u\n",
671 *((unsigned int *)kp->arg));
672 }
> 673 EXPORT_SYMBOL(param_get_dyndbg);
674
675 const struct kernel_param_ops param_ops_dyndbg = {
676 .set = param_set_dyndbg,
677 .get = param_get_dyndbg,
678 };
679 /* support DEFINE_DYNAMIC_DEBUG_CATEGORIES users */
> 680 EXPORT_SYMBOL(param_ops_dyndbg);
681
682 #define PREFIX_SIZE 64
683
> 684 static int remaining(int wrote)
685 {
686 if (PREFIX_SIZE - wrote > 0)
687 return PREFIX_SIZE - wrote;
688 return 0;
689 }
690
> 691 static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
692 {
693 int pos_after_tid;
694 int pos = 0;
695
696 if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
697 if (in_interrupt())
698 pos += snprintf(buf + pos, remaining(pos), "<intr> ");
699 else
700 pos += snprintf(buf + pos, remaining(pos), "[%d] ",
701 task_pid_vnr(current));
702 }
703 pos_after_tid = pos;
704 if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME)
705 pos += snprintf(buf + pos, remaining(pos), "%s:",
706 desc->modname);
707 if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
708 pos += snprintf(buf + pos, remaining(pos), "%s:",
709 desc->function);
710 if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
711 pos += snprintf(buf + pos, remaining(pos), "%d:",
712 desc->lineno);
713 if (pos - pos_after_tid)
714 pos += snprintf(buf + pos, remaining(pos), " ");
715 if (pos >= PREFIX_SIZE)
716 buf[PREFIX_SIZE - 1] = '\0';
717
718 return buf;
719 }
720
> 721 static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
722 {
723 if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY))
724 return __dynamic_emit_prefix(desc, buf);
725 return buf;
726 }
727
728 void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
729 {
730 va_list args;
731 struct va_format vaf;
732 char buf[PREFIX_SIZE] = "";
733
734 BUG_ON(!descriptor);
735 BUG_ON(!fmt);
736
737 va_start(args, fmt);
738
739 vaf.fmt = fmt;
740 vaf.va = &args;
741
742 if (descriptor->flags & _DPRINTK_ENABLED)
743 dynamic_emit_prefix(descriptor, buf);
744
745 if (descriptor->flags & _DPRINTK_FLAGS_PRINT)
746 printk(KERN_DEBUG "%s%pV", buf, &vaf);
747
748 if (descriptor->flags & _DPRINTK_FLAGS_PRINT_TRACE) {
749
750 if (descriptor->tracer) {
751 (*descriptor->tracer)("%s:%ps %pV", buf,
752 __builtin_return_address(0), &vaf);
753 }
754 /* else shouldn't matter, but maybe for consistency */
755 }
756 va_end(args);
757 }
> 758 EXPORT_SYMBOL(__dynamic_pr_debug);
759
760 void __dynamic_dev_dbg(struct _ddebug *descriptor,
761 const struct device *dev, const char *fmt, ...)
762 {
763 struct va_format vaf;
764 va_list args;
765
766 BUG_ON(!descriptor);
767 BUG_ON(!fmt);
768
769 va_start(args, fmt);
770
771 vaf.fmt = fmt;
772 vaf.va = &args;
773
774 if (!dev) {
775 printk(KERN_DEBUG "(NULL device *): %pV", &vaf);
776 } else {
777 char buf[PREFIX_SIZE] = "";
778
779 dev_printk_emit(LOGLEVEL_DEBUG, dev, "%s%s %s: %pV",
780 dynamic_emit_prefix(descriptor, buf),
781 dev_driver_string(dev), dev_name(dev),
782 &vaf);
783 }
784
785 va_end(args);
786 }
> 787 EXPORT_SYMBOL(__dynamic_dev_dbg);788
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Jim Cromie
maintainerPATCH v6 11/11 dyndbg: RFC add print-once and print-ratelimited features. RFC.
In reply to Jim CromieIts tautological that having pr_debug()s with optional print-once and rate-limiting features could be useful. Build it, they will come.
The advantages:
- dynamically configured with flags
- can use them on existing callsites
- printonce is easy, (almost) just new flags
no additional resources
- ratelimiting is pooled, expecting rare use provisioned only for enabled & ratelimited callsites
- RFC ratelimit grouping
mostly to reduce resources
reduces to choice of hash key: module, function, file, line
Whats done here:
Expand ddebug.flags to 11 bits, and define new flags to support print-once and ratelimited semantics:
echo file init/main.c +o > control # init/main runs just once anyway
echo module foo +r > control # turn on ratelimiting
echo module foo +g > control # turn on group flag
is_onced_or_ratelimited() tests these conditions, it is called from __dynamic_pr_debug() and others (which are all behind the '+p' enablement test).
NB: test_dynamic_debug.ko ratelimiting test triggers reports on is_onced_or_ratelimited() as the limited source.
PRINT-ONCE: can be done with just +2 bits in flags;
.o _DPRINTK_FLAGS_ONCE enables state test and set
.P _DPRINTK_FLAGS_PRINTED state bit
Just adding the flags lets the existing code operate on them. We will need new code to enforce constraints on flag combos; '+ro' is nonsense, but this can wait, or can take a new meaning.
RATE-LIMITING:
.r _DPRINTK_FLAGS_RATELIMITED - track & limit prdbgs callrate
We wait until a prdebug is called, and if RATELIMITED is set, THEN lookup a RateLimitState (RL) for it. If found, bump its state and return true/false, otherwise create & initialize one and return false.
RFC: GROUP-FLAG:
.g _DPRINTK_FLAGS_GROUPED
Currently, the hash-key is just the prdebug descriptor, so is unique per prdebug. With the 'g' flag, we could use a different key, for example desc->site.function, to get a shared ratelimit for whole functions.
This gets subtly different behavior at the ratelimit transition, but it is predictable for a given function (except perhaps recursive, but thats not done anyway).
Note also that any function can have a single group of prdebugs, plus any number of prdbgs without 'g', either with or without 'r'. So grouping should be flexible enough to use advantageously.
---
v6: new to patchset
--- include/linux/dynamic_debug.h | 19 ++++-- lib/dynamic_debug.c | 125 +++++++++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 7 deletions(-)
include/linux/dynamic_debug.h +13 -6
@@ -28,26 +28,33 @@ struct _ddebug {* writes commands to <debugfs>/dynamic_debug/control */ #define _DPRINTK_FLAGS_NONE 0 -#define _DPRINTK_FLAGS_PRINT (1<<0)/* printk() a message */ +#define _DPRINTK_FLAGS_PRINT (1<<4)/* printk() a message */ #define _DPRINTK_FLAGS_PRINT_TRACE (1<<5)/* call (*tracer) */ #define _DPRINTK_ENABLED (_DPRINTK_FLAGS_PRINT | _DPRINTK_FLAGS_PRINT_TRACE) -#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) -#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) -#define _DPRINTK_FLAGS_INCL_LINENO (1<<3) -#define _DPRINTK_FLAGS_INCL_TID (1<<4) +#define _DPRINTK_FLAGS_INCL_MODNAME (1<<0) +#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<1) +#define _DPRINTK_FLAGS_INCL_LINENO (1<<2) +#define _DPRINTK_FLAGS_INCL_TID (1<<3)#define _DPRINTK_FLAGS_INCL_ANY \ (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID) +#define _DPRINTK_FLAGS_ONCE (1<<6)/* print once flag */ +#define _DPRINTK_FLAGS_PRINTED (1<<7)/* print once state */ +#define _DPRINTK_FLAGS_RATELIMITED (1<<8) +#define _DPRINTK_FLAGS_GROUPED (1<<9)/* manipulate as a group */ +#define _DPRINTK_FLAGS_DELETE_SITE (1<<10)/* drop site info to save ram */ +#if definedDEBUG #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT#else #define _DPRINTK_FLAGS_DEFAULT 0#endif - unsigned int flags:8; + unsigned int flags:11; + #ifdef CONFIG_JUMP_LABEL union { struct static_key_true dd_key_true;
lib/dynamic_debug.c +124 -1
176 lines not on this page · raw message
Signature · 1 line
2.31.1
kernel test robot
build botRe: [PATCH v6 11/11] dyndbg: RFC add print-once and print-ratelimited features. RFC.
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Jim,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on linus/master v5.14-rc7 next-20210820] [cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jim-Cromie/use-DYNAMIC_DEBUG-to-implement-DRM-debug/20210823-062136 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: m68k-randconfig-r025-20210822 (attached as .config) compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2380f9e06628103fcc3a6359d7f86634b3d30728
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jim-Cromie/use-DYNAMIC_DEBUG-to-implement-DRM-debug/20210823-062136 git checkout 2380f9e06628103fcc3a6359d7f86634b3d30728
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:667:1: note: in expansion of macro 'EXPORT_SYMBOL'
667 | EXPORT_SYMBOL(param_set_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:681:15: error: non-static declaration of 'param_get_dyndbg' follows static declaration
681 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:681:1: note: in expansion of macro 'EXPORT_SYMBOL'
681 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:676:5: note: previous definition of 'param_get_dyndbg' with type 'int(char *, const struct kernel_param *)'
676 | int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:681:1: note: in expansion of macro 'EXPORT_SYMBOL'
681 | EXPORT_SYMBOL(param_get_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:688:15: error: extern declaration of 'param_ops_dyndbg' follows declaration with no linkage
688 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:688:1: note: in expansion of macro 'EXPORT_SYMBOL'
688 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:683:31: note: previous definition of 'param_ops_dyndbg' with type 'const struct kernel_param_ops'
683 | const struct kernel_param_ops param_ops_dyndbg = {
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:688:1: note: in expansion of macro 'EXPORT_SYMBOL'
688 | EXPORT_SYMBOL(param_ops_dyndbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:692:12: error: invalid storage class for function 'remaining'
692 | static int remaining(int wrote)
| ^~~~~~~~~
lib/dynamic_debug.c:699:14: error: invalid storage class for function '__dynamic_emit_prefix'
699 | static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
| ^~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:729:21: error: invalid storage class for function 'dynamic_emit_prefix'
729 | static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
| ^~~~~~~~~~~~~~~~~~~
>> lib/dynamic_debug.c:749:33: error: invalid storage class for function 'ddebug_rl_fetch'
749 | static struct ddebug_ratelimit *ddebug_rl_fetch(struct _ddebug *desc);
| ^~~~~~~~~~~~~~~
>> lib/dynamic_debug.c:751:20: error: invalid storage class for function 'is_onced_or_limited'
751 | static inline bool is_onced_or_limited(struct _ddebug *desc)
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:10,
from include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c: In function 'is_onced_or_limited':
>> lib/dynamic_debug.c:767:43: error: implicit declaration of function 'ddebug_rl_fetch' [-Werror=implicit-function-declaration]
767 | bool state = __ratelimit(&ddebug_rl_fetch(desc)->rs);
| ^~~~~~~~~~~~~~~
include/linux/ratelimit_types.h:41:41: note: in definition of macro '__ratelimit'
41 | #define __ratelimit(state) ___ratelimit(state, __func__)
| ^~~~~
>> lib/dynamic_debug.c:767:64: error: invalid type argument of '->' (have 'int')
767 | bool state = __ratelimit(&ddebug_rl_fetch(desc)->rs);
| ^~
include/linux/ratelimit_types.h:41:41: note: in definition of macro '__ratelimit'
41 | #define __ratelimit(state) ___ratelimit(state, __func__)
| ^~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c: In function 'ddebug_exec_queries':
lib/dynamic_debug.c:812:15: error: non-static declaration of '__dynamic_pr_debug' follows static declaration
812 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:812:1: note: in expansion of macro 'EXPORT_SYMBOL'
812 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:779:6: note: previous definition of '__dynamic_pr_debug' with type 'void(struct _ddebug *, const char *, ...)'
779 | void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:812:1: note: in expansion of macro 'EXPORT_SYMBOL'
812 | EXPORT_SYMBOL(__dynamic_pr_debug);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:844:15: error: non-static declaration of '__dynamic_dev_dbg' follows static declaration
844 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:844:1: note: in expansion of macro 'EXPORT_SYMBOL'
844 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:814:6: note: previous definition of '__dynamic_dev_dbg' with type 'void(struct _ddebug *, const struct device *, const char *, ...)'
814 | void __dynamic_dev_dbg(struct _ddebug *descriptor,
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:844:1: note: in expansion of macro 'EXPORT_SYMBOL'
844 | EXPORT_SYMBOL(__dynamic_dev_dbg);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:929:19: error: invalid storage class for function 'ddebug_setup_query'
929 | static __init int ddebug_setup_query(char *str)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c:939:26: error: initializer element is not constant
939 | __setup("ddebug_query=", ddebug_setup_query);
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:321:46: note: in definition of macro '__setup_param'
321 | = { __setup_str_##unique_id, fn, early }
| ^~
lib/dynamic_debug.c:939:1: note: in expansion of macro '__setup'
--
| ^~~~~~
include/linux/init.h:254:9: note: in expansion of macro '____define_initcall'
254 | ____define_initcall(fn, \
| ^~~~~~~~~~~~~~~~~~~
include/linux/init.h:260:9: note: in expansion of macro '__unique_initcall'
260 | __unique_initcall(fn, id, __sec, __initcall_id(fn))
| ^~~~~~~~~~~~~~~~~
include/linux/init.h:262:35: note: in expansion of macro '___define_initcall'
262 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:288:41: note: in expansion of macro '__define_initcall'
288 | #define fs_initcall(fn) __define_initcall(fn, 5)
| ^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1333:1: note: in expansion of macro 'fs_initcall'
1333 | fs_initcall(dynamic_debug_init_control);
| ^~~~~~~~~~~
lib/dynamic_debug.c:1349:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
1349 | int dynamic_debug_register_tracer(const char *query, const char *modname,
| ^~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c:1354:15: error: non-static declaration of 'dynamic_debug_register_tracer' follows static declaration
1354 | EXPORT_SYMBOL(dynamic_debug_register_tracer);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:1354:1: note: in expansion of macro 'EXPORT_SYMBOL'
1354 | EXPORT_SYMBOL(dynamic_debug_register_tracer);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:1349:5: note: previous definition of 'dynamic_debug_register_tracer' with type 'int(const char *, const char *, int (*)(const char *, char *, char *, struct va_format *))'
1349 | int dynamic_debug_register_tracer(const char *query, const char *modname,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:1354:1: note: in expansion of macro 'EXPORT_SYMBOL'
1354 | EXPORT_SYMBOL(dynamic_debug_register_tracer);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:1372:15: error: non-static declaration of 'dynamic_debug_unregister_tracer' follows static declaration
1372 | EXPORT_SYMBOL(dynamic_debug_unregister_tracer);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:1372:1: note: in expansion of macro 'EXPORT_SYMBOL'
1372 | EXPORT_SYMBOL(dynamic_debug_unregister_tracer);
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:1367:5: note: previous definition of 'dynamic_debug_unregister_tracer' with type 'int(const char *, const char *, int (*)(const char *, char *, char *, struct va_format *))'
1367 | int dynamic_debug_unregister_tracer(const char *query, const char *modname,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:
include/linux/export.h:67:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:9: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:152:41: note: in expansion of macro '___EXPORT_SYMBOL'
152 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
lib/dynamic_debug.c:1372:1: note: in expansion of macro 'EXPORT_SYMBOL'
1372 | EXPORT_SYMBOL(dynamic_debug_unregister_tracer);
| ^~~~~~~~~~~~~
>> lib/dynamic_debug.c:1387:33: error: invalid storage class for function 'ddebug_rl_find'
1387 | static struct ddebug_ratelimit *ddebug_rl_find(u64 key)
| ^~~~~~~~~~~~~~
>> lib/dynamic_debug.c:1399:33: error: invalid storage class for function 'ddebug_rl_add'
1399 | static struct ddebug_ratelimit *ddebug_rl_add(u64 key)
| ^~~~~~~~~~~~~
lib/dynamic_debug.c:1422:33: error: invalid storage class for function 'ddebug_rl_fetch'
1422 | static struct ddebug_ratelimit *ddebug_rl_fetch(struct _ddebug *desc)
| ^~~~~~~~~~~~~~~
lib/dynamic_debug.c: In function 'ddebug_rl_fetch':
lib/dynamic_debug.c:1424:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
1424 | u64 key = (u64)desc;
| ^
lib/dynamic_debug.c: In function 'ddebug_exec_queries':
>> lib/dynamic_debug.c:1432:1: error: expected declaration or statement at end of input
1432 | }
| ^ At top level:
lib/dynamic_debug.c:1422:33: warning: 'ddebug_rl_fetch' defined but not used [-Wunused-function]
1422 | static struct ddebug_ratelimit *ddebug_rl_fetch(struct _ddebug *desc)
| ^~~~~~~~~~~~~~~
lib/dynamic_debug.c:1203:5: warning: 'ddebug_remove_module' defined but not used [-Wunused-function]
1203 | int ddebug_remove_module(const char *mod_name)
| ^~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1187:5: warning: 'ddebug_dyndbg_module_param_cb' defined but not used [-Wunused-function]
1187 | int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/ddebug_rl_fetch +749 lib/dynamic_debug.c
741
742 /* test print-once or ratelimited conditions */
743 #define is_rated(desc) unlikely(desc->flags & _DPRINTK_FLAGS_RATELIMITED)
744 #define is_once(desc) unlikely(desc->flags & _DPRINTK_FLAGS_ONCE)
745 #define is_onced(desc) \
746 unlikely((desc->flags & _DPRINTK_FLAGS_ONCE) \
747 && (desc->flags & _DPRINTK_FLAGS_PRINTED))
748
> 749 static struct ddebug_ratelimit *ddebug_rl_fetch(struct _ddebug *desc);
750
> 751 static inline bool is_onced_or_limited(struct _ddebug *desc)
752 {
753 if (unlikely(desc->flags & _DPRINTK_FLAGS_ONCE &&
754 desc->flags & _DPRINTK_FLAGS_RATELIMITED))
755 pr_info(" ONCE & RATELIMITED together is nonsense\n");
756
757 if (is_once(desc)) {
758 if (is_onced(desc)) {
759 v4pr_info("already printed once\n");
760 return true;
761 }
762 desc->flags |= _DPRINTK_FLAGS_PRINTED;
763 return false;
764
765 } else if (is_rated(desc)) {
766 /* test rate-limits */
> 767 bool state = __ratelimit(&ddebug_rl_fetch(desc)->rs); 768
769 v4pr_info("RLstate{%s}=%d on %s.%s.%d\n",
770 (desc->flags & _DPRINTK_FLAGS_GROUPED
771 ? "grouped" : "solo"), state,
772 desc->modname, desc->function, desc->lineno);
773
774 return state;
775 }
776 return false;
777 }
778
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for use DYNAMIC_DEBUG to implement DRM.debug
In reply to Jim Cromie== Series Details ==
== Series Details ==
Series: use DYNAMIC_DEBUG to implement DRM.debug
URL : https://patchwork.freedesktop.org/series/93914/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h AR lib/lib.a GEN lib/crc32table.h CC lib/crc32.o CC lib/dynamic_debug.o
lib/dynamic_debug.c: In function ‘ddebug_exec_queries’:lib/dynamic_debug.c:601:2: error: ‘query’ undeclared (first use in this function); did you mean ‘query_in’?
query = kstrndup(query_in, PAGE_SIZE, GFP_KERNEL);
^~~~~
query_inlib/dynamic_debug.c:601:2: note: each undeclared identifier is reported only once for each function it appears in lib/dynamic_debug.c: In function ‘dynamic_debug_exec_queries’:lib/dynamic_debug.c:621:29: error: ‘qry’ undeclared (first use in this function); did you mean ‘query’?
return ddebug_exec_queries(qry, modname, NULL);
^~~
querylib/dynamic_debug.c: In function ‘ddebug_exec_queries’:lib/dynamic_debug.c:619:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int dynamic_debug_exec_queries(const char *query, const char *modname)
^~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c:623:19: error: non-static declaration of ‘dynamic_debug_exec_queries’ follows static declaration
EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:164:33: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
^~~~~~~~~~~~~~lib/dynamic_debug.c:623:1: note: in expansion of macro ‘EXPORT_SYMBOL_GPL’
EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
^~~~~~~~~~~~~~~~~lib/dynamic_debug.c:619:5: note: previous definition of ‘dynamic_debug_exec_queries’ was here
int dynamic_debug_exec_queries(const char *query, const char *modname)
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:164:33: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
^~~~~~~~~~~~~~lib/dynamic_debug.c:623:1: note: in expansion of macro ‘EXPORT_SYMBOL_GPL’
EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
^~~~~~~~~~~~~~~~~lib/dynamic_debug.c:637:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int param_set_dyndbg(const char *instr, const struct kernel_param *kp)
^~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c:667:15: error: non-static declaration of ‘param_set_dyndbg’ follows static declaration
EXPORT_SYMBOL(param_set_dyndbg);
^~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:667:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(param_set_dyndbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:637:5: note: previous definition of ‘param_set_dyndbg’ was here
int param_set_dyndbg(const char *instr, const struct kernel_param *kp)
^~~~~~~~~~~~~~~~
In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:667:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(param_set_dyndbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:676:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
^~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c:681:15: error: non-static declaration of ‘param_get_dyndbg’ follows static declaration
EXPORT_SYMBOL(param_get_dyndbg);
^~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:681:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(param_get_dyndbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:676:5: note: previous definition of ‘param_get_dyndbg’ was here
int param_get_dyndbg(char *buffer, const struct kernel_param *kp)
^~~~~~~~~~~~~~~~
In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:681:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(param_get_dyndbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:683:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
const struct kernel_param_ops param_ops_dyndbg = {
^~~~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c:688:15: error: extern declaration of ‘param_ops_dyndbg’ follows declaration with no linkage
EXPORT_SYMBOL(param_ops_dyndbg);
^~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:688:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(param_ops_dyndbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:683:31: note: previous definition of ‘param_ops_dyndbg’ was here
const struct kernel_param_ops param_ops_dyndbg = {
^~~~~~~~~~~~~~~~In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:688:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(param_ops_dyndbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:692:12: error: invalid storage class for function ‘remaining’
static int remaining(int wrote)
^~~~~~~~~
lib/dynamic_debug.c:692:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static int remaining(int wrote)
^~~~~~lib/dynamic_debug.c:699:14: error: invalid storage class for function ‘__dynamic_emit_prefix’
static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
^~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:729:21: error: invalid storage class for function ‘dynamic_emit_prefix’
static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
^~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:749:33: error: invalid storage class for function ‘ddebug_rl_fetch’
static struct ddebug_ratelimit *ddebug_rl_fetch(struct _ddebug *desc);
^~~~~~~~~~~~~~~
lib/dynamic_debug.c:751:20: error: invalid storage class for function ‘is_onced_or_limited’
static inline bool is_onced_or_limited(struct _ddebug *desc)
^~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/printk.h:10,
from ./include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c: In function ‘is_onced_or_limited’:
lib/dynamic_debug.c:767:29: error: implicit declaration of function ‘ddebug_rl_fetch’; did you mean ‘ddebug_parse_flags’? [-Werror=implicit-function-declaration]
bool state = __ratelimit(&ddebug_rl_fetch(desc)->rs);
^~~~~~~~~~~~~~~
./include/linux/ratelimit_types.h:41:41: note: in definition of macro ‘__ratelimit’
#define __ratelimit(state) ___ratelimit(state, __func__)
^~~~~
lib/dynamic_debug.c:767:50: error: invalid type argument of ‘->’ (have ‘int’)
bool state = __ratelimit(&ddebug_rl_fetch(desc)->rs);
^~
./include/linux/ratelimit_types.h:41:41: note: in definition of macro ‘__ratelimit’
#define __ratelimit(state) ___ratelimit(state, __func__)
^~~~~In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c: In function ‘ddebug_exec_queries’:lib/dynamic_debug.c:812:15: error: non-static declaration of ‘__dynamic_pr_debug’ follows static declaration
EXPORT_SYMBOL(__dynamic_pr_debug);
^~~~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:812:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(__dynamic_pr_debug);
^~~~~~~~~~~~~lib/dynamic_debug.c:779:6: note: previous definition of ‘__dynamic_pr_debug’ was here
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:812:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(__dynamic_pr_debug);
^~~~~~~~~~~~~lib/dynamic_debug.c:814:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
void __dynamic_dev_dbg(struct _ddebug *descriptor,
^~~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c:844:15: error: non-static declaration of ‘__dynamic_dev_dbg’ follows static declaration
EXPORT_SYMBOL(__dynamic_dev_dbg);
^~~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:844:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(__dynamic_dev_dbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:814:6: note: previous definition of ‘__dynamic_dev_dbg’ was here
void __dynamic_dev_dbg(struct _ddebug *descriptor,
^~~~~~~~~~~~~~~~~
In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:844:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(__dynamic_dev_dbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:848:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
void __dynamic_netdev_dbg(struct _ddebug *descriptor,
^~~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:lib/dynamic_debug.c:884:15: error: non-static declaration of ‘__dynamic_netdev_dbg’ follows static declaration
EXPORT_SYMBOL(__dynamic_netdev_dbg);
^~~~~~~~~~~~~~~~~~~~
./include/linux/export.h:98:21: note: in definition of macro ‘___EXPORT_SYMBOL’
extern typeof(sym) sym; \
^~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:884:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(__dynamic_netdev_dbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:848:6: note: previous definition of ‘__dynamic_netdev_dbg’ was here
void __dynamic_netdev_dbg(struct _ddebug *descriptor,
^~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:241:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static void * __section(".discard.addressable") __used \
^~~~~~./include/linux/export.h:51:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(sym) \
^~~~~~~~~~~~~./include/linux/export.h:108:2: note: in expansion of macro ‘__KSYMTAB_ENTRY’
__KSYMTAB_ENTRY(sym, sec)
^~~~~~~~~~~~~~~./include/linux/export.h:152:39: note: in expansion of macro ‘___EXPORT_SYMBOL’
#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
^~~~~~~~~~~~~~~~
./include/linux/export.h:160:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
^~~~~~~~~~~~~~~
./include/linux/export.h:163:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
^~~~~~~~~~~~~~lib/dynamic_debug.c:884:1: note: in expansion of macro ‘EXPORT_SYMBOL’
EXPORT_SYMBOL(__dynamic_netdev_dbg);
^~~~~~~~~~~~~lib/dynamic_debug.c:927:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static __initdata char ddebug_setup_string[DDEBUG_STRING_SIZE];
^~~~~~lib/dynamic_debug.c:929:19: error: invalid storage class for function ‘ddebug_setup_query’
static __init int ddebug_setup_query(char *str)
^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/printk.h:6,
from ./include/linux/kernel.h:19,
from lib/dynamic_debug.c:16:
lib/dynamic_debug.c:939:26: error: initializer element is not constant
__setup("ddebug_query=", ddebug_setup_query);
^~~~~~~~~~~~~~~~~~
./include/linux/init.h:321:32: note: in definition of macro ‘__setup_param’
= { __setup_str_##unique_id, fn, early }
^~lib/dynamic_debug.c:939:1: note: in expansion of macro ‘__setup’
__setup("ddebug_query=", ddebug_setup_query);
^~~~~~~lib/dynamic_debug.c:939:26: note: (near initialization for ‘__setup_ddebug_setup_query.setup_func’)
__setup("ddebug_query=", ddebug_setup_query);
^~~~~~~~~~~~~~~~~~
./include/linux/init.h:321:32: note: in definition of macro ‘__setup_param’
= { __setup_str_##unique_id, fn, early }
^~lib/dynamic_debug.c:939:1: note: in expansion of macro ‘__setup’
__setup("ddebug_query=", ddebug_setup_query);
^~~~~~~lib/dynamic_debug.c:946:16: error: invalid storage class for function ‘ddebug_proc_write’
static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:977:24: error: invalid storage class for function ‘ddebug_iter_first’
static struct _ddebug *ddebug_iter_first(struct ddebug_iter *iter)
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:996:24: error: invalid storage class for function ‘ddebug_iter_next’
static struct _ddebug *ddebug_iter_next(struct ddebug_iter *iter)
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1018:14: error: invalid storage class for function ‘ddebug_proc_start’
static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1041:14: error: invalid storage class for function ‘ddebug_proc_next’
static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1060:12: error: invalid storage class for function ‘ddebug_proc_show’
static int ddebug_proc_show(struct seq_file *m, void *p)
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1086:13: error: invalid storage class for function ‘ddebug_proc_stop’
static void ddebug_proc_stop(struct seq_file *m, void *p)
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1092:11: error: initializer element is not constant
.start = ddebug_proc_start,
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1092:11: note: (near initialization for ‘ddebug_proc_seqops.start’)
lib/dynamic_debug.c:1093:10: error: initializer element is not constant
.next = ddebug_proc_next,
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1093:10: note: (near initialization for ‘ddebug_proc_seqops.next’)
lib/dynamic_debug.c:1094:10: error: initializer element is not constant
.show = ddebug_proc_show,
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1094:10: note: (near initialization for ‘ddebug_proc_seqops.show’)
lib/dynamic_debug.c:1095:10: error: initializer element is not constant
.stop = ddebug_proc_stop
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1095:10: note: (near initialization for ‘ddebug_proc_seqops.stop’)
lib/dynamic_debug.c:1098:12: error: invalid storage class for function ‘ddebug_proc_open’
static int ddebug_proc_open(struct inode *inode, struct file *file)
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1106:10: error: initializer element is not constant
.open = ddebug_proc_open,
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1106:10: note: (near initialization for ‘ddebug_proc_fops.open’)
lib/dynamic_debug.c:1110:11: error: initializer element is not constant
.write = ddebug_proc_write
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1110:11: note: (near initialization for ‘ddebug_proc_fops.write’)
lib/dynamic_debug.c:1114:15: error: initializer element is not constant
.proc_open = ddebug_proc_open,
^~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1114:15: note: (near initialization for ‘proc_fops.proc_open’)
lib/dynamic_debug.c:1118:16: error: initializer element is not constant
.proc_write = ddebug_proc_write
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1118:16: note: (near initialization for ‘proc_fops.proc_write’)
lib/dynamic_debug.c:1154:12: error: invalid storage class for function ‘ddebug_dyndbg_param_cb’
static int ddebug_dyndbg_param_cb(char *param, char *val,
^~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1175:12: error: invalid storage class for function ‘ddebug_dyndbg_boot_param_cb’
static int ddebug_dyndbg_boot_param_cb(char *param, char *val,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1193:13: error: invalid storage class for function ‘ddebug_table_free’
static void ddebug_table_free(struct ddebug_table *dt)
^~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1222:13: error: invalid storage class for function ‘ddebug_remove_all_tables’
static void ddebug_remove_all_tables(void)
^~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1236:19: error: invalid storage class for function ‘dynamic_debug_init_control’
static int __init dynamic_debug_init_control(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dynamic_debug.c:1259:19: error: invalid storage class for function ‘dynamic_debug_init’
static int __init dynamic_debug_init(void)
^~~~~~~~~~~~~~~~~~In file included from ./include/linux/export.h:43,
from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from lib/dynamic_debug.c:16:./include/linux/compiler.h:242:46: error: initializer element is not constant
__UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
^./include/linux/init.h:236:2: note: in expansion of macro ‘__ADDRESSABLE’
__ADDRESSABLE(fn)
^~~~~~~~~~~~~./include/linux/init.h:241:2: note: in expansion of macro ‘__define_initcall_stub’
__define_initcall_stub(__stub, fn) \
^~~~~~~~~~~~~~~~~~~~~~./include/linux/init.h:254:2: note: in expansion of macro ‘____define_initcall’
____define_initcall(fn, \
^~~~~~~~~~~~~~~~~~~./include/linux/init.h:260:2: note: in expansion of macro ‘__unique_initcall’
__unique_initcall(fn, id, __sec, __initcall_id(fn)) ^~~~~~~~~~~~~~~~~./include/linux/init.h:262:35: note: in expansion of macro ‘___define_initcall’
#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
^~~~~~~~~~~~~~~~~~
./include/linux/init.h:269:29: note: in expansion of macro ‘__define_initcall’
#define early_initcall(fn) __define_initcall(fn, early)
^~~~~~~~~~~~~~~~~lib/dynamic_debug.c:1330:1: note: in expansion of macro ‘early_initcall’
early_initcall(dynamic_debug_init);
^~~~~~~~~~~~~~
In file included from ./include/linux/bits.h:22,
from ./include/linux/bitops.h:6,
from ./include/linux/kernel.h:12,
from lib/dynamic_debug.c:16:
./include/linux/build_bug.h:78:41: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~~~~~~~~~~~
./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
^~~~~~~~~~~~~~~./include/linux/init.h:246:2: note: in expansion of macro ‘static_assert’
static_assert(__same_type(initcall_t, &fn));
^~~~~~~~~~~~~./include/linux/init.h:254:2: note: in expansion of macro ‘____define_initcall’
____define_initcall(fn, \
^~~~~~~~~~~~~~~~~~~./include/linux/init.h:260:2: note: in expansion of macro ‘__unique_initcall’
__unique_initcall(fn, id, __sec, __initcall_id(fn)) ^~~~~~~~~~~~~~~~~./include/linux/init.h:262:35: note: in expansion of macro ‘___define_initcall’
#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
^~~~~~~~~~~~~~Jason Baron
maintainerQuoted 8 lines · Jim Cromie
This patchset does 3 main things.
Adds
DEFINE_DYNAMIC_DEBUG_CATEGORIESto define bitmap => category control ofpr_debugs, and to create their sysfs entries.Uses it in amdgpu, i915 to control existing
pr_debugsaccording to their ad-hoc categorizations.
Quoted 8 lines
Plugs dyndbg into drm-debug framework, in a configurable manner.
v6: cleans up per v5 feedback, and adds RFC stuff:
- test_dynamic_debug.ko: uses tracer facility added in v5:8/9
- prototype print-once & rate-limitingHopefully adding RFC stuff doesnt distract too much.
Hi Jim,
Yeah, I feel like the RFC patches should be in a separate series unless there is a drm dependency for them?
Thanks,
-Jason
Quoted 34 lines
Jim Cromie (11):
moduleparam: add data member to structkernel_param
dyndbg: addDEFINE_DYNAMIC_DEBUG_CATEGORIESand callbacks i915/gvt: remove spaces inpr_debug"gvt: core:" etc prefixes i915/gvt: useDEFINE_DYNAMIC_DEBUG_CATEGORIESto create "gvt:core:"
etc categories
amdgpu: useDEFINE_DYNAMIC_DEBUG_CATEGORIESto control categorized
pr_debugs
drm_print: add choice to use dynamic debug in drm-debug
drm_print: instrumentdrm_debug_enabled
amdgpu_ucode: reduce number ofpr_debugcalls
nouveau: fold multipleDRM_DEBUG_DRIVERstogether
dyndbg: RFC add debug-trace callback, selftest with it. RFC
dyndbg: RFC add print-once and print-ratelimited features. RFC.drivers/gpu/drm/Kconfig | 13 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 293 ++++++++------- .../gpu/drm/amd/display/dc/core/dc_debug.c | 44 ++- drivers/gpu/drm/drm_print.c | 49 ++- drivers/gpu/drm/i915/gvt/Makefile | 4 + drivers/gpu/drm/i915/gvt/debug.h | 18 +- drivers/gpu/drm/i915/i915_params.c | 35 ++ drivers/gpu/drm/nouveau/nouveau_drm.c | 36 +- include/drm/drm_print.h | 148 ++++++-- include/linux/dynamic_debug.h | 81 ++++- include/linux/moduleparam.h | 11 +- lib/Kconfig.debug | 11 + lib/Makefile | 1 + lib/dynamic_debug.c | 336 ++++++++++++++++-- lib/test_dynamic_debug.c | 279 +++++++++++++++ 15 files changed, 1117 insertions(+), 242 deletions(-) create mode 100644 lib/test_dynamic_debug.c