Re: [PATCH DRAFT 1/4] : tracefs: port to kernfs

From: kernel test robot
Date: Wed Jan 31 2024 - 19:38:59 EST


Hi Christian,

kernel test robot noticed the following build errors:

[auto build test ERROR on 41bccc98fb7931d63d03f326a746ac4d429c1dd3]

url: https://github.com/intel-lab-lkp/linux/commits/Christian-Brauner/tracefs-port-to-kernfs/20240131-214120
base: 41bccc98fb7931d63d03f326a746ac4d429c1dd3
patch link: https://lore.kernel.org/r/20240131-tracefs-kernfs-v1-1-f20e2e9a8d61%40kernel.org
patch subject: [PATCH DRAFT 1/4] : tracefs: port to kernfs
config: arc-randconfig-001-20240201 (https://download.01.org/0day-ci/archive/20240201/202402010834.J85Qu3eN-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240201/202402010834.J85Qu3eN-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402010834.J85Qu3eN-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

kernel/trace/trace_hwlat.c: In function 'init_tracefs':
kernel/trace/trace_hwlat.c:778:17: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
778 | top_dir = tracefs_create_dir("hwlat_detector", NULL);
| ^
>> kernel/trace/trace_hwlat.c:783:51: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
783 | top_dir,
| ^~~~~~~
| |
| struct dentry *
In file included from kernel/trace/trace_hwlat.c:41:
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_hwlat.c:785:51: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
785 | &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
include/linux/tracefs.h:94:66: note: expected 'const struct kernfs_ops *' but argument is of type 'const struct file_operations *'
94 | const struct kernfs_ops *ops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/trace/trace_hwlat.c:782:29: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
782 | hwlat_sample_window = tracefs_create_file("window", TRACE_MODE_WRITE,
| ^
kernel/trace/trace_hwlat.c:790:50: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
790 | top_dir,
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_hwlat.c:792:50: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
792 | &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
include/linux/tracefs.h:94:66: note: expected 'const struct kernfs_ops *' but argument is of type 'const struct file_operations *'
94 | const struct kernfs_ops *ops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/trace/trace_hwlat.c:789:28: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
789 | hwlat_sample_width = tracefs_create_file("width", TRACE_MODE_WRITE,
| ^
kernel/trace/trace_hwlat.c:806:24: error: passing argument 1 of 'tracefs_remove' from incompatible pointer type [-Werror=incompatible-pointer-types]
806 | tracefs_remove(top_dir);
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:99:41: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
99 | void tracefs_remove(struct kernfs_node *kn);
| ~~~~~~~~~~~~~~~~~~~~^~
cc1: some warnings being treated as errors
--
kernel/trace/trace_osnoise.c: In function 'init_timerlat_stack_tracefs':
kernel/trace/trace_osnoise.c:2695:68: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2695 | tmp = tracefs_create_file("print_stack", TRACE_MODE_WRITE, top_dir,
| ^~~~~~~
| |
| struct dentry *
In file included from kernel/trace/trace_osnoise.c:20:
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2696:57: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2696 | &osnoise_print_stack, &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
include/linux/tracefs.h:94:66: note: expected 'const struct kernfs_ops *' but argument is of type 'const struct file_operations *'
94 | const struct kernfs_ops *ops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/trace/trace_osnoise.c:2695:13: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2695 | tmp = tracefs_create_file("print_stack", TRACE_MODE_WRITE, top_dir,
| ^
kernel/trace/trace_osnoise.c: In function 'osnoise_create_cpu_timerlat_fd':
>> kernel/trace/trace_osnoise.c:2723:49: error: passing argument 2 of 'tracefs_create_dir' from incompatible pointer type [-Werror=incompatible-pointer-types]
2723 | per_cpu = tracefs_create_dir("per_cpu", top_dir);
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:97:60: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
97 | struct kernfs_node *parent);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2723:17: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2723 | per_cpu = tracefs_create_dir("per_cpu", top_dir);
| ^
kernel/trace/trace_osnoise.c:2729:55: error: passing argument 2 of 'tracefs_create_dir' from incompatible pointer type [-Werror=incompatible-pointer-types]
2729 | cpu_dir = tracefs_create_dir(cpu_str, per_cpu);
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:97:60: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
97 | struct kernfs_node *parent);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2729:25: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2729 | cpu_dir = tracefs_create_dir(cpu_str, per_cpu);
| ^
kernel/trace/trace_osnoise.c:2745:24: error: passing argument 1 of 'tracefs_remove' from incompatible pointer type [-Werror=incompatible-pointer-types]
2745 | tracefs_remove(per_cpu);
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:99:41: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
99 | void tracefs_remove(struct kernfs_node *kn);
| ~~~~~~~~~~~~~~~~~~~~^~
kernel/trace/trace_osnoise.c: In function 'init_timerlat_tracefs':
kernel/trace/trace_osnoise.c:2757:75: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2757 | tmp = tracefs_create_file("timerlat_period_us", TRACE_MODE_WRITE, top_dir,
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2758:53: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2758 | &timerlat_period, &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
include/linux/tracefs.h:94:66: note: expected 'const struct kernfs_ops *' but argument is of type 'const struct file_operations *'
94 | const struct kernfs_ops *ops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/trace/trace_osnoise.c:2757:13: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2757 | tmp = tracefs_create_file("timerlat_period_us", TRACE_MODE_WRITE, top_dir,
| ^
kernel/trace/trace_osnoise.c: In function 'init_tracefs':
kernel/trace/trace_osnoise.c:2792:17: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2792 | top_dir = tracefs_create_dir("osnoise", NULL);
| ^
kernel/trace/trace_osnoise.c:2796:66: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2796 | tmp = tracefs_create_file("period_us", TRACE_MODE_WRITE, top_dir,
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2797:52: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2797 | &osnoise_period, &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
include/linux/tracefs.h:94:66: note: expected 'const struct kernfs_ops *' but argument is of type 'const struct file_operations *'
94 | const struct kernfs_ops *ops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/trace/trace_osnoise.c:2796:13: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2796 | tmp = tracefs_create_file("period_us", TRACE_MODE_WRITE, top_dir,
| ^
kernel/trace/trace_osnoise.c:2801:67: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2801 | tmp = tracefs_create_file("runtime_us", TRACE_MODE_WRITE, top_dir,
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2802:53: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2802 | &osnoise_runtime, &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
include/linux/tracefs.h:94:66: note: expected 'const struct kernfs_ops *' but argument is of type 'const struct file_operations *'
94 | const struct kernfs_ops *ops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/trace/trace_osnoise.c:2801:13: error: assignment to 'struct dentry *' from incompatible pointer type 'struct kernfs_node *' [-Werror=incompatible-pointer-types]
2801 | tmp = tracefs_create_file("runtime_us", TRACE_MODE_WRITE, top_dir,
| ^
kernel/trace/trace_osnoise.c:2806:72: error: passing argument 3 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
2806 | tmp = tracefs_create_file("stop_tracing_us", TRACE_MODE_WRITE, top_dir,
| ^~~~~~~
| |
| struct dentry *
include/linux/tracefs.h:93:61: note: expected 'struct kernfs_node *' but argument is of type 'struct dentry *'
93 | struct kernfs_node *parent, void *data,
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_osnoise.c:2807:61: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]


vim +/tracefs_create_file +783 kernel/trace/trace_hwlat.c

e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 753)
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 754 static const struct file_operations thread_mode_fops = {
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 755 .open = hwlat_mode_open,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 756 .read = seq_read,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 757 .llseek = seq_lseek,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 758 .release = seq_release,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 759 .write = hwlat_mode_write
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 760 };
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 761) /**
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 762) * init_tracefs - A function to initialize the tracefs interface files
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 763) *
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 764) * This function creates entries in tracefs for "hwlat_detector".
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 765) * It creates the hwlat_detector directory in the tracing directory,
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 766) * and within that directory is the count, width and window files to
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 767) * change and view those values.
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 768) */
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 769) static int init_tracefs(void)
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 770) {
22c36b18263426 Wei Yang 2020-07-12 771 int ret;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 772) struct dentry *top_dir;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 773)
22c36b18263426 Wei Yang 2020-07-12 774 ret = tracing_init_dentry();
22c36b18263426 Wei Yang 2020-07-12 775 if (ret)
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 776) return -ENOMEM;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 777)
22c36b18263426 Wei Yang 2020-07-12 778 top_dir = tracefs_create_dir("hwlat_detector", NULL);
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 779) if (!top_dir)
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 780) return -ENOMEM;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 781)
21ccc9cd721162 Steven Rostedt (VMware 2021-08-18 782) hwlat_sample_window = tracefs_create_file("window", TRACE_MODE_WRITE,
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 @783) top_dir,
f27a1c9e1ba1e4 Daniel Bristot de Oliveira 2021-06-22 784 &hwlat_window,
f27a1c9e1ba1e4 Daniel Bristot de Oliveira 2021-06-22 785 &trace_min_max_fops);
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 786) if (!hwlat_sample_window)
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 787) goto err;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 788)
21ccc9cd721162 Steven Rostedt (VMware 2021-08-18 789) hwlat_sample_width = tracefs_create_file("width", TRACE_MODE_WRITE,
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 790) top_dir,
f27a1c9e1ba1e4 Daniel Bristot de Oliveira 2021-06-22 791 &hwlat_width,
f27a1c9e1ba1e4 Daniel Bristot de Oliveira 2021-06-22 792 &trace_min_max_fops);
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 793) if (!hwlat_sample_width)
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 794) goto err;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 795)
21ccc9cd721162 Steven Rostedt (VMware 2021-08-18 796) hwlat_thread_mode = trace_create_file("mode", TRACE_MODE_WRITE,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 797 top_dir,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 798 NULL,
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 799 &thread_mode_fops);
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 800 if (!hwlat_thread_mode)
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 801 goto err;
8fa826b7344d67 Daniel Bristot de Oliveira 2021-06-22 802
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 803) return 0;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 804)
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 805) err:
a3d1e7eb5abe3a Al Viro 2019-11-18 806 tracefs_remove(top_dir);
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 807) return -ENOMEM;
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 808) }
e7c15cd8a11333 Steven Rostedt (Red Hat 2016-06-23 809)

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki