[PATCH 1/4] drm-printk: POC caller of dynamic-debug-exec-queries
Export of dynamic-debug-exec-queries exists for users like drm. This commit is a 1st user-test; it adds a 2nd knob, __drm_debug2, similar in function to __drm_debug. module_param_cb wires it to a callback which maps the input value to one of: "module=drm* +/-p". The include is needed to see the exported function prototype. Notes: The define DEBUG at top of drm-printk enables all pr_debug()s, independent of CONFIG_DYNAMIC_DEBUG_CORE. drm-printk is an independent print control system using __drm_debug bits. The plan is to find the low-level macros in which to insert a pr_debug call, their eventual callsites will have distinct METADATA, so will be itemized in control, and individually selectable. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 111b932cf2a9..52abaf2ae053 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -54,6 +55,40 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat "\t\tBit 8 (0x100) will enable DP messages (displayport code)"); module_param_named(debug, __drm_debug, int, 0600); +/* POC for callback -> ddebug_exec_queries */ +unsigned int __drm_debug2; +EXPORT_SYMBOL(__drm_debug2); + +static int param_set_dyndbg(const char *val, const struct kernel_param *kp) +{ + int chgct, result; + + result = kstrtouint(val, 0, (unsigned int *)kp->arg); + pr_warn("set_dyndbg: result:%d from %s\n", result, val); + + if (result) + chgct = dynamic_debug_exec_queries("module=drm* +p", NULL); + else + chgct = dynamic_debug_exec_queries("module=drm* -p", NULL); + + pr_warn("change ct:%d\n", chgct); + return 0; +} +static int param_get_dyndbg(char *buffer, const struct kernel_param *kp) +{ + return scnprintf(buffer, PAGE_SIZE, "%u\n", +*((unsigned int *)kp->arg)); +} +static const struct kernel_param_ops param_ops_dyndbg = { + .set = param_set_dyndbg, + .get = param_get_dyndbg, +}; + +MODULE_PARM_DESC(debug_dyn, "Enable debug output, where each bit enables a debug category.\n" +"\t\tthese wont work yet\n"); +module_param_cb(debug_dyn, _ops_dyndbg, &__drm_debug2, 0644); + + void __drm_puts_coredump(struct drm_printer *p, const char *str) { struct drm_print_iterator *iterator = p->arg; -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/4] drm-printk: POC caller of dynamic-debug-exec-queries
Hi Jim, I love your patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on linux/master drm-tip/drm-tip linus/master v5.9-rc2 next-20200826] [cannot apply to drm/drm-next] [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/dyndbg-POC-use-dynamic_debug_exec_queries-in-DRM/20200827-010409 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: arm64-randconfig-r002-20200826 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6) 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 # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from drivers/gpu/drm/drm_print.c:30: >> include/linux/dynamic_debug.h:196:3: error: implicit declaration of function >> 'printk' [-Werror,-Wimplicit-function-declaration] printk(KERN_WARNING "dyndbg param is supported only in " ^ >> include/linux/dynamic_debug.h:196:10: error: use of undeclared identifier >> 'KERN_WARNING' printk(KERN_WARNING "dyndbg param is supported only in " ^ In file included from drivers/gpu/drm/drm_print.c:31: In file included from include/linux/io.h:11: In file included from include/linux/bug.h:5: In file included from arch/arm64/include/asm/bug.h:26: In file included from include/asm-generic/bug.h:19: In file included from include/linux/kernel.h:15: include/linux/printk.h:171:5: error: conflicting types for 'printk' int printk(const char *fmt, ...); ^ include/linux/dynamic_debug.h:196:3: note: previous implicit declaration is here printk(KERN_WARNING "dyndbg param is supported only in " ^ >> drivers/gpu/drm/drm_print.c:70:11: error: implicit declaration of function >> 'dynamic_debug_exec_queries' [-Werror,-Wimplicit-function-declaration] chgct = dynamic_debug_exec_queries("module=drm* +p", NULL); ^ 4 errors generated. # https://github.com/0day-ci/linux/commit/ad959a93dccb8fe5deb5a7da3e22049779571b9b git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jim-Cromie/dyndbg-POC-use-dynamic_debug_exec_queries-in-DRM/20200827-010409 git checkout ad959a93dccb8fe5deb5a7da3e22049779571b9b vim +/printk +196 include/linux/dynamic_debug.h e9d376f0fa66bd6 Jason Baron 2009-02-05 190 b48420c1d3019ce Jim Cromie 2012-04-27 191 static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, b48420c1d3019ce Jim Cromie 2012-04-27 192 const char *modname) b48420c1d3019ce Jim Cromie 2012-04-27 193 { b48420c1d3019ce Jim Cromie 2012-04-27 194 if (strstr(param, "dyndbg")) { 516cf1be07cf3ab Jim Cromie 2012-05-01 195 /* avoid pr_warn(), which wants pr_fmt() fully defined */ 516cf1be07cf3ab Jim Cromie 2012-05-01 @196 printk(KERN_WARNING "dyndbg param is supported only in " b48420c1d3019ce Jim Cromie 2012-04-27 197 "CONFIG_DYNAMIC_DEBUG builds\n"); b48420c1d3019ce Jim Cromie 2012-04-27 198 return 0; /* allow and ignore */ b48420c1d3019ce Jim Cromie 2012-04-27 199 } b48420c1d3019ce Jim Cromie 2012-04-27 200 return -EINVAL; b48420c1d3019ce Jim Cromie 2012-04-27 201 } b48420c1d3019ce Jim Cromie 2012-04-27 202 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/4] drm-printk: POC caller of dynamic-debug-exec-queries
Hi Jim, I love your patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on linux/master tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master v5.9-rc2 next-20200826] [cannot apply to drm/drm-next] [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/dyndbg-POC-use-dynamic_debug_exec_queries-in-DRM/20200827-010409 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: microblaze-randconfig-r006-20200826 (attached as .config) compiler: microblaze-linux-gcc (GCC) 9.3.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 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from drivers/gpu/drm/drm_print.c:30: include/linux/dynamic_debug.h: In function 'ddebug_dyndbg_module_param_cb': >> include/linux/dynamic_debug.h:196:3: error: implicit declaration of function >> 'printk'; did you mean 'bprintf'? [-Werror=implicit-function-declaration] 196 | printk(KERN_WARNING "dyndbg param is supported only in " | ^~ | bprintf >> include/linux/dynamic_debug.h:196:10: error: 'KERN_WARNING' undeclared >> (first use in this function) 196 | printk(KERN_WARNING "dyndbg param is supported only in " | ^~~~ include/linux/dynamic_debug.h:196:10: note: each undeclared identifier is reported only once for each function it appears in >> include/linux/dynamic_debug.h:196:22: error: expected ')' before string >> constant 196 | printk(KERN_WARNING "dyndbg param is supported only in " | ^ | ) In file included from include/linux/kernel.h:15, from include/asm-generic/bug.h:19, from ./arch/microblaze/include/generated/asm/bug.h:1, from include/linux/bug.h:5, from include/linux/io.h:11, from drivers/gpu/drm/drm_print.c:31: include/linux/printk.h: At top level: >> include/linux/printk.h:171:5: error: conflicting types for 'printk' 171 | int printk(const char *fmt, ...); | ^~ include/linux/printk.h:171:1: note: a parameter list with an ellipsis can't match an empty parameter name list declaration 171 | int printk(const char *fmt, ...); | ^~~ In file included from drivers/gpu/drm/drm_print.c:30: include/linux/dynamic_debug.h:196:3: note: previous implicit declaration of 'printk' was here 196 | printk(KERN_WARNING "dyndbg param is supported only in " | ^~ drivers/gpu/drm/drm_print.c: In function 'param_set_dyndbg': >> drivers/gpu/drm/drm_print.c:70:11: error: implicit declaration of function >> 'dynamic_debug_exec_queries' [-Werror=implicit-function-declaration] 70 | chgct = dynamic_debug_exec_queries("module=drm* +p", NULL); | ^~ cc1: some warnings being treated as errors # https://github.com/0day-ci/linux/commit/ad959a93dccb8fe5deb5a7da3e22049779571b9b git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jim-Cromie/dyndbg-POC-use-dynamic_debug_exec_queries-in-DRM/20200827-010409 git checkout ad959a93dccb8fe5deb5a7da3e22049779571b9b vim +196 include/linux/dynamic_debug.h e9d376f0fa66bd6 Jason Baron 2009-02-05 190 b48420c1d3019ce Jim Cromie 2012-04-27 191 static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, b48420c1d3019ce Jim Cromie 2012-04-27 192 const char *modname) b48420c1d3019ce Jim Cromie 2012-04-27 193 { b48420c1d3019ce Jim Cromie 2012-04-27 194 if (strstr(param, "dyndbg")) { 516cf1be07cf3ab Jim Cromie 2012-05-01 195 /* avoid pr_warn(), which wants pr_fmt() fully defined */ 516cf1be07cf3ab Jim Cromie 2012-05-01 @196 printk(KERN_WARNING "dyndbg param is supported only in " b48420c1d3019ce Jim Cromie 2012-04-27 197 "CONFIG_DYNAMIC_DEBUG builds\n"); b48420c1d3019ce Jim Cromie 2012-04-27 198 return 0; /* allow and ignore */ b48420c1d3019ce Jim Cromie 2012-04-27 199 } b48420c1d3019ce Jim Cromie 2012-04-27 200 return -EINVAL; b48420c1d3019ce Jim Cromie 2012-04-27 201 } b48420c1d3019ce Jim Cromie 2012-04-27 202 --- 0-DAY CI Kernel Test Service, Intel Corporation