Received: by 10.223.185.116 with SMTP id b49csp6392513wrg; Thu, 8 Mar 2018 06:47:21 -0800 (PST) X-Google-Smtp-Source: AG47ELufFBlK+lWHvlN9ZYvxP9pe6/o9YAL8zzcDjoD1TPUi6DaeJYuUgYsoQw+J5RxyMpp3Umu6 X-Received: by 10.98.216.137 with SMTP id e131mr26848245pfg.17.1520520441268; Thu, 08 Mar 2018 06:47:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520520441; cv=none; d=google.com; s=arc-20160816; b=T6oJBYYapUYoSe/gsqld1lWATYBQgn3KQKw84S+4wu0Dq/+EGSgzeFNjldWFZeL/Jn nih8mk8zNajr1peBaqZeYmWGvX6f+aniKk1A71ZlMDHN5FIa9z19s0ISBLBq4Rdwu+Lu 4eZ0izQdQS63BGOEF7nj3bODAr/kKBcbwrXGfPltEz8jGlXTaAK3c7GxRCK1GJbvAGAS LUge6epqEaA2WxiOaIzUDvMYhwqp98UKLDowqF3bIuNNXeMpaBUClgK4VO4YyK/0Du5L 7WMt72S6lKqbcxkC11PnXgs83lWTblwi8824bXlJfTfOHvXw/mTzXMZtWv/XYmjPhZ66 +oUQ== 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=qaKBZr+dwwWkNFk4BhO9nma8DCwQ4SEN2g9vI4Iq444=; b=pnj9G/YbylDchMHuF684t+fGh3OEi4zaw4Tjee5/5H6P6mEDzP9e07KW7TFUBHKQKD i4Yqcw1ZB1cSKnIToxJKVHf5rcr9uWp1AnXieMlMJ6dG2XyoajsDovbnxB2AGaM6AihW WhAPl56aaRrSJTCuZL/QddoqvcgxHJ+ZrxZV1e9Mg1nSD8PeS8h1u9Zh0lme1XktEhE9 /w+s0m9t5LZTDj/LLDQKkeDIzPFXfRWjY0clHXKR8mRqNt+iGoH/3lzD4rXSRZ9SPl6V u/7OFQZvz/eDL3XMrOEfXkDK14REpY1Aacjv3Gt2LNOmxIZyqiHQusvOIhwAK/u4y7jS bmtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=PdQiOpRh; 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 l18si13011141pgn.103.2018.03.08.06.47.06; Thu, 08 Mar 2018 06:47:21 -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=PdQiOpRh; 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 S1754846AbeCHOpV (ORCPT + 99 others); Thu, 8 Mar 2018 09:45:21 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:34080 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752059AbeCHOpU (ORCPT ); Thu, 8 Mar 2018 09:45:20 -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 w28EgIrB097269; Thu, 8 Mar 2018 14:44:53 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=qaKBZr+dwwWkNFk4BhO9nma8DCwQ4SEN2g9vI4Iq444=; b=PdQiOpRhetwbGIVsl6+PVlxOlD+1jG/F+wb9gnbJilS/UE4k2ngEDfmgGitvcc/FLOxi olfNj/6K+ZDt+mxUdwW/NT6HNrcR71AjR0n3Rd+AfGZdNU0bMGXpKltLVugbA7mSgdlS owIjpthJn36meowuVzg3tUZp3fN/xAa67hFbFfOBN6cqPNKtUgsGFU6ARFDf0C6Gt68N en3O6XAtURxMljNdR9BXg1SFhrJOK6uHKthkuNaZe/NVOa2NZTZmmMraGQG2vcMtdxTs k/BD9UwIvrIyyGqqy+pilud8rACfiid+r39tD5R+Jd7uIhqgHHCiysbC60j9TcQj37r+ hQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gk63y0arv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Mar 2018 14:44:53 +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 w28EirCR025536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Mar 2018 14:44:53 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 w28EiqIg015391; Thu, 8 Mar 2018 14:44:52 GMT Received: from [10.191.23.54] (/10.191.23.54) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Mar 2018 06:44:52 -0800 Subject: Re: [PATCH V4 2/5] nvme: add helper interface to flush in-flight requests To: Ming Lei Cc: Jens Axboe , Sagi Grimberg , Linux Kernel Mailing List , linux-nvme , Keith Busch , Christoph Hellwig References: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> <1520489971-31174-3-git-send-email-jianchao.w.wang@oracle.com> From: "jianchao.wang" Message-ID: <965e5e7c-3bbd-8569-c40a-d29310d0f3be@oracle.com> Date: Thu, 8 Mar 2018 22:44:57 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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-1803080172 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ming Thanks for your precious time for reviewing and comment. On 03/08/2018 09:11 PM, Ming Lei wrote: > On Thu, Mar 8, 2018 at 2:19 PM, Jianchao Wang > wrote: >> Currently, we use nvme_cancel_request to complete the request >> forcedly. This has following defects: >> - It is not safe to race with the normal completion path. >> blk_mq_complete_request is ok to race with timeout path, >> but not with itself. > > The irq path shouldn't be raced with nvme_cancel_request() > because io queues are suspended before calling nvme_cancel_request(). > > Could you please explain a bit why one same request can be > completed at the same time via blk_mq_complete_request()? In fact, this interface will be used before suspend ioqs and disable controller. Then the timeout path could be more clearly when we issue adminq commands during nvme_dev_disable. Otherwise, it is hard to distinguish which is from previous workload , which is from nvme_dev_disable. We will take different action for them. >> - Cannot ensure all the requests have been handled. The timeout >> path may grab some expired requests, blk_mq_complete_request >> cannot touch them. >> >> add two helper interface to flush in-flight requests more safely. >> - nvme_abort_requests_sync >> use nvme_abort_req to timeout all the in-flight requests and wait >> until timeout work and irq completion path completes. More details >> please refer to the comment of this interface. >> - nvme_flush_aborted_requests >> complete the requests 'aborted' by nvme_abort_requests_sync. It will >> be invoked after the controller is disabled/shutdown. > > IMO, the helper's name of 'abort' is very misleading since the request > isn't aborted actually, it is just cancelled from dispatched state, once > it is cancelled, most of times the request is just re-inserted to sw > queue or scheduler queue. After NVMe controller is resetted successfully, > these request will be dispatched again. > > So please keep the name of 'cancel' or use sort of name. Yes, it is indeed misleading. In fact, this 'abort' inherits from the blk_abort_request which is invoked by nvme_abort_req. Thanks Jianchao