Received: by 10.223.176.5 with SMTP id f5csp2586372wra; Mon, 29 Jan 2018 00:15:46 -0800 (PST) X-Google-Smtp-Source: AH8x227cDXfE4CNH6axiPOZDcR3Snxa7PlQ7uKDqNG9sTI6uBaOo/FCEpNvOGG4/nLA/7QUCIXNS X-Received: by 10.98.34.27 with SMTP id i27mr25912912pfi.43.1517213746232; Mon, 29 Jan 2018 00:15:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517213746; cv=none; d=google.com; s=arc-20160816; b=PPe50Ts0B3PhJriWYN49hqnTAtp5uQ3be292IsGNTXns4hXfIMVioDqOEsF8yU3XId wPGLRW2HRXkRPHUKXFggDAsWRgZ8DOMiTKIMqz7fO6NIg0Xd1c/VHDWX56xAKra3+kCX wjS/IvuBX/ybBWjit3Sul+8OyLWIfmS5pX1GSPAX2IVOGnI/BRqDDiXRZNs/lyrErAST PHjeaiR+VOep/5qrb1OyU58y++d6ffBh1g8A0DTjO67XMB+tMFGivjU2MORlTL5IiBTZ /tcSba3wf9T5WIGHzFOYzIflXcqiqYlyWKA2ZtNsCMB2fj7hFv9YsZGq/1GYjpLFJTEm 7jbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=avGZbvVpF/+EBQDHPmmDOmXL12LIjc8uqHQU4ZX2qls=; b=UjG4+iuFtAqqlHWCxQauOEkzj9pNTeRplbqcH42ISkFonf56YzLd2bbve6LmhLKusT wtz2CZTzQPCTm9lSkN3l1otsJjVfdn73I3Neab7PI3uU2dyOHi69E/xzcstVTm1QgVb0 rUBYbVWxyh5DtAMLA3CUmE9d0oQssGvzyXUPCLiBIEuOrVKKsZf9B2fuUIWYiDimHigk YZ7hACKJIhGuo67/w36SPVa8/L0VoD9sFgN9AAInL42EEwVkzKXcfixKRQoX5dK2Fmq1 OKARlqVPT0knxTpvPSogM5S0MKU6/GhV3TVmlxd0cXsVseT3QS2rIcuaBXP72jZYoJnx ARtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=r/ROL5qo; 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 c17si11300640pfi.152.2018.01.29.00.15.32; Mon, 29 Jan 2018 00:15:46 -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=r/ROL5qo; 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 S1751505AbeA2IO7 (ORCPT + 99 others); Mon, 29 Jan 2018 03:14:59 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:43940 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751127AbeA2IO6 (ORCPT ); Mon, 29 Jan 2018 03:14:58 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0T8Cefs124584; Mon, 29 Jan 2018 08:14:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=avGZbvVpF/+EBQDHPmmDOmXL12LIjc8uqHQU4ZX2qls=; b=r/ROL5qoAGvO8HJk/eIyzIpCYEBjswazeN3fC5MEnLsj7A9HaqA1WTyh7ejaYCI5v5wH 5GsqDJbXWE7/1XuIUlHxUY7N+6zJeG5mtwJULAZhnq8vqodzCIzk2G/KlvhsjmviPLZ4 RkNkM7C/uYjGcSNB6WrHPuE+k+kN6+P4AmXZ9HdECMZvbod1beL99ufW9hi/twhslzfw fizgBCaZkxhmFiFVxhO6c8IvaBT2+KG0fhQ5H14WBB9iGKt4Ev87WopuT3hvw3R0qEPz 11So+INRXZJNMxUwI4pg0zr5+B+W3AxJdPsJuMZpiTrl5XsuwDgH065h2luGb1V6aXRR ww== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2fsysv8297-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Jan 2018 08:14:26 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0T86Cj9008758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 29 Jan 2018 08:06:12 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w0T869bi026383; Mon, 29 Jan 2018 08:06:09 GMT Received: from [10.182.70.180] (/10.182.70.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Jan 2018 00:06:09 -0800 Subject: Re: [PATCH] nvme-pci: use NOWAIT flag for nvme_set_host_mem To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org References: <1517195255-21832-1-git-send-email-jianchao.w.wang@oracle.com> From: "jianchao.wang" Message-ID: <40b52195-95c8-4c33-39cc-dc80043161a2@oracle.com> Date: Mon, 29 Jan 2018 16:06:13 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1517195255-21832-1-git-send-email-jianchao.w.wang@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8788 signatures=668655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1801290113 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/29/2018 11:07 AM, Jianchao Wang wrote: > nvme_set_host_mem will invoke nvme_alloc_request without NOWAIT > flag, it is unsafe for nvme_dev_disable. The adminq driver tags > may have been used up when the previous outstanding adminq requests > cannot be completed due to some hardware error. We have to depend > on the timeout path to complete the previous outstanding adminq > requests and free the tags. > However, nvme_timeout will invoke nvme_dev_disable and try to > get the shutdown_lock which is held by another context who is > sleeping to wait for the tags to be freed by timeout path. A > deadlock comes up. > > To fix it, let nvme_set_host_mem use NOWAIT flag. In fact, this is the only case about nvme_set_host_mem in nvme_dev_disable. Consider the following case: A adminq request expired. timeout_work context nvme_timeout -> nvme_dev_disable -> nvme_set_host_mem if this adminq request expires again, the timeout_work cannot handle this case, because it is waiting for the result of nvme_set_host_mem. Thanks Jianchao