Content-Type: multipart/mixed; boundary="===============0340584915554299741==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 2/2] scsi:target:tcmu: reduce once copy by using uio ioctl Date: Thu, 17 Feb 2022 16:07:28 +0800 Message-ID: <202202171541.grdjAOIT-lkp@intel.com> In-Reply-To: <1645064962-94123-2-git-send-email-kanie@linux.alibaba.com> List-Id: --===============0340584915554299741== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Guixin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on mkp-scsi/for-next linux/master linus/master v5.= 17-rc4 next-20220216] [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] url: https://github.com/0day-ci/linux/commits/Guixin-Liu/uio-add-ioctl-t= o-uio/20220217-103120 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.gi= t e6cb9c167eeb8f90ab924666c573e69e85e700a0 config: riscv-randconfig-r042-20220217 (https://download.01.org/0day-ci/arc= hive/20220217/202202171541.grdjAOIT-lkp(a)intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0bad7c= b56526f2572c74449fcf97c1fcda42b41d) reproduce (this is a W=3D1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/c604d03c2be8ca4b3533bb151= bcd2d10379debff git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Guixin-Liu/uio-add-ioctl-to-uio/20= 220217-103120 git checkout c604d03c2be8ca4b3533bb151bcd2d10379debff # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W=3D= 1 O=3Dbuild_dir ARCH=3Driscv SHELL=3D/bin/bash drivers/target/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/target/target_core_user.c:1987:6: warning: no previous prototype= for function 'tcmu_ioctl_copy_between_sgl_and_iovec' [-Wmissing-prototypes] long tcmu_ioctl_copy_between_sgl_and_iovec(struct tcmu_cmd *tcmu_cmd, ^ drivers/target/target_core_user.c:1987:1: note: declare 'static' if the = function is not intended to be used outside of this translation unit long tcmu_ioctl_copy_between_sgl_and_iovec(struct tcmu_cmd *tcmu_cmd, ^ static = >> drivers/target/target_core_user.c:2031:6: warning: no previous prototype= for function 'tcmu_ioctl' [-Wmissing-prototypes] long tcmu_ioctl(struct uio_info *info, unsigned int cmd, unsigned long a= rg) ^ drivers/target/target_core_user.c:2031:1: note: declare 'static' if the = function is not intended to be used outside of this translation unit long tcmu_ioctl(struct uio_info *info, unsigned int cmd, unsigned long a= rg) ^ static = 2 warnings generated. vim +/tcmu_ioctl_copy_between_sgl_and_iovec +1987 drivers/target/target_cor= e_user.c 1986 = > 1987 long tcmu_ioctl_copy_between_sgl_and_iovec(struct tcmu_cmd *tcmu_cmd, 1988 struct iovec __user *uiovec, 1989 unsigned long vcnt, 1990 bool is_copy_to_sgl) 1991 { 1992 struct iovec iovstack[UIO_FASTIOV]; 1993 struct iovec *iov =3D iovstack; 1994 struct iov_iter iter; 1995 ssize_t ret; 1996 struct se_cmd *se_cmd =3D tcmu_cmd->se_cmd; 1997 struct scatterlist *data_sg, *sg; 1998 int i; 1999 unsigned int data_nents; 2000 long copy_ret =3D 0; 2001 = 2002 if (se_cmd->se_cmd_flags & SCF_BIDI) { 2003 data_sg =3D se_cmd->t_bidi_data_sg; 2004 data_nents =3D se_cmd->t_bidi_data_nents; 2005 } else { 2006 data_sg =3D se_cmd->t_data_sg; 2007 data_nents =3D se_cmd->t_data_nents; 2008 } 2009 = 2010 ret =3D import_iovec(READ, uiovec, vcnt, ARRAY_SIZE(iovstack), &iov= , &iter); 2011 if (ret < 0) { 2012 pr_err("import iovec failed.\n"); 2013 return -EFAULT; 2014 } 2015 = 2016 for_each_sg(data_sg, sg, data_nents, i) { 2017 if (is_copy_to_sgl) 2018 ret =3D copy_page_from_iter(sg_page(sg), sg->offset, sg->length, = &iter); 2019 else 2020 ret =3D copy_page_to_iter(sg_page(sg), sg->offset, sg->length, &i= ter); 2021 if (ret < 0) { 2022 pr_err("copy failed.\n"); 2023 copy_ret =3D -EFAULT; 2024 break; 2025 } 2026 } 2027 kfree(iov); 2028 return copy_ret; 2029 } 2030 = > 2031 long tcmu_ioctl(struct uio_info *info, unsigned int cmd, unsigned lo= ng arg) 2032 { 2033 struct tcmu_dev *udev =3D container_of(info, struct tcmu_dev, uio_i= nfo); 2034 struct tcmu_data_xfer __user *uxfer =3D (struct tcmu_data_xfer __us= er *)arg; 2035 struct tcmu_data_xfer xfer; 2036 struct tcmu_cmd *tcmu_cmd; 2037 = 2038 if (!test_bit(TCMU_DEV_BIT_BYPASS_DATA_AREA, &udev->flags)) 2039 return -EINVAL; 2040 = 2041 if (copy_from_user(&xfer, uxfer, sizeof(xfer))) 2042 return -EFAULT; 2043 = 2044 tcmu_cmd =3D xa_load(&udev->commands, xfer.cmd_id); 2045 if (!tcmu_cmd) { 2046 set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags); 2047 return -EFAULT; 2048 } 2049 = 2050 if (test_bit(TCMU_CMD_BIT_EXPIRED, &tcmu_cmd->flags)) 2051 return -EFAULT; 2052 = 2053 switch (cmd) { 2054 case TCMU_IOCTL_CMD_COPY_TO_SGL: 2055 return tcmu_ioctl_copy_between_sgl_and_iovec(tcmu_cmd, xfer.iovec, 2056 xfer.iov_cnt, true); 2057 case TCMU_IOCTL_CMD_COPY_FROM_SGL: 2058 return tcmu_ioctl_copy_between_sgl_and_iovec(tcmu_cmd, xfer.iovec, 2059 xfer.iov_cnt, false); 2060 default: 2061 return -EINVAL; 2062 } 2063 } 2064 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============0340584915554299741==--