Message ID | 20220207141348.4235-8-nj.shetty@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add Copy offload support | expand |
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: microblaze-buildonly-randconfig-r003-20220207 (https://download.01.org/0day-ci/archive/20220208/202202080206.J6kilCeY-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
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/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=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/nvme/target/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/byteorder/big_endian.h:5,
from arch/microblaze/include/uapi/asm/byteorder.h:8,
from include/asm-generic/bitops/le.h:6,
from include/asm-generic/bitops.h:35,
from ./arch/microblaze/include/generated/asm/bitops.h:1,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from include/asm-generic/div64.h:55,
from ./arch/microblaze/include/generated/asm/div64.h:1,
from include/linux/math.h:5,
from include/linux/math64.h:6,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/nvme/target/admin-cmd.c:7:
drivers/nvme/target/admin-cmd.c: In function 'nvmet_execute_identify_ns':
>> include/uapi/linux/byteorder/big_endian.h:34:26: warning: conversion from 'unsigned int' to '__le16' {aka 'short unsigned int'} changes value from '524288' to '0' [-Woverflow]
34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
| ^
include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
88 | #define cpu_to_le32 __cpu_to_le32
| ^~~~~~~~~~~~~
drivers/nvme/target/admin-cmd.c:534:29: note: in expansion of macro 'cpu_to_le32'
534 | id->mssrl = cpu_to_le32(BIO_MAX_VECS << (PAGE_SHIFT - SECTOR_SHIFT));
| ^~~~~~~~~~~
vim +34 include/uapi/linux/byteorder/big_endian.h
5921e6f8809b161 David Howells 2012-10-13 15
5921e6f8809b161 David Howells 2012-10-13 16 #define __constant_htonl(x) ((__force __be32)(__u32)(x))
5921e6f8809b161 David Howells 2012-10-13 17 #define __constant_ntohl(x) ((__force __u32)(__be32)(x))
5921e6f8809b161 David Howells 2012-10-13 18 #define __constant_htons(x) ((__force __be16)(__u16)(x))
5921e6f8809b161 David Howells 2012-10-13 19 #define __constant_ntohs(x) ((__force __u16)(__be16)(x))
5921e6f8809b161 David Howells 2012-10-13 20 #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
5921e6f8809b161 David Howells 2012-10-13 21 #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
5921e6f8809b161 David Howells 2012-10-13 22 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
5921e6f8809b161 David Howells 2012-10-13 23 #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
5921e6f8809b161 David Howells 2012-10-13 24 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
5921e6f8809b161 David Howells 2012-10-13 25 #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
5921e6f8809b161 David Howells 2012-10-13 26 #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8809b161 David Howells 2012-10-13 27 #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8809b161 David Howells 2012-10-13 28 #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8809b161 David Howells 2012-10-13 29 #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8809b161 David Howells 2012-10-13 30 #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8809b161 David Howells 2012-10-13 31 #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8809b161 David Howells 2012-10-13 32 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
5921e6f8809b161 David Howells 2012-10-13 33 #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
5921e6f8809b161 David Howells 2012-10-13 @34 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
5921e6f8809b161 David Howells 2012-10-13 35 #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
5921e6f8809b161 David Howells 2012-10-13 36 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
5921e6f8809b161 David Howells 2012-10-13 37 #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
5921e6f8809b161 David Howells 2012-10-13 38 #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8809b161 David Howells 2012-10-13 39 #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8809b161 David Howells 2012-10-13 40 #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8809b161 David Howells 2012-10-13 41 #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8809b161 David Howells 2012-10-13 42 #define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8809b161 David Howells 2012-10-13 43 #define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8809b161 David Howells 2012-10-13 44
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
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@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
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-20220209] [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-s032-20220207 (https://download.01.org/0day-ci/archive/20220210/202202101647.VtWTgalm-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 11.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-dirty # 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=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' 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@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/nvme/target/io-cmd-bdev.c:52:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] mcl @@ got restricted __le64 [usertype] @@ drivers/nvme/target/io-cmd-bdev.c:52:25: sparse: expected restricted __le32 [usertype] mcl drivers/nvme/target/io-cmd-bdev.c:52:25: sparse: got restricted __le64 [usertype] >> drivers/nvme/target/io-cmd-bdev.c:53:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] mssrl @@ got restricted __le32 [usertype] @@ drivers/nvme/target/io-cmd-bdev.c:53:27: sparse: expected restricted __le16 [usertype] mssrl drivers/nvme/target/io-cmd-bdev.c:53:27: sparse: got restricted __le32 [usertype] >> drivers/nvme/target/io-cmd-bdev.c:55:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [usertype] msrc @@ got restricted __le16 @@ drivers/nvme/target/io-cmd-bdev.c:55:26: sparse: expected unsigned char [usertype] msrc drivers/nvme/target/io-cmd-bdev.c:55:26: sparse: got restricted __le16 drivers/nvme/target/io-cmd-bdev.c:58:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [usertype] msrc @@ got restricted __le16 @@ drivers/nvme/target/io-cmd-bdev.c:58:34: sparse: expected unsigned char [usertype] msrc drivers/nvme/target/io-cmd-bdev.c:58:34: sparse: got restricted __le16 drivers/nvme/target/io-cmd-bdev.c:59:35: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] mssrl @@ got restricted __le32 [usertype] @@ drivers/nvme/target/io-cmd-bdev.c:59:35: sparse: expected restricted __le16 [usertype] mssrl drivers/nvme/target/io-cmd-bdev.c:59:35: sparse: got restricted __le32 [usertype] >> drivers/nvme/target/io-cmd-bdev.c:61:35: sparse: sparse: cast to restricted __le32 >> drivers/nvme/target/io-cmd-bdev.c:61:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:61:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] mcl @@ got restricted __le64 [usertype] @@ drivers/nvme/target/io-cmd-bdev.c:61:33: sparse: expected restricted __le32 [usertype] mcl drivers/nvme/target/io-cmd-bdev.c:61:33: sparse: got restricted __le64 [usertype] drivers/nvme/target/io-cmd-bdev.c:65:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [usertype] msrc @@ got restricted __le16 @@ drivers/nvme/target/io-cmd-bdev.c:65:34: sparse: expected unsigned char [usertype] msrc drivers/nvme/target/io-cmd-bdev.c:65:34: sparse: got restricted __le16 drivers/nvme/target/io-cmd-bdev.c:66:35: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] mssrl @@ got restricted __le32 [usertype] @@ drivers/nvme/target/io-cmd-bdev.c:66:35: sparse: expected restricted __le16 [usertype] mssrl drivers/nvme/target/io-cmd-bdev.c:66:35: sparse: got restricted __le32 [usertype] drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast to restricted __le32 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast to restricted __le32 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast to restricted __le32 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast to restricted __le32 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast to restricted __le32 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast to restricted __le32 drivers/nvme/target/io-cmd-bdev.c:68:35: sparse: sparse: cast from restricted __le16 drivers/nvme/target/io-cmd-bdev.c:68:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] mcl @@ got restricted __le64 [usertype] @@ drivers/nvme/target/io-cmd-bdev.c:68:33: sparse: expected restricted __le32 [usertype] mcl drivers/nvme/target/io-cmd-bdev.c:68:33: sparse: got restricted __le64 [usertype] -- >> drivers/nvme/target/admin-cmd.c:533:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [usertype] msrc @@ got restricted __le16 @@ drivers/nvme/target/admin-cmd.c:533:26: sparse: expected unsigned char [usertype] msrc drivers/nvme/target/admin-cmd.c:533:26: sparse: got restricted __le16 >> drivers/nvme/target/admin-cmd.c:534:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] mssrl @@ got restricted __le32 [usertype] @@ drivers/nvme/target/admin-cmd.c:534:27: sparse: expected restricted __le16 [usertype] mssrl drivers/nvme/target/admin-cmd.c:534:27: sparse: got restricted __le32 [usertype] >> drivers/nvme/target/admin-cmd.c:535:27: sparse: sparse: cast to restricted __le32 >> drivers/nvme/target/admin-cmd.c:535:27: sparse: sparse: cast from restricted __le16 >> drivers/nvme/target/admin-cmd.c:535:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] mcl @@ got restricted __le64 [usertype] @@ drivers/nvme/target/admin-cmd.c:535:25: sparse: expected restricted __le32 [usertype] mcl drivers/nvme/target/admin-cmd.c:535:25: sparse: got restricted __le64 [usertype] vim +52 drivers/nvme/target/io-cmd-bdev.c 11 12 void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) 13 { 14 const struct queue_limits *ql = &bdev_get_queue(bdev)->limits; 15 /* Number of logical blocks per physical block. */ 16 const u32 lpp = ql->physical_block_size / ql->logical_block_size; 17 /* Logical blocks per physical block, 0's based. */ 18 const __le16 lpp0b = to0based(lpp); 19 20 /* 21 * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN, 22 * NAWUPF, and NACWU are defined for this namespace and should be 23 * used by the host for this namespace instead of the AWUN, AWUPF, 24 * and ACWU fields in the Identify Controller data structure. If 25 * any of these fields are zero that means that the corresponding 26 * field from the identify controller data structure should be used. 27 */ 28 id->nsfeat |= 1 << 1; 29 id->nawun = lpp0b; 30 id->nawupf = lpp0b; 31 id->nacwu = lpp0b; 32 33 /* 34 * Bit 4 indicates that the fields NPWG, NPWA, NPDG, NPDA, and 35 * NOWS are defined for this namespace and should be used by 36 * the host for I/O optimization. 37 */ 38 id->nsfeat |= 1 << 4; 39 /* NPWG = Namespace Preferred Write Granularity. 0's based */ 40 id->npwg = lpp0b; 41 /* NPWA = Namespace Preferred Write Alignment. 0's based */ 42 id->npwa = id->npwg; 43 /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */ 44 id->npdg = to0based(ql->discard_granularity / ql->logical_block_size); 45 /* NPDG = Namespace Preferred Deallocate Alignment */ 46 id->npda = id->npdg; 47 /* NOWS = Namespace Optimal Write Size */ 48 id->nows = to0based(ql->io_opt / ql->logical_block_size); 49 50 /*Copy limits*/ 51 if (ql->max_copy_sectors) { > 52 id->mcl = cpu_to_le64((ql->max_copy_sectors << 9) / ql->logical_block_size); > 53 id->mssrl = cpu_to_le32((ql->max_copy_range_sectors << 9) / 54 ql->logical_block_size); > 55 id->msrc = to0based(ql->max_copy_nr_ranges); 56 } else { 57 if (ql->zoned == BLK_ZONED_NONE) { 58 id->msrc = to0based(BIO_MAX_VECS); 59 id->mssrl = cpu_to_le32( 60 (BIO_MAX_VECS << PAGE_SHIFT) / ql->logical_block_size); > 61 id->mcl = cpu_to_le64(le32_to_cpu(id->mssrl) * BIO_MAX_VECS); 62 #ifdef CONFIG_BLK_DEV_ZONED 63 } else { 64 /* TODO: get right values for zoned device */ 65 id->msrc = to0based(BIO_MAX_VECS); 66 id->mssrl = cpu_to_le32(min((BIO_MAX_VECS << PAGE_SHIFT), 67 ql->chunk_sectors) / ql->logical_block_size); 68 id->mcl = cpu_to_le64(min(le32_to_cpu(id->mssrl) * BIO_MAX_VECS, 69 ql->chunk_sectors)); 70 #endif 71 } 72 } 73 } 74 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Nitesh, 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: i386-randconfig-m021-20220207 (https://download.01.org/0day-ci/archive/20220211/202202110625.4yHrKaUn-lkp@intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> New smatch warnings: drivers/nvme/target/io-cmd-file.c:377 nvmet_file_copy_work() error: uninitialized symbol 'len'. vim +/len +377 drivers/nvme/target/io-cmd-file.c 6bb6ea64499e1ac Arnav Dawn 2022-02-07 350 static void nvmet_file_copy_work(struct work_struct *w) 6bb6ea64499e1ac Arnav Dawn 2022-02-07 351 { 6bb6ea64499e1ac Arnav Dawn 2022-02-07 352 struct nvmet_req *req = container_of(w, struct nvmet_req, f.work); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 353 int nr_range; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 354 loff_t pos; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 355 struct nvme_command *cmnd = req->cmd; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 356 int ret = 0, len, src, id; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 357 6bb6ea64499e1ac Arnav Dawn 2022-02-07 358 nr_range = cmnd->copy.nr_range + 1; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 359 pos = le64_to_cpu(req->cmd->copy.sdlba) << req->ns->blksize_shift; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 360 if (unlikely(pos + req->transfer_len > req->ns->size)) { 6bb6ea64499e1ac Arnav Dawn 2022-02-07 361 nvmet_req_complete(req, errno_to_nvme_status(req, -ENOSPC)); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 362 return; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 363 } 6bb6ea64499e1ac Arnav Dawn 2022-02-07 364 6bb6ea64499e1ac Arnav Dawn 2022-02-07 365 for (id = 0 ; id < nr_range; id++) { 6bb6ea64499e1ac Arnav Dawn 2022-02-07 366 struct nvme_copy_range range; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 367 6bb6ea64499e1ac Arnav Dawn 2022-02-07 368 ret = nvmet_copy_from_sgl(req, id * sizeof(range), &range, 6bb6ea64499e1ac Arnav Dawn 2022-02-07 369 sizeof(range)); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 370 if (ret) 6bb6ea64499e1ac Arnav Dawn 2022-02-07 371 goto out; ^^^^^^^^ 6bb6ea64499e1ac Arnav Dawn 2022-02-07 372 6bb6ea64499e1ac Arnav Dawn 2022-02-07 373 len = (le16_to_cpu(range.nlb) + 1) << (req->ns->blksize_shift); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 374 src = (le64_to_cpu(range.slba) << (req->ns->blksize_shift)); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 375 ret = vfs_copy_file_range(req->ns->file, src, req->ns->file, pos, len, 0); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 376 out: 6bb6ea64499e1ac Arnav Dawn 2022-02-07 @377 if (ret != len) { ^^^ "len" is not initialized. 6bb6ea64499e1ac Arnav Dawn 2022-02-07 378 pos += ret; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 379 req->cqe->result.u32 = cpu_to_le32(id); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 380 nvmet_req_complete(req, ret < 0 ? errno_to_nvme_status(req, ret) : 6bb6ea64499e1ac Arnav Dawn 2022-02-07 381 errno_to_nvme_status(req, -EIO)); 6bb6ea64499e1ac Arnav Dawn 2022-02-07 382 return; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 383 6bb6ea64499e1ac Arnav Dawn 2022-02-07 384 } else 6bb6ea64499e1ac Arnav Dawn 2022-02-07 385 pos += len; 6bb6ea64499e1ac Arnav Dawn 2022-02-07 386 } 6bb6ea64499e1ac Arnav Dawn 2022-02-07 387 nvmet_req_complete(req, ret); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 6fb24746de06..cbb967344d1d 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -431,8 +431,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) id->nn = cpu_to_le32(NVMET_MAX_NAMESPACES); id->mnan = cpu_to_le32(NVMET_MAX_NAMESPACES); id->oncs = cpu_to_le16(NVME_CTRL_ONCS_DSM | - NVME_CTRL_ONCS_WRITE_ZEROES); - + NVME_CTRL_ONCS_WRITE_ZEROES | NVME_CTRL_ONCS_COPY); /* XXX: don't report vwc if the underlying device is write through */ id->vwc = NVME_CTRL_VWC_PRESENT; @@ -530,6 +529,11 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req) if (req->ns->bdev) nvmet_bdev_set_limits(req->ns->bdev, id); + else { + id->msrc = to0based(BIO_MAX_VECS); + id->mssrl = cpu_to_le32(BIO_MAX_VECS << (PAGE_SHIFT - SECTOR_SHIFT)); + id->mcl = cpu_to_le64(le32_to_cpu(id->mssrl) * BIO_MAX_VECS); + } /* * We just provide a single LBA format that matches what the diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c index 95c2bbb0b2f5..9b403f394f21 100644 --- a/drivers/nvme/target/io-cmd-bdev.c +++ b/drivers/nvme/target/io-cmd-bdev.c @@ -46,6 +46,30 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) id->npda = id->npdg; /* NOWS = Namespace Optimal Write Size */ id->nows = to0based(ql->io_opt / ql->logical_block_size); + + /*Copy limits*/ + if (ql->max_copy_sectors) { + id->mcl = cpu_to_le64((ql->max_copy_sectors << 9) / ql->logical_block_size); + id->mssrl = cpu_to_le32((ql->max_copy_range_sectors << 9) / + ql->logical_block_size); + id->msrc = to0based(ql->max_copy_nr_ranges); + } else { + if (ql->zoned == BLK_ZONED_NONE) { + id->msrc = to0based(BIO_MAX_VECS); + id->mssrl = cpu_to_le32( + (BIO_MAX_VECS << PAGE_SHIFT) / ql->logical_block_size); + id->mcl = cpu_to_le64(le32_to_cpu(id->mssrl) * BIO_MAX_VECS); +#ifdef CONFIG_BLK_DEV_ZONED + } else { + /* TODO: get right values for zoned device */ + id->msrc = to0based(BIO_MAX_VECS); + id->mssrl = cpu_to_le32(min((BIO_MAX_VECS << PAGE_SHIFT), + ql->chunk_sectors) / ql->logical_block_size); + id->mcl = cpu_to_le64(min(le32_to_cpu(id->mssrl) * BIO_MAX_VECS, + ql->chunk_sectors)); +#endif + } + } } void nvmet_bdev_ns_disable(struct nvmet_ns *ns) @@ -433,6 +457,44 @@ static void nvmet_bdev_execute_write_zeroes(struct nvmet_req *req) } } +static void nvmet_bdev_execute_copy(struct nvmet_req *req) +{ + struct nvme_copy_range range; + struct range_entry *rlist; + struct nvme_command *cmnd = req->cmd; + sector_t dest, dest_off = 0; + int ret, id, nr_range; + + nr_range = cmnd->copy.nr_range + 1; + dest = le64_to_cpu(cmnd->copy.sdlba) << req->ns->blksize_shift; + rlist = kmalloc_array(nr_range, sizeof(*rlist), GFP_KERNEL); + + for (id = 0 ; id < nr_range; id++) { + ret = nvmet_copy_from_sgl(req, id * sizeof(range), &range, sizeof(range)); + if (ret) + goto out; + + rlist[id].dst = dest + dest_off; + rlist[id].src = le64_to_cpu(range.slba) << req->ns->blksize_shift; + rlist[id].len = (le16_to_cpu(range.nlb) + 1) << req->ns->blksize_shift; + rlist[id].comp_len = 0; + dest_off += rlist[id].len; + } + ret = blkdev_issue_copy(req->ns->bdev, nr_range, rlist, req->ns->bdev, GFP_KERNEL, + 0); + if (ret) { + for (id = 0 ; id < nr_range; id++) { + if (rlist[id].len != rlist[id].comp_len) { + req->cqe->result.u32 = cpu_to_le32(id); + break; + } + } + } +out: + kfree(rlist); + nvmet_req_complete(req, errno_to_nvme_status(req, ret)); +} + u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req) { switch (req->cmd->common.opcode) { @@ -451,6 +513,10 @@ u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req) case nvme_cmd_write_zeroes: req->execute = nvmet_bdev_execute_write_zeroes; return 0; + case nvme_cmd_copy: + req->execute = nvmet_bdev_execute_copy; + return 0; + default: return nvmet_report_invalid_opcode(req); } diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index 6be6e59d273b..665baa221a43 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -347,6 +347,46 @@ static void nvmet_file_dsm_work(struct work_struct *w) } } +static void nvmet_file_copy_work(struct work_struct *w) +{ + struct nvmet_req *req = container_of(w, struct nvmet_req, f.work); + int nr_range; + loff_t pos; + struct nvme_command *cmnd = req->cmd; + int ret = 0, len, src, id; + + nr_range = cmnd->copy.nr_range + 1; + pos = le64_to_cpu(req->cmd->copy.sdlba) << req->ns->blksize_shift; + if (unlikely(pos + req->transfer_len > req->ns->size)) { + nvmet_req_complete(req, errno_to_nvme_status(req, -ENOSPC)); + return; + } + + for (id = 0 ; id < nr_range; id++) { + struct nvme_copy_range range; + + ret = nvmet_copy_from_sgl(req, id * sizeof(range), &range, + sizeof(range)); + if (ret) + goto out; + + len = (le16_to_cpu(range.nlb) + 1) << (req->ns->blksize_shift); + src = (le64_to_cpu(range.slba) << (req->ns->blksize_shift)); + ret = vfs_copy_file_range(req->ns->file, src, req->ns->file, pos, len, 0); +out: + if (ret != len) { + pos += ret; + req->cqe->result.u32 = cpu_to_le32(id); + nvmet_req_complete(req, ret < 0 ? errno_to_nvme_status(req, ret) : + errno_to_nvme_status(req, -EIO)); + return; + + } else + pos += len; +} + nvmet_req_complete(req, ret); + +} static void nvmet_file_execute_dsm(struct nvmet_req *req) { if (!nvmet_check_data_len_lte(req, nvmet_dsm_len(req))) @@ -355,6 +395,11 @@ static void nvmet_file_execute_dsm(struct nvmet_req *req) schedule_work(&req->f.work); } +static void nvmet_file_execute_copy(struct nvmet_req *req) +{ + INIT_WORK(&req->f.work, nvmet_file_copy_work); + schedule_work(&req->f.work); +} static void nvmet_file_write_zeroes_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, f.work); @@ -401,6 +446,9 @@ u16 nvmet_file_parse_io_cmd(struct nvmet_req *req) case nvme_cmd_write_zeroes: req->execute = nvmet_file_execute_write_zeroes; return 0; + case nvme_cmd_copy: + req->execute = nvmet_file_execute_copy; + return 0; default: return nvmet_report_invalid_opcode(req); }