Received: by 10.223.185.116 with SMTP id b49csp5946549wrg; Wed, 7 Mar 2018 22:23:12 -0800 (PST) X-Google-Smtp-Source: AG47ELv1jJeye6Jn3QqXazmaDpO6R3AaVqHFng4Yrap/ZGCF9kBf1QIFVy+RjuyWoVus9Q0ZzYOO X-Received: by 10.99.127.86 with SMTP id p22mr20234065pgn.157.1520490192544; Wed, 07 Mar 2018 22:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520490192; cv=none; d=google.com; s=arc-20160816; b=F8LTOFos10yIIQT77oF8tOSnjU/P07golu7pxDh4ZgCqRo1NI0d+NYlAaouV4Wx6mh jgCsrukVEbMhqOy1tGoAMwi6Vj4BxDjIflKJ4XwjPZg5lBpJEOL71qe2QnLTAlTnystM p4vE7YQ5PUIeuDx8DJeGncJ0PU+g5HGL4OaSyeDtwEG3NcB3k1QxiGUx2cRFQGL3Q7hZ 3xulyShlpmQ0ZNQM8Cavxsczu1iR8rGsRAgyKsmkEI37v21p5RgJ0gONKB8T4HGPhw23 5cTn/n5xQgYUbD9ZcmpO+Lv0+2HfgDqXtaij1PWpYZyHfHCq4D4RnC6Zti27iblq72ua stng== 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=Z/CSwTJUdy61T/jKSe6mpM8/Ztq7kDOkL8LVsE7NXVc=; b=jU+YwSvrY1+3lrGLurQU0/UuaYxkBf0CPpiJKa0c2S0mTx0xvy1oOadhI/RJUUMaEs l+/eAC/pnuKCkdU8f+bjn6y+7yYHUrSOU1FZZvSfHMqmIvbKfpAwY5t6TIh+j4Fz0KnT UjjnTA24XVxIUHCkykojghJttuq1DWBRW3DZAZkogdBLMJUBRTD2R2GhEwZvEDWUfbC8 rpXbaNCXsT5wERThqZ70nOB3BJnciStTc7wUeK0M8ijc1gD1bHwLVyCeixHdlCe2pXkB JMpi+dRRvP0OnkhMRqV5W8JPPiciqR3tOgNs97Hy+YQzYpo6brCuHn+GfBMPaI96ArGO 5Yrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SUDmGTfL; 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 r12-v6si14253208plo.359.2018.03.07.22.22.58; Wed, 07 Mar 2018 22:23:12 -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=SUDmGTfL; 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 S965867AbeCHGVX (ORCPT + 99 others); Thu, 8 Mar 2018 01:21:23 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:58050 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964788AbeCHGUb (ORCPT ); Thu, 8 Mar 2018 01:20:31 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w286Gqwj125289; Thu, 8 Mar 2018 06:20:10 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=Z/CSwTJUdy61T/jKSe6mpM8/Ztq7kDOkL8LVsE7NXVc=; b=SUDmGTfLWPNGQxXztd2T0S+uyCM6BUsOmTKTEcGmlQ3S5G5JNGJx0ZfZuf/N+a7t+J/9 iHx9Uh56sU2az0KDvBQBD27o4exri3ikHxhbtZm55+a4qVz2NwDsjJSaS8Pm4BX2k/wL YwWyw2Dw6bzF+r3rSfE2cz6jwsaFccAG9DQLUvKoVruw6ozpWqmH9Kp/5f3PZpp42XTN m72PI1wGqOV6RcXUWn1tRMuivna2OfHT57FuP8ZE7CfNObNHwC+8atZAGHRI4P0wFe6k fNn/7vd6YOH3/04yOXZJEImzszPAumFbw6DM93DgTrEoL+41bWUHZTgVgqdS74Vv5dcb LQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gjykj03mx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Mar 2018 06:20:10 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w286K9E2021831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Mar 2018 06:20:09 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w286K9sp002647; Thu, 8 Mar 2018 06:20:09 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Mar 2018 22:20:08 -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 V4 4/5] nvme-pci: discard wait timeout when delete cq/sq Date: Thu, 8 Mar 2018 14:19:30 +0800 Message-Id: <1520489971-31174-5-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> References: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8825 signatures=668685 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-1803080079 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nvme_disable_io_queues could be wakeup by both request completion and wait timeout path. If delete cq/sq command expires, the nvme_disable_io_queues will be wakeup, return, even get to nvme_reset_work, while the timeout path is still ongoing. The disable and initialization procedure may run in parallel. Use wait_for_completion instead of the timeout one here. The timeout path is reliable now and will complete the request to 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 ce09057..6c7c19cb 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2062,7 +2062,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++) { @@ -2070,15 +2069,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