Received: by 10.223.185.82 with SMTP id b18csp17472wrg; Thu, 8 Mar 2018 18:13:04 -0800 (PST) X-Google-Smtp-Source: AG47ELvNcaTfiQtc40pw4zDktD3/2NEcjDKzCcvqcmmMJUKDd6qrESVxJzS9s9cY/BWnyzcfXdtG X-Received: by 2002:a17:902:3283:: with SMTP id z3-v6mr26648274plb.118.1520561584218; Thu, 08 Mar 2018 18:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520561584; cv=none; d=google.com; s=arc-20160816; b=Cv/N3SIlqDiUXhFACir/vXJnrVLyucDhPpxoknnQJWXoMcrp7XZpSDWwgNqS183Ypx /S3bKrZoBWFBWMZf6Q/oZjsr7YqGipDTXqXv4liKgPOiShooQ+1F2rps29Mu+xCSOg1V gySuigVEcO69EUm4qmD4/w6gmBglLckw5E5hJmph0rMHJ5/Y2IycaFz8tqAV8dzTiGmt HbiuaSNlp7nEMtscb1QKZdLnluZy292YBZb6Z7PE6tSYMEK2i153Zy546iI1lgFnxJdk l5vCpbSMAQQpt/ZYwxdB5FcF5KJXQr0T1LzkYCor+VSNlBFjYxdLZ4ratlexCgfQqPD9 Ahzg== 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=zgGG57nEV3KOxK35LVM5QYprP30oMgIwui2qA6Cyuag=; b=xz6PZ8WJ1wnmDzOL465Qf35HnoYJPAJBsqmXhyme6jAural+SGage+AiotvhDSy4Wn oa8c7ZkmEWA9+jyu0T+YGReC/uq3LHGlMlMZgpctVDLHgASUSzZYGafZdQgA35fkUjYf z9/liz4UhF7YpS5iLt785cSW901OpbOQPBkRJfeNkHvs8lJUvxwtwKaQMdmwDfpDikjP tqWk23WnU8VWm20JGqAkR0zIWHQaiGdYC1VLCHDmIoLwYu7I1b+AIZtK9IqfBGMTNKJb lP75UvwzCtGmzsWOBxJPGdkgaIeUXLA3jmd8lM0SCJpKLULzH0wdEEN5Bb5ZMpbMCT16 Cy4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=gmOzhnJR; 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 w20-v6si15141126plp.638.2018.03.08.18.12.48; Thu, 08 Mar 2018 18:13:04 -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=gmOzhnJR; 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 S1751857AbeCIB7r (ORCPT + 99 others); Thu, 8 Mar 2018 20:59:47 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:58524 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113AbeCIB7p (ORCPT ); Thu, 8 Mar 2018 20:59:45 -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 w291vugX016103; Fri, 9 Mar 2018 01:59:23 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=zgGG57nEV3KOxK35LVM5QYprP30oMgIwui2qA6Cyuag=; b=gmOzhnJRyqxHvakFKrn6molcV55CZ1pBPr8kHQCc+MpoOpDTdEh6XOKA6KPVl9bh7BkO Ub9W5eWL8SkIgUIhk5uSqX1SOmYS9Man7UHfztCkcMWKEHEMj/NfaWUS/+ym0xF/Jtfl fZMydoUYqwmqjWraKyPtA1YGsSNxB2cvxx1Og0VkRjXz2oWWZeNh0bCDgzfDlIiR8mio 6PhMq4ERXAjDtOQVv7i3PiyWi6oRS6mOm7bRnpuKHdZkgIlhRZxgJ/PtswpIOPW1Ybi8 eYQtQpRN156yC3Wtm/9JBnSObZKBJsZKDG2DkosxiVjirrY1fTWuo8m+KhWg/MEkWa7y 0g== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2gkfmpr8hs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Mar 2018 01:59:23 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w291xLgx023832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Mar 2018 01:59:22 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w291xKVh029837; Fri, 9 Mar 2018 01:59:21 GMT Received: from [10.182.70.180] (/10.182.70.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Mar 2018 17:59:20 -0800 Subject: Re: [PATCH V4 2/5] nvme: add helper interface to flush in-flight requests To: Sagi Grimberg , keith.busch@intel.com, axboe@fb.com, hch@lst.de Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org References: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> <1520489971-31174-3-git-send-email-jianchao.w.wang@oracle.com> <931a03f8-9c8b-fec4-0f89-04321a906710@grimberg.me> From: "jianchao.wang" Message-ID: <35c68f2a-8198-7db6-c381-420ac996802a@oracle.com> Date: Fri, 9 Mar 2018 09:59:28 +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: <931a03f8-9c8b-fec4-0f89-04321a906710@grimberg.me> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8826 signatures=668687 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-1803090023 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sagi Thanks for your precious time for review and comment. On 03/09/2018 02:21 AM, Sagi Grimberg wrote: >> +EXPORT_SYMBOL_GPL(nvme_abort_requests_sync); >> + >> +static void nvme_comp_req(struct request *req, void *data, bool reserved) > > Not a very good name... Yes, indeed. > >> +{ >> +    struct nvme_ctrl *ctrl = (struct nvme_ctrl *)data; >> + >> +    if (!test_bit(NVME_REQ_ABORTED, &nvme_req(req)->flags)) >> +        return; >> + >> +    WARN_ON(!blk_mq_request_started(req)); >> + >> +    if (ctrl->tagset && ctrl->tagset->ops->complete) { > > What happens when this called on the admin tagset when the controller > does not have an io tagset? Yes, nvme_ctrl.admin_tagset should be used here for adminq request. > >> +        clear_bit(NVME_REQ_ABORTED, &nvme_req(req)->flags); >> +        /* >> +         * We set the status to NVME_SC_ABORT_REQ, then ioq request >> +         * will be requeued and adminq one will be failed. >> +         */ >> +        nvme_req(req)->status = NVME_SC_ABORT_REQ; >> +        /* >> +         * For ioq request, blk_mq_requeue_request should be better >> +         * here. But the nvme code will still setup the cmd even if >> +         * the RQF_DONTPREP is set. We have to use .complete to free >> +         * the cmd and then requeue it. > > IMO, its better to fix nvme to not setup the command if RQF_DONTPREP is on (other than the things it must setup). Yes, I used to consider change that. But I'm not sure whether there is special consideration there. If you and Keith think it is ok that not setup command when RQF_DONTPREP is set, we could do that. > >> +         * >> +         * For adminq request, invoking .complete directly will miss >> +         * blk_mq_sched_completed_request, but this is ok because we >> +         * won't have io scheduler for adminq. >> +         */ >> +        ctrl->tagset->ops->complete(req); > > I don't think that directly calling .complete is a good idea... Yes, indeed. Thanks a lot Jianchao