Received: by 10.223.176.5 with SMTP id f5csp2294310wra; Mon, 5 Feb 2018 01:23:44 -0800 (PST) X-Google-Smtp-Source: AH8x224KUkqAoUVHLj6/NBB99XsJDWmS1BNIZk47EpxJ/mjuJcT9U1rI4L3idgNa94hhRTq/701w X-Received: by 10.98.214.7 with SMTP id r7mr966747pfg.24.1517822624284; Mon, 05 Feb 2018 01:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517822624; cv=none; d=google.com; s=arc-20160816; b=Q8P+ovNp8exL+yEm4Id0J5EsbLgBzBZjW7nO2ylp6KKhZHUfgMfOhRBCVYy3SKqSyM xnmPQJcVjQKJdG4QPdAiBasl8nRlQkyHu6SWnIVsHo8sT7a52ZLy2+HkDjC9UT3yYK3V IlmWmW4da3MqHovFz/5ojZwHaKWu071FW6hPB2yYWsY+oFQ3946LCKL5HqExyEQNo4Js wmkmMa/vUA2yICv4Rr4Nv3fPDRamd4h2NeRtP9ju5znzBurG1d2RAJePS+Fw3fJqw3Pg z5wOqq1ek+kGFSVHLCn6o0X70GsfmnPozY8I3st4HneYJcl11OUh6M+vL8iS0loqoIob GE7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PDpw9W2kQAHJvDTlF0RhoqYIsEQtGJM+ZtGWvAVwiyU=; b=0C26cd9j+6qb1vfSdjWIsGfqbGqEFifKvOADmNSYvGSq9RjCUUaOh0UAWuZ4oVKo5p ZBagMMpWn9g5fxPDU/+8OzzqqshvBBDQm1221e7l+vMmcR7hJASA5EWMW5MAV1VEhAYP kA8FZWtbFVUfmJRqXeUoUbVEbGdpnxdGZT2lJWGJLTXShMDXoS3JCPuaDS08UPtZU0G/ ITtu81h31dOieUnrJNq50C1RmVSHB07lysufxZHffO5phn+9ImyyvJMloqDG4rIgw/Ch Z3VE9rdTdpkhK+HxWnCuN+1sOd40YLEYIbwkEa1MMGGzNUWmrc5gy2edFc6r7+4SfbMN Hidw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ooLitXPO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e71si381875pgc.571.2018.02.05.01.23.29; Mon, 05 Feb 2018 01:23:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ooLitXPO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752797AbeBEJVe (ORCPT + 99 others); Mon, 5 Feb 2018 04:21:34 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:52048 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752583AbeBEJUy (ORCPT ); Mon, 5 Feb 2018 04:20:54 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w159HFiX046677; Mon, 5 Feb 2018 09:20:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=PDpw9W2kQAHJvDTlF0RhoqYIsEQtGJM+ZtGWvAVwiyU=; b=ooLitXPOYPAbSEOm55r5i+nTZrTbc5edxILcKeLKZQzZmH+i438DuwGX3xJEnGk6qc07 WkEr1fQV4VX9xqRVR8K6YUAG2nsngSp56ZmWWjWabHrUfYJ0JPqO8nwShicy4WGBcbWi /43Gin2bQ4UHmVeFGIH4nVto3dx+Vw9u3fC1D97iShMaKM2G7qJ5NZOuXkaf7IksDUuT hvfh8wz6GESV1RfzA+gfCgtqvobk0JuRzKuVzXCfhb/9bbn4NEQvHc1MLmjLfmqanyrR orfQxfH6NOGrPAd9aj4G4GLS7is/MGich8oSJrMgcpnA1wljGSefy+3hYHiMGRkIRfEz pA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2fxjjarfwf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 05 Feb 2018 09:20:28 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w159KRfD028372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Feb 2018 09:20:28 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w159KRRA016165; Mon, 5 Feb 2018 09:20:27 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Feb 2018 01:20:27 -0800 From: Jianchao Wang To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 6/6] nvme-pci: discard wait timeout when delete cq/sq Date: Mon, 5 Feb 2018 17:20:15 +0800 Message-Id: <1517822415-11710-7-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517822415-11710-1-git-send-email-jianchao.w.wang@oracle.com> References: <1517822415-11710-1-git-send-email-jianchao.w.wang@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8795 signatures=668662 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802050117 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, nvme_disable_io_queues could be wakeup by both request completion and wait timeout path. This is unnecessary and could introduce race between nvme_dev_disable and request timeout path. When delete cq/sq command expires, the nvme_disable_io_queues will also be wakeup and return to nvme_dev_disable, then handle the outstanding requests. This will race with the request timeout path. To fix it, just use wait_for_completion instead of the timeout one. The request timeout path will wakeup it. Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 43033fc..f3262cc 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2050,7 +2050,6 @@ static int nvme_delete_queue(struct nvme_queue *nvmeq, u8 opcode) static void nvme_disable_io_queues(struct nvme_dev *dev) { int pass, queues = dev->online_queues - 1; - unsigned long timeout; u8 opcode = nvme_admin_delete_sq; for (pass = 0; pass < 2; pass++) { @@ -2058,15 +2057,12 @@ static void nvme_disable_io_queues(struct nvme_dev *dev) reinit_completion(&dev->ioq_wait); retry: - timeout = ADMIN_TIMEOUT; for (; i > 0; i--, sent++) if (nvme_delete_queue(&dev->queues[i], opcode)) break; while (sent--) { - timeout = wait_for_completion_io_timeout(&dev->ioq_wait, timeout); - if (timeout == 0) - return; + wait_for_completion(&dev->ioq_wait); if (i) goto retry; } -- 2.7.4