All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [jimc:dd-drm-next 10/11] lib/test_dynamic_debug.c:185:16: error: too few arguments to function 'dynamic_debug_register_tracer'
@ 2021-08-12  6:13 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-12  6:13 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 17507 bytes --]

tree:   https://github.com/jimc/linux.git dd-drm-next
head:   1658a41496c77287b265b1de6dfe79a9a65fef09
commit: 03e1630af27012c72b182bcada6bb8f194ae6d75 [10/11] dyndbg: RFC add tracer facility RFC
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 10.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
        # https://github.com/jimc/linux/commit/03e1630af27012c72b182bcada6bb8f194ae6d75
        git remote add jimc https://github.com/jimc/linux.git
        git fetch --no-tags jimc dd-drm-next
        git checkout 03e1630af27012c72b182bcada6bb8f194ae6d75
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash lib/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   lib/test_dynamic_debug.c: In function 'do_register_test':
   lib/test_dynamic_debug.c:185:49: warning: passing argument 1 of 'dynamic_debug_register_tracer' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     185 |  match_count = dynamic_debug_register_tracer(tst->qry, tracer);
         |                                              ~~~^~~~~
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:297:41: note: expected 'char *' but argument is of type 'const char *'
     297 | int dynamic_debug_register_tracer(char *query, const char *mod,
         |                                   ~~~~~~^~~~~
>> lib/test_dynamic_debug.c:185:16: error: too few arguments to function 'dynamic_debug_register_tracer'
     185 |  match_count = dynamic_debug_register_tracer(tst->qry, tracer);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:297:5: note: declared here
     297 | int dynamic_debug_register_tracer(char *query, const char *mod,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/test_dynamic_debug.c: In function 'test_dynamic_debug_init':
>> lib/test_dynamic_debug.c:212:53: error: passing argument 2 of 'dynamic_debug_register_tracer' from incompatible pointer type [-Werror=incompatible-pointer-types]
     212 |   "module test_dynamic_debug func do_debugging +T", my_tracer);
         |                                                     ^~~~~~~~~
         |                                                     |
         |                                                     int (*)(const char *, char *, char *, struct va_format *)
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:297:60: note: expected 'const char *' but argument is of type 'int (*)(const char *, char *, char *, struct va_format *)'
     297 | int dynamic_debug_register_tracer(char *query, const char *mod,
         |                                                ~~~~~~~~~~~~^~~
   lib/test_dynamic_debug.c:211:16: error: too few arguments to function 'dynamic_debug_register_tracer'
     211 |  match_count = dynamic_debug_register_tracer(
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:297:5: note: declared here
     297 | int dynamic_debug_register_tracer(char *query, const char *mod,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/test_dynamic_debug.c:217:35: error: passing argument 2 of 'dynamic_debug_register_tracer' from incompatible pointer type [-Werror=incompatible-pointer-types]
     217 |   "module test_dynamic_debug +T", my_tracer);
         |                                   ^~~~~~~~~
         |                                   |
         |                                   int (*)(const char *, char *, char *, struct va_format *)
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:297:60: note: expected 'const char *' but argument is of type 'int (*)(const char *, char *, char *, struct va_format *)'
     297 | int dynamic_debug_register_tracer(char *query, const char *mod,
         |                                                ~~~~~~~~~~~~^~~
   lib/test_dynamic_debug.c:216:16: error: too few arguments to function 'dynamic_debug_register_tracer'
     216 |  match_count = dynamic_debug_register_tracer(
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:297:5: note: declared here
     297 | int dynamic_debug_register_tracer(char *query, const char *mod,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> lib/test_dynamic_debug.c:228:53: error: passing argument 2 of 'dynamic_debug_unregister_tracer' from incompatible pointer type [-Werror=incompatible-pointer-types]
     228 |   "module test_dynamic_debug func do_debugging -T", my_tracer);
         |                                                     ^~~~~~~~~
         |                                                     |
         |                                                     int (*)(const char *, char *, char *, struct va_format *)
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:309:68: note: expected 'const char *' but argument is of type 'int (*)(const char *, char *, char *, struct va_format *)'
     309 | int dynamic_debug_unregister_tracer(const char *query, const char *mod,
         |                                                        ~~~~~~~~~~~~^~~
>> lib/test_dynamic_debug.c:227:16: error: too few arguments to function 'dynamic_debug_unregister_tracer'
     227 |  match_count = dynamic_debug_unregister_tracer(
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:309:5: note: declared here
     309 | int dynamic_debug_unregister_tracer(const char *query, const char *mod,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/test_dynamic_debug.c:235:53: error: passing argument 2 of 'dynamic_debug_unregister_tracer' from incompatible pointer type [-Werror=incompatible-pointer-types]
     235 |   "module test_dynamic_debug func do_debugging -T", my_tracer);
         |                                                     ^~~~~~~~~
         |                                                     |
         |                                                     int (*)(const char *, char *, char *, struct va_format *)
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:309:68: note: expected 'const char *' but argument is of type 'int (*)(const char *, char *, char *, struct va_format *)'
     309 | int dynamic_debug_unregister_tracer(const char *query, const char *mod,
         |                                                        ~~~~~~~~~~~~^~~
   lib/test_dynamic_debug.c:234:16: error: too few arguments to function 'dynamic_debug_unregister_tracer'
     234 |  match_count = dynamic_debug_unregister_tracer(
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from lib/test_dynamic_debug.c:18:
   include/linux/dynamic_debug.h:309:5: note: declared here
     309 | int dynamic_debug_unregister_tracer(const char *query, const char *mod,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   At top level:
   lib/test_dynamic_debug.c:181:13: warning: 'do_register_test' defined but not used [-Wunused-function]
     181 | static void do_register_test(struct register_test *tst, void *tracer)
         |             ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/dynamic_debug_register_tracer +185 lib/test_dynamic_debug.c

  > 18	#include <linux/module.h>
    19	
    20	static int __bad_tracer;
    21	
    22	static int trace_ct = 0;
    23	static int test_ct = 0;
    24	static int errors = 0;
    25	static int verbose = 0;
    26	
    27	
    28	module_param_named(use_bad_tracer, __bad_tracer, int, 0644);
    29	MODULE_PARM_DESC(use_bad_tracer,
    30			 "use broken tracer, recursing with pr_debug\n"
    31			 "\tonly works at modprobe time\n");
    32	
    33	static int (*my_tracer)(const char *decorator, char *prefix, char *label, struct va_format *vaf);
    34	
    35	static int good_tracer(const char *decorator, char *prefix, char *label, struct va_format *vaf)
    36	{
    37		trace_ct++;
    38		if (verbose)
    39			pr_notice("my_tracer: %pV", vaf);
    40		return 0;
    41	}
    42	
    43	static int bad_tracer(const char *decorator, char *prefix, char *label, struct va_format *vaf)
    44	{
    45		/* dont try pr_debug, it recurses back here */
    46		pr_debug("oops! recursion, crash?\n");
    47		return 0;
    48	}
    49	
    50	static void pick_tracer(void)
    51	{
    52		if (__bad_tracer)
    53			my_tracer = bad_tracer;
    54		else
    55			my_tracer = good_tracer;
    56	}
    57	
    58	static int expect_count(int want, const char *story)
    59	{
    60		test_ct++;
    61		if (want != trace_ct) {
    62			pr_err("expect_count: want %d, got %d: %s\n", want, trace_ct, story);
    63			errors++;
    64			trace_ct = 0;
    65			return 1;
    66		}
    67		pr_info("pass %d, hits %d, on \"%s\"\n", test_ct, want, story);
    68		trace_ct = 0;
    69		return 0;
    70	}
    71	
    72	/* call pr_debug (4 * reps) + 2 times, for tracer side-effects */
    73	static void do_debugging(int reps)
    74	{
    75		int i;
    76	
    77		pr_debug("Entry:\n");
    78		pr_info(" do_debugging %d time(s)\n", reps);
    79		for (i = 0; i < reps; i++) {
    80			pr_debug("hi: %d\n", i);
    81			pr_debug("mid: %d\n", i);
    82			pr_debug("low: %d\n", i);
    83			pr_debug("low:lower: %d subcategory test\n", i);
    84		}
    85		pr_debug("Exit:\n");
    86	}
    87	
    88	static void expect_matches(int want, int got, const char *story)
    89	{
    90		// todo: got <0 are errors, bubbled up
    91		if (got != want)
    92			pr_warn(" match_count wrong: want %d got %d %s\n", want, got, story);
    93		else
    94			pr_info(" ok: %d matches by \"%s\"\n", want, story);
    95	
    96		// ? count errs ? separately ?
    97	}
    98	
    99	static int report(char *who)
   100	{
   101		if (errors)
   102			pr_err("%s failed %d of %d tests\n", who, errors, test_ct);
   103		else
   104			pr_info("%s passed %d tests\n", who, test_ct);
   105		return errors;
   106	}
   107	
   108	struct exec_test {
   109		int matches;
   110		int loops;
   111		int hits;
   112		const char *mod;
   113		const char *qry;
   114	};
   115	
   116	static void do_exec_test(struct exec_test *tst)
   117	{
   118		int match_count;
   119	
   120		match_count = dynamic_debug_exec_queries(tst->qry, tst->mod);
   121		expect_matches(tst->matches, match_count, tst->qry);
   122		do_debugging(tst->loops);
   123		expect_count(tst->hits, tst->qry);
   124	}
   125	
   126	static const char my_mod[] = "test_dynamic_debug";
   127	
   128	/* these tests rely on register stuff having been done ?? */
   129	struct exec_test exec_tests[] = {
   130	
   131		/* standard use is my_mod, for `modprobe $module dyndbg=+p` */
   132	
   133		/* no modification probe */
   134		{ 6, 2, 0, my_mod, "func do_debugging +_" },
   135	
   136		/* use original single string query style */
   137		{ 6, 3, 0, NULL, "module test_dynamic_debug func do_debugging -T" },
   138	
   139		/* this is mildly preferred */
   140		{ 6, 3, 0, my_mod, "func do_debugging -T" },
   141	
   142		/* enable all DUT */
   143		{ 6, 4, 18, my_mod, "func do_debugging +T" },
   144	
   145		/* disable 1 call */
   146		{ 1, 4, 14, my_mod, "format '^hi:' -T" },
   147	
   148		/* disable 1 call */
   149		{ 1, 4, 10, my_mod, "format '^mid:' -T" },
   150	
   151		/* repeat same disable */
   152		{ 1, 4, 10, my_mod, "format '^mid:' -T" },
   153	
   154		/* repeat same disable, diff run ct */
   155		{ 1, 5, 12, my_mod, "format '^mid:' -T" },
   156	
   157		/* include subclass */
   158		{ 2, 4, 2, my_mod, "format '^low:' -T" },
   159	
   160		/* re-disable, exclude subclass */
   161		{ 1, 4, 2, my_mod, "format '^low: ' -T" },
   162	
   163		/* enable, exclude subclass */
   164		{ 1, 4, 6, my_mod, "format '^low: ' +T" },
   165	
   166		/* enable the subclass */
   167		{ 1, 4, 10, my_mod, "format '^low:lower:' +T" },
   168	
   169		/* enable the subclass */
   170		{ 1, 6, 14, my_mod, "format '^low:lower:' +T" },
   171	};
   172	
   173	struct register_test {
   174		int matches;
   175		int loops;
   176		int hits;
   177		// const char *mod; maybe should have
   178		const char *qry;
   179	};
   180	
   181	static void do_register_test(struct register_test *tst, void *tracer)
   182	{
   183		int match_count;
   184	
 > 185		match_count = dynamic_debug_register_tracer(tst->qry, tracer);
   186		expect_matches(tst->matches, match_count, tst->qry);
   187		do_debugging(tst->loops);
   188		expect_count(tst->hits, tst->qry);
   189	}
   190	
   191	/* these tests rely on register stuff having been done ?? */
   192	struct register_test register_tests[] = {
   193	
   194		{ 6, 3, 0, "module test_dynamic_debug func do_debugging +T" },
   195	
   196		{ 11, 3, 0, "module test_dynamic_debug +T" },
   197	
   198	};
   199	
   200	static int __init test_dynamic_debug_init(void)
   201	{
   202		int match_count; /* rc from ddebug_exec_queries. meh. */
   203		int i;
   204	
   205		pick_tracer();
   206	
   207		pr_debug("Entry:\n");
   208		do_debugging(3);
   209		expect_count(0, "nothing unless dyndbg=+T at modprobe");
   210	
   211		match_count = dynamic_debug_register_tracer(
 > 212			"module test_dynamic_debug func do_debugging +T", my_tracer);
   213		expect_matches(6, match_count,
   214			       "tracing do_debugging()s pr_debugs");
   215	
   216		match_count = dynamic_debug_register_tracer(
   217			"module test_dynamic_debug +T", my_tracer);
   218		expect_matches(11, match_count,
   219			       "tracing whole module's pr_debugs");
   220	
   221		do_debugging(2);
   222		expect_count(10, "do_debugging 2 times after +T");
   223	
   224		for (i = 0; i < ARRAY_SIZE(exec_tests); i++)
   225			do_exec_test(&exec_tests[i]);
   226	
 > 227		match_count = dynamic_debug_unregister_tracer(
 > 228			"module test_dynamic_debug func do_debugging -T", my_tracer);
   229		expect_matches(6, match_count,
   230			       "unregister do_debugging()s tracers");
   231		do_debugging(4);
   232		expect_count(0, "everything is off");
   233	
   234		match_count = dynamic_debug_unregister_tracer(
   235			"module test_dynamic_debug func do_debugging -T", my_tracer);
   236	
   237		expect_matches(6, match_count,
   238			       "re-unregister, same count, not a change count");
   239		report("init");
   240		pr_debug("Exit:\n");
   241		return 0;
   242	}
   243	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 70952 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-12  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-12  6:13 [jimc:dd-drm-next 10/11] lib/test_dynamic_debug.c:185:16: error: too few arguments to function 'dynamic_debug_register_tracer' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.