[PATCH v2 07/10] nvmet: add copy command support for bdev and file ns

kernel test robot lkp at intel.com
Mon Feb 7 12:12:34 PST 2022


Hi Nitesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on linus/master v5.17-rc3 next-20220207]
[cannot apply to device-mapper-dm/for-next]
[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/Nitesh-Shetty/block-make-bio_map_kern-non-static/20220207-231407
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: arm64-randconfig-r031-20220207 (https://download.01.org/0day-ci/archive/20220208/202202080346.u4ubCCIs-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0d8850ae2cae85d49bea6ae0799fa41c7202c05c)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/6bb6ea64499e1ac27975e79bb2eee89f07861893
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nitesh-Shetty/block-make-bio_map_kern-non-static/20220207-231407
        git checkout 6bb6ea64499e1ac27975e79bb2eee89f07861893
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/nvme/target/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/nvme/target/admin-cmd.c:534:15: warning: implicit conversion from '__le32' (aka 'unsigned int') to '__le16' (aka 'unsigned short') changes value from 2097152 to 0 [-Wconstant-conversion]
                   id->mssrl = cpu_to_le32(BIO_MAX_VECS << (PAGE_SHIFT - SECTOR_SHIFT));
                             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
   #define cpu_to_le32 __cpu_to_le32
                       ^
   include/uapi/linux/byteorder/big_endian.h:34:27: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +534 drivers/nvme/target/admin-cmd.c

   488	
   489	static void nvmet_execute_identify_ns(struct nvmet_req *req)
   490	{
   491		struct nvme_id_ns *id;
   492		u16 status;
   493	
   494		if (le32_to_cpu(req->cmd->identify.nsid) == NVME_NSID_ALL) {
   495			req->error_loc = offsetof(struct nvme_identify, nsid);
   496			status = NVME_SC_INVALID_NS | NVME_SC_DNR;
   497			goto out;
   498		}
   499	
   500		id = kzalloc(sizeof(*id), GFP_KERNEL);
   501		if (!id) {
   502			status = NVME_SC_INTERNAL;
   503			goto out;
   504		}
   505	
   506		/* return an all zeroed buffer if we can't find an active namespace */
   507		status = nvmet_req_find_ns(req);
   508		if (status) {
   509			status = 0;
   510			goto done;
   511		}
   512	
   513		nvmet_ns_revalidate(req->ns);
   514	
   515		/*
   516		 * nuse = ncap = nsze isn't always true, but we have no way to find
   517		 * that out from the underlying device.
   518		 */
   519		id->ncap = id->nsze =
   520			cpu_to_le64(req->ns->size >> req->ns->blksize_shift);
   521		switch (req->port->ana_state[req->ns->anagrpid]) {
   522		case NVME_ANA_INACCESSIBLE:
   523		case NVME_ANA_PERSISTENT_LOSS:
   524			break;
   525		default:
   526			id->nuse = id->nsze;
   527			break;
   528		}
   529	
   530		if (req->ns->bdev)
   531			nvmet_bdev_set_limits(req->ns->bdev, id);
   532		else {
   533			id->msrc = to0based(BIO_MAX_VECS);
 > 534			id->mssrl = cpu_to_le32(BIO_MAX_VECS << (PAGE_SHIFT - SECTOR_SHIFT));
   535			id->mcl = cpu_to_le64(le32_to_cpu(id->mssrl) * BIO_MAX_VECS);
   536		}
   537	
   538		/*
   539		 * We just provide a single LBA format that matches what the
   540		 * underlying device reports.
   541		 */
   542		id->nlbaf = 0;
   543		id->flbas = 0;
   544	
   545		/*
   546		 * Our namespace might always be shared.  Not just with other
   547		 * controllers, but also with any other user of the block device.
   548		 */
   549		id->nmic = NVME_NS_NMIC_SHARED;
   550		id->anagrpid = cpu_to_le32(req->ns->anagrpid);
   551	
   552		memcpy(&id->nguid, &req->ns->nguid, sizeof(id->nguid));
   553	
   554		id->lbaf[0].ds = req->ns->blksize_shift;
   555	
   556		if (req->sq->ctrl->pi_support && nvmet_ns_has_pi(req->ns)) {
   557			id->dpc = NVME_NS_DPC_PI_FIRST | NVME_NS_DPC_PI_LAST |
   558				  NVME_NS_DPC_PI_TYPE1 | NVME_NS_DPC_PI_TYPE2 |
   559				  NVME_NS_DPC_PI_TYPE3;
   560			id->mc = NVME_MC_EXTENDED_LBA;
   561			id->dps = req->ns->pi_type;
   562			id->flbas = NVME_NS_FLBAS_META_EXT;
   563			id->lbaf[0].ms = cpu_to_le16(req->ns->metadata_size);
   564		}
   565	
   566		if (req->ns->readonly)
   567			id->nsattr |= (1 << 0);
   568	done:
   569		if (!status)
   570			status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
   571	
   572		kfree(id);
   573	out:
   574		nvmet_req_complete(req, status);
   575	}
   576	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



More information about the Linux-nvme mailing list