[PATCH v2 2/2] nvme: Add abrupt shutdown support

kernel test robot lkp at intel.com
Mon Jul 26 09:07:42 PDT 2021


Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pavel-linux-leds/for-next]
[also build test ERROR on linus/master v5.14-rc3 next-20210723]
[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/shiva-linuxworks-gmail-com/Abrupt-Shutdown-for-NVMe-SSD/20210726-212459
base:   git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
config: ia64-randconfig-r012-20210726 (attached as .config)
compiler: ia64-linux-gcc (GCC) 10.3.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/929817804ad19d2760e156c539dbec82638c35c3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review shiva-linuxworks-gmail-com/Abrupt-Shutdown-for-NVMe-SSD/20210726-212459
        git checkout 929817804ad19d2760e156c539dbec82638c35c3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=ia64 

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

All errors (new ones prefixed by >>):

   drivers/nvme/host/pci.c: In function 'nvme_dev_disable':
>> drivers/nvme/host/pci.c:2478:28: error: implicit declaration of function 'pm_power_loss_imminent' [-Werror=implicit-function-declaration]
    2478 |  if (!dead && shutdown && !pm_power_loss_imminent() && freeze)
         |                            ^~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/pm_power_loss_imminent +2478 drivers/nvme/host/pci.c

  2455	
  2456	static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
  2457	{
  2458		bool dead = true, freeze = false;
  2459		struct pci_dev *pdev = to_pci_dev(dev->dev);
  2460	
  2461		mutex_lock(&dev->shutdown_lock);
  2462		if (pci_is_enabled(pdev)) {
  2463			u32 csts = readl(dev->bar + NVME_REG_CSTS);
  2464	
  2465			if (dev->ctrl.state == NVME_CTRL_LIVE ||
  2466			    dev->ctrl.state == NVME_CTRL_RESETTING) {
  2467				freeze = true;
  2468				nvme_start_freeze(&dev->ctrl);
  2469			}
  2470			dead = !!((csts & NVME_CSTS_CFS) || !(csts & NVME_CSTS_RDY) ||
  2471				pdev->error_state  != pci_channel_io_normal);
  2472		}
  2473	
  2474		/*
  2475		 * Give the controller a chance to complete all entered requests if
  2476		 * doing a safe shutdown.
  2477		 */
> 2478		if (!dead && shutdown && !pm_power_loss_imminent() && freeze)
  2479			nvme_wait_freeze_timeout(&dev->ctrl, NVME_IO_TIMEOUT);
  2480	
  2481		nvme_stop_queues(&dev->ctrl);
  2482	
  2483		if (!dead && dev->ctrl.queue_count > 0) {
  2484			if (!pm_power_loss_imminent())
  2485				nvme_disable_io_queues(dev);
  2486			nvme_disable_admin_queue(dev, shutdown);
  2487		}
  2488		nvme_suspend_io_queues(dev);
  2489		nvme_suspend_queue(&dev->queues[0]);
  2490		nvme_pci_disable(dev);
  2491		nvme_reap_pending_cqes(dev);
  2492	
  2493		blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_request, &dev->ctrl);
  2494		blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_request, &dev->ctrl);
  2495		blk_mq_tagset_wait_completed_request(&dev->tagset);
  2496		blk_mq_tagset_wait_completed_request(&dev->admin_tagset);
  2497	
  2498		/*
  2499		 * The driver will not be starting up queues again if shutting down so
  2500		 * must flush all entered requests to their failed completion to avoid
  2501		 * deadlocking blk-mq hot-cpu notifier.
  2502		 */
  2503		if (shutdown) {
  2504			nvme_start_queues(&dev->ctrl);
  2505			if (dev->ctrl.admin_q && !blk_queue_dying(dev->ctrl.admin_q))
  2506				blk_mq_unquiesce_queue(dev->ctrl.admin_q);
  2507		}
  2508		mutex_unlock(&dev->shutdown_lock);
  2509	}
  2510	

---
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: 26226 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20210727/80c7f47c/attachment-0001.gz>


More information about the Linux-nvme mailing list