Message ID | 20241107110149.890530-12-ming.lei@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | io_uring: support group buffer & ublk zc | expand |
Hi Ming, kernel test robot noticed the following build errors: [auto build test ERROR on axboe-block/for-next] [also build test ERROR on next-20241107] [cannot apply to linus/master v6.12-rc6] [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/Ming-Lei/io_uring-rsrc-pass-struct-io_ring_ctx-reference-to-rsrc-helpers/20241107-190456 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/r/20241107110149.890530-12-ming.lei%40redhat.com patch subject: [PATCH V10 11/12] io_uring/uring_cmd: support leasing device kernel buffer to io_uring config: arc-randconfig-001-20241108 (https://download.01.org/0day-ci/archive/20241108/202411080218.NHuzJ77W-lkp@intel.com/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241108/202411080218.NHuzJ77W-lkp@intel.com/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@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202411080218.NHuzJ77W-lkp@intel.com/ All error/warnings (new ones prefixed by >>): In file included from block/fops.c:20: >> include/linux/io_uring/cmd.h:89:1: error: expected identifier or '(' before '{' token 89 | { | ^ >> include/linux/io_uring/cmd.h:87:19: warning: 'io_uring_cmd_lease_kbuf' declared 'static' but never defined [-Wunused-function] 87 | static inline int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, | ^~~~~~~~~~~~~~~~~~~~~~~ vim +89 include/linux/io_uring/cmd.h 62 63 int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, 64 struct io_rsrc_node *node); 65 #else 66 static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, 67 struct iov_iter *iter, void *ioucmd) 68 { 69 return -EOPNOTSUPP; 70 } 71 static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, 72 ssize_t ret2, unsigned issue_flags) 73 { 74 } 75 static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, 76 void (*task_work_cb)(struct io_uring_cmd *, unsigned), 77 unsigned flags) 78 { 79 } 80 static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, 81 unsigned int issue_flags) 82 { 83 } 84 static inline void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd) 85 { 86 } > 87 static inline int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, 88 struct io_rsrc_node *node); > 89 { 90 return -EOPNOTSUPP; 91 } 92 #endif 93
Hi Ming, kernel test robot noticed the following build errors: [auto build test ERROR on axboe-block/for-next] [also build test ERROR on next-20241107] [cannot apply to linus/master v6.12-rc6] [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/Ming-Lei/io_uring-rsrc-pass-struct-io_ring_ctx-reference-to-rsrc-helpers/20241107-190456 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/r/20241107110149.890530-12-ming.lei%40redhat.com patch subject: [PATCH V10 11/12] io_uring/uring_cmd: support leasing device kernel buffer to io_uring config: arm64-randconfig-001-20241108 (https://download.01.org/0day-ci/archive/20241108/202411080354.5JXKXPEW-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241108/202411080354.5JXKXPEW-lkp@intel.com/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@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202411080354.5JXKXPEW-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from block/ioctl.c:4: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:8: In file included from include/linux/cacheflush.h:5: In file included from arch/arm64/include/asm/cacheflush.h:11: In file included from include/linux/kgdb.h:19: In file included from include/linux/kprobes.h:28: In file included from include/linux/ftrace.h:13: In file included from include/linux/kallsyms.h:13: In file included from include/linux/mm.h:2213: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 505 | item]; | ~~~~ include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 512 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ In file included from block/ioctl.c:15: >> include/linux/io_uring/cmd.h:89:1: error: expected identifier or '(' 89 | { | ^ 3 warnings and 1 error generated. vim +89 include/linux/io_uring/cmd.h 62 63 int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, 64 struct io_rsrc_node *node); 65 #else 66 static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, 67 struct iov_iter *iter, void *ioucmd) 68 { 69 return -EOPNOTSUPP; 70 } 71 static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, 72 ssize_t ret2, unsigned issue_flags) 73 { 74 } 75 static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, 76 void (*task_work_cb)(struct io_uring_cmd *, unsigned), 77 unsigned flags) 78 { 79 } 80 static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, 81 unsigned int issue_flags) 82 { 83 } 84 static inline void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd) 85 { 86 } 87 static inline int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, 88 struct io_rsrc_node *node); > 89 { 90 return -EOPNOTSUPP; 91 } 92 #endif 93
On Thu, Nov 7, 2024 at 7:02 PM Ming Lei <ming.lei@redhat.com> wrote: > > Add API of io_uring_cmd_lease_kbuf() for driver to lease its kernel > buffer to io_uring. > > The leased buffer can only be consumed by io_uring OPs in group wide, > and the uring_cmd has to be one group leader. > > This way can support generic device zero copy over device buffer in > userspace: > > - create one sqe group > - lease one device buffer to io_uring by the group leader of uring_cmd > - io_uring member OPs consume this kernel buffer by passing IOSQE_IO_DRAIN > which isn't used for group member, and mapped to GROUP_BUF. > - the kernel buffer is returned back after all member OPs are completed > > Signed-off-by: Ming Lei <ming.lei@redhat.com> > --- > include/linux/io_uring/cmd.h | 7 +++++++ > io_uring/uring_cmd.c | 10 ++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h > index 578a3fdf5c71..0997ea247188 100644 > --- a/include/linux/io_uring/cmd.h > +++ b/include/linux/io_uring/cmd.h > @@ -60,6 +60,8 @@ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, > /* Execute the request from a blocking context */ > void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd); > > +int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, > + struct io_rsrc_node *node); > #else > static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, > struct iov_iter *iter, void *ioucmd) > @@ -82,6 +84,11 @@ static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, > static inline void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd) > { > } > +static inline int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, > + struct io_rsrc_node *node); ops, the above ";" needs to be removed, :-( > +{ > + return -EOPNOTSUPP; > +} > #endif
diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h index 578a3fdf5c71..0997ea247188 100644 --- a/include/linux/io_uring/cmd.h +++ b/include/linux/io_uring/cmd.h @@ -60,6 +60,8 @@ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, /* Execute the request from a blocking context */ void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd); +int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, + struct io_rsrc_node *node); #else static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, struct iov_iter *iter, void *ioucmd) @@ -82,6 +84,11 @@ static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, static inline void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd) { } +static inline int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, + struct io_rsrc_node *node); +{ + return -EOPNOTSUPP; +} #endif /* diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index b62965f58f30..e7723759cb23 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -15,6 +15,7 @@ #include "alloc_cache.h" #include "rsrc.h" #include "uring_cmd.h" +#include "kbuf.h" static struct uring_cache *io_uring_async_get(struct io_kiocb *req) { @@ -175,6 +176,15 @@ void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t res2, } EXPORT_SYMBOL_GPL(io_uring_cmd_done); +int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd, + struct io_rsrc_node *node) +{ + struct io_kiocb *req = cmd_to_io_kiocb(ioucmd); + + return io_lease_group_kbuf(req, node); +} +EXPORT_SYMBOL_GPL(io_uring_cmd_lease_kbuf); + static int io_uring_cmd_prep_setup(struct io_kiocb *req, const struct io_uring_sqe *sqe) {
Add API of io_uring_cmd_lease_kbuf() for driver to lease its kernel buffer to io_uring. The leased buffer can only be consumed by io_uring OPs in group wide, and the uring_cmd has to be one group leader. This way can support generic device zero copy over device buffer in userspace: - create one sqe group - lease one device buffer to io_uring by the group leader of uring_cmd - io_uring member OPs consume this kernel buffer by passing IOSQE_IO_DRAIN which isn't used for group member, and mapped to GROUP_BUF. - the kernel buffer is returned back after all member OPs are completed Signed-off-by: Ming Lei <ming.lei@redhat.com> --- include/linux/io_uring/cmd.h | 7 +++++++ io_uring/uring_cmd.c | 10 ++++++++++ 2 files changed, 17 insertions(+)