[PATCH] nvme: update keep alive interval when kato is modified

kernel test robot lkp at intel.com
Sun Aug 1 21:31:48 PDT 2021


Hi sasaki,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on block/for-next]
[also build test WARNING on hch-configfs/for-next linus/master v5.14-rc3 next-20210730]
[cannot apply to linux-nvme/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/sasaki-tatsuya/nvme-update-keep-alive-interval-when-kato-is-modified/20210802-090235
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: i386-randconfig-s002-20210802 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/eda2903523c28b51997fb071c0ff3653081c8a79
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review sasaki-tatsuya/nvme-update-keep-alive-interval-when-kato-is-modified/20210802-090235
        git checkout eda2903523c28b51997fb071c0ff3653081c8a79
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/nvme/host/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/host/ioctl.c:239:15: sparse: sparse: cast from restricted __le32
>> drivers/nvme/host/ioctl.c:241:41: sparse: sparse: restricted __le32 degrades to integer

vim +239 drivers/nvme/host/ioctl.c

   189	
   190	static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
   191				struct nvme_passthru_cmd __user *ucmd)
   192	{
   193		struct nvme_passthru_cmd cmd;
   194		struct nvme_command c;
   195		unsigned timeout = 0;
   196		u64 result;
   197		int status;
   198	
   199		if (!capable(CAP_SYS_ADMIN))
   200			return -EACCES;
   201		if (copy_from_user(&cmd, ucmd, sizeof(cmd)))
   202			return -EFAULT;
   203		if (cmd.flags)
   204			return -EINVAL;
   205		if (!nvme_validate_passthru_nsid(ctrl, ns, cmd.nsid))
   206			return -EINVAL;
   207	
   208		memset(&c, 0, sizeof(c));
   209		c.common.opcode = cmd.opcode;
   210		c.common.flags = cmd.flags;
   211		c.common.nsid = cpu_to_le32(cmd.nsid);
   212		c.common.cdw2[0] = cpu_to_le32(cmd.cdw2);
   213		c.common.cdw2[1] = cpu_to_le32(cmd.cdw3);
   214		c.common.cdw10 = cpu_to_le32(cmd.cdw10);
   215		c.common.cdw11 = cpu_to_le32(cmd.cdw11);
   216		c.common.cdw12 = cpu_to_le32(cmd.cdw12);
   217		c.common.cdw13 = cpu_to_le32(cmd.cdw13);
   218		c.common.cdw14 = cpu_to_le32(cmd.cdw14);
   219		c.common.cdw15 = cpu_to_le32(cmd.cdw15);
   220	
   221		if (cmd.timeout_ms)
   222			timeout = msecs_to_jiffies(cmd.timeout_ms);
   223	
   224		status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c,
   225				nvme_to_user_ptr(cmd.addr), cmd.data_len,
   226				nvme_to_user_ptr(cmd.metadata), cmd.metadata_len,
   227				0, &result, timeout);
   228	
   229		if (status >= 0) {
   230			if (put_user(result, &ucmd->result))
   231				return -EFAULT;
   232		}
   233	
   234		/*
   235		 * Keep alive commands interval on the host should be updated
   236		 * when KATO is modified by Set Features commands.
   237		 */
   238		if (!status && c.common.opcode == nvme_admin_set_features &&
 > 239		    ((u8)c.common.cdw10 & 0xFF) == NVME_FEAT_KATO) {
   240			/* ms -> s */
 > 241			unsigned int new_kato = DIV_ROUND_UP(c.common.cdw11, 1000);
   242	
   243			dev_info(ctrl->device,
   244				 "keep alive commands interval on the host is updated from %u milliseconds to %u milliseconds\n",
   245				 ctrl->kato * 1000 / 2, new_kato * 1000 / 2);
   246			nvme_stop_keep_alive(ctrl);
   247			ctrl->kato = new_kato;
   248			nvme_start_keep_alive(ctrl);
   249		}
   250	
   251		return status;
   252	}
   253	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 40569 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20210802/306dd0d8/attachment-0001.gz>


More information about the Linux-nvme mailing list