From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:42038 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbdF0MT5 (ORCPT ); Tue, 27 Jun 2017 08:19:57 -0400 Subject: Patch "nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too" has been added to the 4.4-stable tree To: gpiccoli@linux.vnet.ibm.com, Jeff.Lien@wdc.com, byrneadw@ie.ibm.com, gregkh@linuxfoundation.org, hch@lst.de, jahgomez@mx1.ibm.com, mauricfo@linux.vnet.ibm.com, vnarasimhan@in.ibm.com, zdmyers@us.ibm.com Cc: , From: Date: Tue, 27 Jun 2017 14:19:54 +0200 Message-ID: <14985659941696@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too to the 4.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nvme-apply-delay_before_chk_rdy-quirk-at-probe-time-too.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From b5a10c5f7532b7473776da87e67f8301bbc32693 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Wed, 28 Dec 2016 22:13:15 -0200 Subject: nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too From: Guilherme G. Piccoli commit b5a10c5f7532b7473776da87e67f8301bbc32693 upstream. Commit 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter readiness") introduced a quirk to adapters that cannot read the bit NVME_CSTS_RDY right after register NVME_REG_CC is set; these adapters need a delay or else the action of reading the bit NVME_CSTS_RDY could somehow corrupt adapter's registers state and it never recovers. When this quirk was added, we checked ctrl->tagset in order to avoid quirking in probe time, supposing we would never require such delay during probe. Well, it was too optimistic; we in fact need this quirk at probe time in some cases, like after a kexec. In some experiments, after abnormal shutdown of machine (aka power cord unplug), we booted into our bootloader in Power, which is a Linux kernel, and kexec'ed into another distro. If this kexec is too quick, we end up reaching the probe of NVMe adapter in that distro when adapter is in bad state (not fully initialized on our bootloader). What happens next is that nvme_wait_ready() is unable to complete, except if the quirk is enabled. So, this patch removes the original ctrl->tagset verification in order to enable the quirk even on probe time. Fixes: 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter readiness") Reported-by: Andrew Byrne Reported-by: Jaime A. H. Gomez Reported-by: Zachary D. Myers Signed-off-by: Guilherme G. Piccoli Acked-by: Jeffrey Lien Signed-off-by: Christoph Hellwig [mauricfo: backport to v4.4.70 without nvme quirk handling & nvme_ctrl] Signed-off-by: Mauricio Faria de Oliveira Tested-by: Narasimhan Vaidyanathan Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/pci.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1639,12 +1639,7 @@ static int nvme_disable_ctrl(struct nvme dev->ctrl_config &= ~NVME_CC_ENABLE; writel(dev->ctrl_config, &dev->bar->cc); - /* Checking for dev->tagset is a trick to avoid sleeping on module - * load, since we only need the quirk on reset_controller. Notice - * that the HGST device needs this delay only in firmware activation - * procedure; unfortunately we have no (easy) way to verify this. - */ - if (pdev->vendor == 0x1c58 && pdev->device == 0x0003 && dev->tagset) + if (pdev->vendor == 0x1c58 && pdev->device == 0x0003) msleep(NVME_QUIRK_DELAY_AMOUNT); return nvme_wait_ready(dev, cap, false); Patches currently in stable-queue which might be from gpiccoli@linux.vnet.ibm.com are queue-4.4/nvme-apply-delay_before_chk_rdy-quirk-at-probe-time-too.patch queue-4.4/nvme-quirk-add-a-delay-before-checking-for-adapter-readiness.patch