2023-05-23 09:33:25

by lingfuyi

[permalink] [raw]
Subject: [PATCH] io_uring: fix compile error when CONFIG_IO_URING not set

when compile with ARCH=mips CROSS_COMPILE=mips-linux-gnu- , and CONFIG_IO_URING
is not set , compile will case some error like this:
drivers/nvme/host/ioctl.c:555:37: error: initialization of
‘const struct nvme_uring_cmd *’ from ‘int’ makes pointer from
integer without a cast [-Werror=int-conversion]

Reported-by: k2ci <[email protected]>
Signed-off-by: lingfuyi <[email protected]>
---
include/linux/io_uring.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h
index 7fe31b2cd02f..c76809f59617 100644
--- a/include/linux/io_uring.h
+++ b/include/linux/io_uring.h
@@ -98,6 +98,10 @@ static inline void io_uring_files_cancel(void)
static inline void io_uring_free(struct task_struct *tsk)
{
}
+static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
+{
+ return NULL;
+}
static inline const char *io_uring_get_opcode(u8 opcode)
{
return "";
--
2.20.1



2023-05-23 17:31:53

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] io_uring: fix compile error when CONFIG_IO_URING not set

On 5/23/23 3:26 AM, lingfuyi wrote:
> when compile with ARCH=mips CROSS_COMPILE=mips-linux-gnu- , and CONFIG_IO_URING
> is not set , compile will case some error like this:
> drivers/nvme/host/ioctl.c:555:37: error: initialization of
> ‘const struct nvme_uring_cmd *’ from ‘int’ makes pointer from
> integer without a cast [-Werror=int-conversion]

This was fixed weeks ago:

https://git.kernel.dk/cgit/linux/commit/?h=io_uring-6.4&id=293007b033418c8c9d1b35d68dec49a500750fde

and is also in 6.4 since -rc2.

--
Jens Axboe



2023-05-24 01:20:13

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] io_uring: fix compile error when CONFIG_IO_URING not set

Hi lingfuyi,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.4-rc3 next-20230523]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/lingfuyi/io_uring-fix-compile-error-when-CONFIG_IO_URING-not-set/20230523-195542
base: linus/master
patch link: https://lore.kernel.org/r/20230523092629.3402710-1-lingfuyi%40126.com
patch subject: [PATCH] io_uring: fix compile error when CONFIG_IO_URING not set
config: x86_64-randconfig-x083-20230522
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/82c556d20b38c439dafca8e7256eeba39980b58b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review lingfuyi/io_uring-fix-compile-error-when-CONFIG_IO_URING-not-set/20230523-195542
git checkout 82c556d20b38c439dafca8e7256eeba39980b58b
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from net/unix/scm.c:11:
>> include/linux/io_uring.h:101:27: error: redefinition of 'io_uring_sqe_cmd'
101 | static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
| ^~~~~~~~~~~~~~~~
include/linux/io_uring.h:39:27: note: previous definition of 'io_uring_sqe_cmd' with type 'const void *(const struct io_uring_sqe *)'
39 | static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
| ^~~~~~~~~~~~~~~~
--
In file included from kernel/exit.c:67:
>> include/linux/io_uring.h:101:27: error: redefinition of 'io_uring_sqe_cmd'
101 | static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
| ^~~~~~~~~~~~~~~~
include/linux/io_uring.h:39:27: note: previous definition of 'io_uring_sqe_cmd' with type 'const void *(const struct io_uring_sqe *)'
39 | static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
| ^~~~~~~~~~~~~~~~
kernel/exit.c:1917:32: warning: no previous prototype for 'abort' [-Wmissing-prototypes]
1917 | __weak __function_aligned void abort(void)
| ^~~~~


vim +/io_uring_sqe_cmd +101 include/linux/io_uring.h

