Skip to contentSkip to conversation

nvme: Ignore timeouts while PCI config access is blocked

PATCH New Kenneth Heitke 3 participants 4 messages May 23, 2019 – May 29, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Ignore timeouts while PCI config access is blocked

If an admin command timeout occurs while a PCIe reset (FLR) is pending, the CSTS bits may not be valid which could result in the controller being removed.

Signed-off-by Kenneth Heitke <kenneth.heitke at intel.com>
---
 drivers/nvme/host/pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +3 -2
index 2a8708c9ac18..7cd7e6287d5f 100644
@@ -1258,13 +1258,14 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	struct request *abort_req;
 	struct nvme_command cmd;
 	bool shutdown = false;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	u32 csts = readl(dev->bar + NVME_REG_CSTS);
 
 	/* If PCI error recovery process is happening, we cannot reset or
 	 * the recovery mechanism will surely fail.
 	 */
 	mb();
-	if (pci_channel_offline(to_pci_dev(dev->dev)))
+	if (pci_channel_offline(to_pci_dev(dev->dev)) || pdev->block_cfg_access)
 		return BLK_EH_RESET_TIMER;
 
 	/*
@@ -2786,7 +2787,7 @@ static void nvme_reset_prepare(struct pci_dev *pdev)
 static void nvme_reset_done(struct pci_dev *pdev)
 {
 	struct nvme_dev *dev = pci_get_drvdata(pdev);
-	nvme_reset_ctrl_sync(&dev->ctrl);
+	nvme_reset_ctrl(&dev->ctrl);
 }
 
 static void nvme_shutdown(struct pci_dev *pdev)
Signature · 1 line
2.17.1
maintainer
#1 lore raw

PATCH 1/1 nvme: Ignore timeouts while PCI config access is blocked

drivers/nvme/host/pci.c static void nvme_reset_prepare(struct pci_dev *pdev) · line 2790

Quoted 6 lines
  static void nvme_reset_done(struct pci_dev *pdev)
  {
  	struct nvme_dev *dev = pci_get_drvdata(pdev);
drivers/nvme/host/pci.c +1 -1
-	nvme_reset_ctrl_sync(&dev->ctrl);
+	nvme_reset_ctrl(&dev->ctrl);

This change is not explained in the change log. This opens a window for nvme_reset_work to run concurrently from different contexts which is not a good idea...

#2 lore raw

PATCH 1/1 nvme: Ignore timeouts while PCI config access is blocked

Quoted 10 lines · Sagi Grimberg
Quoted 6 lines

? static void nvme_reset_done(struct pci_dev *pdev) ? {
????? struct nvme_dev *dev = pci_get_drvdata(pdev); -??? nvme_reset_ctrl_sync(&dev->ctrl);
+??? nvme_reset_ctrl(&dev->ctrl);

This change is not explained in the change log. This opens a window for nvme_reset_work to run concurrently from different contexts which is not a good idea...

I think Keith recommended the asynchronous reset

"Definitely need the nvme_reset_ctrl change as blk_cfg_access is still set here so need to reset asynchronously to unblock new timeouts"

Keith, does this still hold true or do I need some other mechanism to avoid the issues that Sagi is concerned about?

#3 lore raw

PATCH 1/1 nvme: Ignore timeouts while PCI config access is blocked

Quoted 12 lines · Kenneth
Quoted 10 lines · Sagi Grimberg

drivers/nvme/host/pci.c static void nvme_reset_prepare(struct pci_dev *pdev) · line 2790

Quoted 6 lines
  static void nvme_reset_done(struct pci_dev *pdev)
  {
      struct nvme_dev *dev = pci_get_drvdata(pdev);
drivers/nvme/host/pci.c +1 -1
-    nvme_reset_ctrl_sync(&dev->ctrl);
+    nvme_reset_ctrl(&dev->ctrl);

This change is not explained in the change log. This opens a window for nvme_reset_work to run concurrently from different contexts which is not a good idea...

Quoted 7 lines

I think Keith recommended the asynchronous reset

"Definitely need the nvme_reset_ctrl change as blk_cfg_access is still set here so need to reset asynchronously to unblock new timeouts"

Keith, does this still hold true or do I need some other mechanism to avoid the issues that Sagi is concerned about?

Can't use the pci's block_cfg_access in timeout if doing synchronous resets in reset_done. We wouldn't be able to handle IO timeouts during reset using that, so would need to use something else, maybe introduce a new flag like your original patch.