Re: [PATCH DRAFT 3/4] : hwlat: port struct file_operations thread_mode_fops to struct kernfs_ops

From: kernel test robot
Date: Wed Jan 31 2024 - 22:31:46 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-3-f20e2e9a8d61%40kernel.org
patch subject: [PATCH DRAFT 3/4] : hwlat: port struct file_operations thread_mode_fops to struct kernfs_ops
config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20240201/202402011108.V2Y9QaTk-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240201/202402011108.V2Y9QaTk-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/202402011108.V2Y9QaTk-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

kernel/trace/trace_hwlat.c: In function 'hwlat_mode_write':
kernel/trace/trace_hwlat.c:672:14: error: 'buf' redeclared as different kind of symbol
672 | char buf[64];
| ^~~
kernel/trace/trace_hwlat.c:667:68: note: previous definition of 'buf' with type 'char *'
667 | static ssize_t hwlat_mode_write(struct kernfs_open_file *of, char *buf,
| ~~~~~~^~~
kernel/trace/trace_hwlat.c:672:14: warning: unused variable 'buf' [-Wunused-variable]
672 | char buf[64];
| ^~~
kernel/trace/trace_hwlat.c: At top level:
kernel/trace/trace_hwlat.c:736:10: error: 'const struct kernfs_ops' has no member named 'start'
736 | .start = s_mode_start,
| ^~~~~
kernel/trace/trace_hwlat.c:736:9: warning: the address of 's_mode_start' will always evaluate as 'true' [-Waddress]
736 | .start = s_mode_start,
| ^
kernel/trace/trace_hwlat.c:737:10: error: 'const struct kernfs_ops' has no member named 'next'
737 | .next = s_mode_next,
| ^~~~
>> kernel/trace/trace_hwlat.c:737:35: error: initialization of 'ssize_t (*)(struct kernfs_open_file *, char *, size_t, loff_t)' {aka 'long int (*)(struct kernfs_open_file *, char *, long unsigned int, long long int)'} from incompatible pointer type 'void * (*)(struct seq_file *, void *, loff_t *)' {aka 'void * (*)(struct seq_file *, void *, long long int *)'} [-Werror=incompatible-pointer-types]
737 | .next = s_mode_next,
| ^~~~~~~~~~~
kernel/trace/trace_hwlat.c:737:35: note: (near initialization for 'thread_mode_fops.write')
kernel/trace/trace_hwlat.c:738:10: error: 'const struct kernfs_ops' has no member named 'show'
738 | .show = s_mode_show,
| ^~~~
kernel/trace/trace_hwlat.c:738:35: error: initialization of '__poll_t (*)(struct kernfs_open_file *, struct poll_table_struct *)' {aka 'unsigned int (*)(struct kernfs_open_file *, struct poll_table_struct *)'} from incompatible pointer type 'int (*)(struct seq_file *, void *)' [-Werror=incompatible-pointer-types]
738 | .show = s_mode_show,
| ^~~~~~~~~~~
kernel/trace/trace_hwlat.c:738:35: note: (near initialization for 'thread_mode_fops.poll')
kernel/trace/trace_hwlat.c:739:10: error: 'const struct kernfs_ops' has no member named 'stop'
739 | .stop = s_mode_stop,
| ^~~~
kernel/trace/trace_hwlat.c:739:35: error: initialization of 'int (*)(struct kernfs_open_file *, struct vm_area_struct *)' from incompatible pointer type 'void (*)(struct seq_file *, void *)' [-Werror=incompatible-pointer-types]
739 | .stop = s_mode_stop,
| ^~~~~~~~~~~
kernel/trace/trace_hwlat.c:739:35: note: (near initialization for 'thread_mode_fops.mmap')
kernel/trace/trace_hwlat.c:740:35: warning: initialized field overwritten [-Woverride-init]
740 | .write = hwlat_mode_write,
| ^~~~~~~~~~~~~~~~
kernel/trace/trace_hwlat.c:740:35: note: (near initialization for 'thread_mode_fops.write')
kernel/trace/trace_hwlat.c: In function 'init_tracefs':
kernel/trace/trace_hwlat.c:766:51: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
766 | &trace_min_max_fops);
| ^~~~~~~~~~~~~~~~~~~
| |
| const struct file_operations *
In file included from kernel/trace/trace_hwlat.c:41:
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:773:50: error: passing argument 5 of 'tracefs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
773 | &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:778:47: error: passing argument 3 of 'trace_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
778 | top_dir,
| ^~~~~~~
| |
| struct kernfs_node *
In file included from kernel/trace/trace_hwlat.c:46:
kernel/trace/trace.h:629:49: note: expected 'struct dentry *' but argument is of type 'struct kernfs_node *'
629 | struct dentry *parent,
| ~~~~~~~~~~~~~~~^~~~~~
kernel/trace/trace_hwlat.c:780:47: error: passing argument 5 of 'trace_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
780 | &thread_mode_fops);
| ^~~~~~~~~~~~~~~~~
| |
| const struct kernfs_ops *
kernel/trace/trace.h:631:64: note: expected 'const struct file_operations *' but argument is of type 'const struct kernfs_ops *'
631 | const struct file_operations *fops);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
kernel/trace/trace_hwlat.c:777:27: error: assignment to 'struct kernfs_node *' from incompatible pointer type 'struct dentry *' [-Werror=incompatible-pointer-types]
777 | hwlat_thread_mode = trace_create_file("mode", TRACE_MODE_WRITE,
| ^
cc1: some warnings being treated as errors


vim +737 kernel/trace/trace_hwlat.c

733
734 static const struct kernfs_ops thread_mode_fops = {
735 .atomic_write_len = PAGE_SIZE,
736 .start = s_mode_start,
> 737 .next = s_mode_next,
738 .show = s_mode_show,
739 .stop = s_mode_stop,
740 .write = hwlat_mode_write,
741 };
742 /**
743 * init_tracefs - A function to initialize the tracefs interface files
744 *
745 * This function creates entries in tracefs for "hwlat_detector".
746 * It creates the hwlat_detector directory in the tracing directory,
747 * and within that directory is the count, width and window files to
748 * change and view those values.
749 */
750 static int init_tracefs(void)
751 {
752 int ret;
753 struct kernfs_node *top_dir;
754
755 ret = tracing_init_dentry();
756 if (ret)
757 return -ENOMEM;
758
759 top_dir = tracefs_create_dir("hwlat_detector", NULL);
760 if (!top_dir)
761 return -ENOMEM;
762
763 hwlat_sample_window = tracefs_create_file("window", TRACE_MODE_WRITE,
764 top_dir,
765 &hwlat_window,
766 &trace_min_max_fops);
767 if (!hwlat_sample_window)
768 goto err;
769
770 hwlat_sample_width = tracefs_create_file("width", TRACE_MODE_WRITE,
771 top_dir,
772 &hwlat_width,
773 &trace_min_max_fops);
774 if (!hwlat_sample_width)
775 goto err;
776
777 hwlat_thread_mode = trace_create_file("mode", TRACE_MODE_WRITE,
778 top_dir,
779 NULL,
780 &thread_mode_fops);
781 if (!hwlat_thread_mode)
782 goto err;
783
784 return 0;
785
786 err:
787 tracefs_remove(top_dir);
788 return -ENOMEM;
789 }
790

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