56
57 static inline void io_uring_files_cancel(void)
58 {
59 if (current->io_uring) {
60 io_uring_unreg_ringfd();
61 __io_uring_cancel(false);
62 }
63 }
64 static inline void io_uring_task_cancel(void)
65 {
66 if (current->io_uring)
67 __io_uring_cancel(true);
68 }
69 static inline void io_uring_free(struct task_struct *tsk)
70 {
71 if (tsk->io_uring)
72 __io_uring_free(tsk);
73 }
74 #else
75 static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
76 struct iov_iter *iter, void *ioucmd)
77 {
78 return -EOPNOTSUPP;
79 }
80 static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
81 ssize_t ret2, unsigned issue_flags)
82 {
83 }
84 static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
85 void (*task_work_cb)(struct io_uring_cmd *, unsigned))
86 {
87 }
88 static inline struct sock *io_uring_get_socket(struct file *file)
89 {
90 return NULL;
91 }
92 static inline void io_uring_task_cancel(void)
93 {
94 }
95 static inline void io_uring_files_cancel(void)
96 {
97 }
98 static inline void io_uring_free(struct task_struct *tsk)
99 {
100 }
> 101 static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
102 {
103 return NULL;
104 }
105 static inline const char *io_uring_get_opcode(u8 opcode)
106 {
107 return "";
108 }
109 #endif
110

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


Attachments:
(No filename) (4.58 kB)
config (155.77 kB)
Download all attachments

2023-05-24 04:13:23

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] io_uring: fix compile error when CONFIG_IO_URING not set

Hi lingfuyi,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.4-rc3 next-20230523]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/lingfuyi/io_uring-fix-compile-error-when-CONFIG_IO_URING-not-set/20230523-195542
base: linus/master
patch link: https://lore.kernel.org/r/20230523092629.3402710-1-lingfuyi%40126.com
patch subject: [PATCH] io_uring: fix compile error when CONFIG_IO_URING not set
config: i386-randconfig-i065-20230523
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/intel-lab-lkp/linux/commit/82c556d20b38c439dafca8e7256eeba39980b58b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review lingfuyi/io_uring-fix-compile-error-when-CONFIG_IO_URING-not-set/20230523-195542
git checkout 82c556d20b38c439dafca8e7256eeba39980b58b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from kernel/fork.c:97:
>> include/linux/io_uring.h:101:27: error: redefinition of 'io_uring_sqe_cmd'
static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
^
include/linux/io_uring.h:39:27: note: previous definition is here
static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
^
1 error generated.
--
In file included from kernel/exit.c:67:
>> include/linux/io_uring.h:101:27: error: redefinition of 'io_uring_sqe_cmd'
static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
^
include/linux/io_uring.h:39:27: note: previous definition is here
static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
^
kernel/exit.c:1917:32: warning: no previous prototype for function 'abort' [-Wmissing-prototypes]
__weak __function_aligned void abort(void)
^
kernel/exit.c:1917:27: note: declare 'static' if the function is not intended to be used outside of this translation unit
__weak __function_aligned void abort(void)
^
static
1 warning and 1 error generated.


vim +/io_uring_sqe_cmd +101 include/linux/io_uring.h

56
57 static inline void io_uring_files_cancel(void)
58 {
59 if (current->io_uring) {
60 io_uring_unreg_ringfd();
61 __io_uring_cancel(false);
62 }
63 }
64 static inline void io_uring_task_cancel(void)
65 {
66 if (current->io_uring)
67 __io_uring_cancel(true);
68 }
69 static inline void io_uring_free(struct task_struct *tsk)
70 {
71 if (tsk->io_uring)
72 __io_uring_free(tsk);
73 }
74 #else
75 static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
76 struct iov_iter *iter, void *ioucmd)
77 {
78 return -EOPNOTSUPP;
79 }
80 static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
81 ssize_t ret2, unsigned issue_flags)
82 {
83 }
84 static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
85 void (*task_work_cb)(struct io_uring_cmd *, unsigned))
86 {
87 }
88 static inline struct sock *io_uring_get_socket(struct file *file)
89 {
90 return NULL;
91 }
92 static inline void io_uring_task_cancel(void)
93 {
94 }
95 static inline void io_uring_files_cancel(void)
96 {
97 }
98 static inline void io_uring_free(struct task_struct *tsk)
99 {
100 }
> 101 static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
102 {
103 return NULL;
104 }
105 static inline const char *io_uring_get_opcode(u8 opcode)
106 {
107 return "";
108 }
109 #endif
110

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


Attachments:
(No filename) (4.91 kB)
config (168.49 kB)
Download all attachments