From patchwork Fri Dec 7 21:28:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 1009674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43BQZ35Dr5z9s7h; Sat, 8 Dec 2018 08:28:27 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gVNfZ-00045m-AE; Fri, 07 Dec 2018 21:28:21 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gVNfY-00045e-4V for kernel-team@lists.ubuntu.com; Fri, 07 Dec 2018 21:28:20 +0000 Received: from mail-qk1-f197.google.com ([209.85.222.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gVNfX-0000LE-QU for kernel-team@lists.ubuntu.com; Fri, 07 Dec 2018 21:28:19 +0000 Received: by mail-qk1-f197.google.com with SMTP id 98so4453229qkp.22 for ; Fri, 07 Dec 2018 13:28:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KlqXrWeTXbJJhFbpDwx6y286KF6EudzahCNfIPM/0hI=; b=t4Rl/KuGsDqETAxoeRaQu6TuTUTqNHagM/G3Q0ONfeAgZumk8nQxCM61Uy5hTYEWHO Slhew0+xnHh4HNX8uUy08mOnbqC8pXXjKQegVHfyhIoDNeOxltsYOsE2I5DCAEt3JqD4 uYwF/urM4h/BAPnQJh/YcarOGIlAWjRF2SRgmiC7/2E9Z5CrvKuyUfwOgUD9sHjCMIPJ 1sFOzCJZX6XellW666LhDYaTdX0hU0GSsFP/CuqXmz0i1l0rY7VXDF3WpNBpLwAZot2r xiAsG2eozfkWGTPWKrbyONUwmO08lGsim8dkXAWUfvwjETv0PyLPRwnsUsWDqNy4jA6m xpQg== X-Gm-Message-State: AA+aEWa6sLjpzqE3/X5jxsGf/MSEnLb9dw0p/QNVHkHP+IOtVSCntpbl w9Dd/pYfVdKONhUOF3AROapQNaNHugzaU2UmknZpQx8eeCdp9eTl2l6CmJHE0XFUjDBrxZe2IuR rEDem+gZdT/OtsZtweRWQZ4XLYgRxmyELu/NtkxbiCA== X-Received: by 2002:a37:86c5:: with SMTP id i188mr3404779qkd.81.1544218098766; Fri, 07 Dec 2018 13:28:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/VKHVX+xKK/4HZjMYNZQylSCFcp+KNhdjBZpuaJCgVcTPS0ONq6oiWBg/C/2rhrI/XprYt89g== X-Received: by 2002:a37:86c5:: with SMTP id i188mr3404768qkd.81.1544218098573; Fri, 07 Dec 2018 13:28:18 -0800 (PST) Received: from localhost (200-161-156-119.dsl.telesp.net.br. [200.161.156.119]) by smtp.gmail.com with ESMTPSA id b188sm2048643qkc.58.2018.12.07.13.28.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 13:28:17 -0800 (PST) From: "Guilherme G. Piccoli" To: kernel-team@lists.ubuntu.com Subject: [SRU X] [PATCH 1/1] nvme/pci: Poll CQ on timeout Date: Fri, 7 Dec 2018 19:28:11 -0200 Message-Id: <20181207212811.12826-2-gpiccoli@canonical.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207212811.12826-1-gpiccoli@canonical.com> References: <20181207212811.12826-1-gpiccoli@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gpiccoli@canonical.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Keith Busch BugLink: https://launchpad.net/bugs/1807393 If an IO timeout occurs, it's helpful to know if the controller did not post a completion or the driver missed an interrupt. While we never expect the latter, this patch will make it possible to tell the difference so we don't have to guess. Signed-off-by: Keith Busch Signed-off-by: Christoph Hellwig Tested-by: Johannes Thumshirn Reviewed-by: Johannes Thumshirn (backported from 7776db1ccc123d5944a8c170c9c45f7e91d49643 upstream) [gpiccoli: context adjustment, fixed struct member access that changed] Signed-off-by: Guilherme G. Piccoli Acked-by: Kleber Sacilotto de Souza Acked-by: Stefan Bader --- drivers/nvme/host/pci.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 3752052ae20a..5d2a7ee2f922 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -929,10 +929,8 @@ static irqreturn_t nvme_irq_check(int irq, void *data) return IRQ_NONE; } -static int nvme_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag) +static int __nvme_poll(struct nvme_queue *nvmeq, unsigned int tag) { - struct nvme_queue *nvmeq = hctx->driver_data; - if (nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase)) { spin_lock_irq(&nvmeq->q_lock); __nvme_process_cq(nvmeq, &tag); @@ -945,6 +943,13 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag) return 0; } +static int nvme_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag) +{ + struct nvme_queue *nvmeq = hctx->driver_data; + + return __nvme_poll(nvmeq, tag); +} + static void nvme_async_event_work(struct work_struct *work) { struct nvme_dev *dev = container_of(work, struct nvme_dev, async_work); @@ -1045,6 +1050,16 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) struct request *abort_req; struct nvme_command cmd; + /* + * Did we miss an interrupt? + */ + if (__nvme_poll(nvmeq, req->tag)) { + dev_warn(dev->dev, + "I/O %d QID %d timeout, completion polled\n", + req->tag, nvmeq->qid); + return BLK_EH_HANDLED; + } + /* * Shutdown immediately if controller times out while starting. The * reset work will see the pci device disabled when it gets the forced