Content-Type: multipart/mixed; boundary="===============2776556169187177333==" MIME-Version: 1.0 From: Nathan Chancellor To: kbuild-all@lists.01.org Subject: Re: [PATCH v11 1/4] trace: Add trace any kernel object Date: Fri, 03 Jun 2022 08:37:30 -0700 Message-ID: In-Reply-To: List-Id: --===============2776556169187177333== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Fri, Jun 03, 2022 at 09:48:07AM +0800, Jeff Xie wrote: > Hi lkp, > = > On Fri, Jun 3, 2022 at 5:12 AM kernel test robot wrote: > > > > Hi Jeff, > > > > Thank you for the patch! Perhaps something to improve: > > > > [auto build test WARNING on b39181f7c6907dc66ff937b74758671fa6ba430c] > > > > url: https://github.com/intel-lab-lkp/linux/commits/Jeff-Xie/trace-I= ntroduce-objtrace-trigger-to-trace-the-kernel-object/20220603-004723 > > base: b39181f7c6907dc66ff937b74758671fa6ba430c > > config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/2= 0220603/202206030515.4lqqkb3W-lkp(a)intel.com/config) > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b3= 64c76683f8ef241025a9556300778c07b590c2) > > reproduce (this is a W=3D1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/s= bin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # https://github.com/intel-lab-lkp/linux/commit/765253f020469f9= 4856aedc5a3fe5444e1e8f4e8 > > git remote add linux-review https://github.com/intel-lab-lkp/li= nux > > git fetch --no-tags linux-review Jeff-Xie/trace-Introduce-objtr= ace-trigger-to-trace-the-kernel-object/20220603-004723 > > git checkout 765253f020469f94856aedc5a3fe5444e1e8f4e8 > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross = W=3D1 O=3Dbuild_dir ARCH=3Di386 SHELL=3D/bin/bash drivers/gpu/drm/qxl/ kern= el/trace/ > > > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > > > > All warnings (new ones prefixed by >>): > > > > >> kernel/trace/trace_object.c:336:61: warning: format specifies type '= long' but the argument has type 'unsigned int' [-Wformat] > > pr_err("the size of the %s should be:%ld\n", field->= name, sizeof(void *)); > > ~~~ = ^~~~~~~~~~~~~~ > > %u > = > I will double check it ,the sizeof(void *) on x86_64 is type =E2=80=98lo= ng > unsigned int=E2=80=99. Per Documentation/core-api/printk-formats.rst, sizeof returns size_t, which should use the %zu specifier. Cheers, Nathan > > include/linux/printk.h:489:33: note: expanded from macro 'pr_err' > > printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) > > ~~~ ^~~~~~~~~~~ > > include/linux/printk.h:446:60: note: expanded from macro 'printk' > > #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS= __) > > ~~~ ^~~~~~~~~= ~~ > > include/linux/printk.h:418:19: note: expanded from macro 'printk_ind= ex_wrap' > > _p_func(_fmt, ##__VA_ARGS__); = \ > > ~~~~ ^~~~~~~~~~~ > > 1 warning generated. > > > > > > vim +336 kernel/trace/trace_object.c > > > > 297 > > 298 static int > > 299 event_object_trigger_parse(struct event_command *cmd_ops, > > 300 struct trace_event_file *file, > > 301 char *glob, char *cmd, char *param_and_f= ilter) > > 302 { > > 303 struct event_trigger_data *trigger_data; > > 304 struct objtrace_trigger_data *obj_data; > > 305 struct ftrace_event_field *field; > > 306 char *objtrace_cmd, *arg; > > 307 char *param, *filter; > > 308 int ret; > > 309 bool remove; > > 310 > > 311 remove =3D event_trigger_check_remove(glob); > > 312 > > 313 /* > > 314 * separate the param and the filter: > > 315 * objtrace:add:OBJ[:COUNT] [if filter] > > 316 */ > > 317 ret =3D event_trigger_separate_filter(param_and_filter,= ¶m, &filter, true); > > 318 if (ret) > > 319 return ret; > > 320 > > 321 objtrace_cmd =3D strsep(¶m, ":"); > > 322 if (!objtrace_cmd || strcmp(objtrace_cmd, OBJTRACE_CMD_= ADD)) { > > 323 pr_err("error objtrace command\n"); > > 324 return -EINVAL; > > 325 } > > 326 > > 327 arg =3D strsep(¶m, ":"); > > 328 if (!arg) > > 329 return -EINVAL; > > 330 > > 331 field =3D trace_find_event_field(file->event_call, arg); > > 332 if (!field) > > 333 return -EINVAL; > > 334 > > 335 if (field->size !=3D sizeof(void *)) { > > > 336 pr_err("the size of the %s should be:%ld\n", fi= eld->name, sizeof(void *)); > > 337 return -EINVAL; > > 338 } > > 339 > > 340 if (remove && !field_exist(file, cmd_ops, field->name)) > > 341 return -ENOENT; > > 342 > > 343 obj_data =3D kzalloc(sizeof(*obj_data), GFP_KERNEL); > > 344 if (!obj_data) > > 345 return -ENOMEM; > > 346 > > 347 obj_data->field =3D field; > > 348 obj_data->tr =3D file->tr; > > 349 snprintf(obj_data->objtrace_cmd, OBJTRACE_CMD_LEN, objt= race_cmd); > > 350 > > 351 trigger_data =3D event_trigger_alloc(cmd_ops, cmd, para= m, obj_data); > > 352 if (!trigger_data) { > > 353 kfree(obj_data); > > 354 return -ENOMEM; > > 355 } > > 356 if (remove) { > > 357 event_trigger_unregister(cmd_ops, file, glob+1,= trigger_data); > > 358 kfree(obj_data); > > 359 kfree(trigger_data); > > 360 return 0; > > 361 } > > 362 > > 363 ret =3D event_trigger_parse_num(param, trigger_data); > > 364 if (ret) > > 365 goto out_free; > > 366 > > 367 ret =3D event_trigger_set_filter(cmd_ops, file, filter,= trigger_data); > > 368 if (ret < 0) > > 369 goto out_free; > > 370 > > 371 ret =3D event_trigger_register(cmd_ops, file, glob, tri= gger_data); > > 372 if (ret) > > 373 goto out_free; > > 374 > > 375 return ret; > > 376 > > 377 out_free: > > 378 event_trigger_reset_filter(cmd_ops, trigger_data); > > 379 kfree(obj_data); > > 380 kfree(trigger_data); > > 381 return ret; > > 382 } > > 383 > > > > -- > > 0-DAY CI Kernel Test Service > > https://01.org/lkp > = > Thanks, > JeffXie >=20 --===============2776556169187177333==--