Received: by 10.223.185.116 with SMTP id b49csp6294778wrg; Thu, 8 Mar 2018 05:13:14 -0800 (PST) X-Google-Smtp-Source: AG47ELvkiM1c3ymXr0u2gRpAbH0SxmP2QkpA0y1IGuphjm1xGA5un2VZt2BuJqH30Oyl0jAS1TTb X-Received: by 10.99.191.78 with SMTP id i14mr20298390pgo.95.1520514794529; Thu, 08 Mar 2018 05:13:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520514794; cv=none; d=google.com; s=arc-20160816; b=yLAb9XhU2I/fZuGRNuTtHsGzx8co+HZaHgmj9vA0KuVTYCccva10Xw5Cimmxpd/11B g2K86rG4uGpEFJ/inYwQqBL/Yr6ZtI5FexOxXoQqVnJhfb6qntneWIuw4qHqSnLmQAHa 44ammI9MnjGBD1qq1ECxwfagB6/SKs8G/5W6kPuxsyghdbbzio+VH5e8FI7n7kDxMg7u 1iezq4MFlsz6g82MWTmfm/zF1PyvrjtXIn6EKWDDg2NnCSXFuhNVfLPAft6/LgSLpoJm BliWyuOf1a6X1u3La2kcplWK9JUso29HWJ+ok1zobptDzfalITxWJvzQzktkrIkmdIRS BbBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=RKQ7227Ych/Xb2B3Twogam0oVgh91dloYfyF899hpU8=; b=EYCACIBilAKt30AGvfT3X+ttY2ixtLV79lNdlU1/Oah/RskOonvU8+xnMcyL1ggVGG 8tJSKSVbSzmDp9IC4f+QEpa/l0Itu3okHQMypDB6NsdNlxsG6uIryum9l7JwtnNL0tS0 UXpsUyq7RqA6+NPHl3OKpK/Kw8grpJ+2GvsInLejx+s6rrCCXDJsUiQbHc6orda9lkVY WK7vny8vP+MKB2jjw9l114kUrLGRNfsKJhuhvXwEzhQnuu0FT5u3o6DREutsldqMnsoe U05/4dITqsifsR+2lBfvLIkX8b5lytzfk7nJEC1Pg63ESR6MZqliRJpDcTcrOTbWA1An je9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DtWbS4Ve; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14-v6si14564318plo.778.2018.03.08.05.12.59; Thu, 08 Mar 2018 05:13:14 -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=@gmail.com header.s=20161025 header.b=DtWbS4Ve; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935798AbeCHNLz (ORCPT + 99 others); Thu, 8 Mar 2018 08:11:55 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35509 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935769AbeCHNLy (ORCPT ); Thu, 8 Mar 2018 08:11:54 -0500 Received: by mail-wr0-f193.google.com with SMTP id l43so5633105wrc.2 for ; Thu, 08 Mar 2018 05:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=RKQ7227Ych/Xb2B3Twogam0oVgh91dloYfyF899hpU8=; b=DtWbS4VefDmbWIUDaY6lWL29y94e+DZSPDLEOYlQFgFawizPdbwH3+8jOnyFqwF9B6 3F9qrcFHmtZ9msc+pvgyOZD3PivqJB+bbSG/s6iA6DmiqP7l8ez8LZH5mJKgwKuRyqn7 HlsagzX0ymZZDvGDxoX6fcf53GuLa7ZqvWb+dzbWREHqO0IIEUGzeNDKklINk+/bn5G7 r3u82qGPIk+8YeYtSF8RMIKEc6Kjx0K+wn9Ug98jvEJ2u7zDfnPH96EmMpj5YWTWR0/u +EsjTGI+elsF8Bb4ri94R3zDHyV8sndL7cXuxiDQ2NHo/qYAZNGtnE6WfgfJKV6UQbfW ix5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RKQ7227Ych/Xb2B3Twogam0oVgh91dloYfyF899hpU8=; b=ITg51+M1xpEWowQJjmJLQQGg3VMA1UuZoTOleOksTp4VHi3ubyuZsj+eZILL2eNzAx zm0N8r8CGqhr/jMjElwHx6sOBjS9B3werenE9Xaom7ISQt5BiTMFmhfSk01hoaJ12Wll Nq8Ze8pml/WC99bMsAA8UCgTHxxLW420WPGvDVnlwscbtBdlX+w5ON2tU3IkReRxpQrv 8pYiUH+Y4njINEL++XDmmWgrrQCRNWt8GVRPbR9YV3pho0955eq4pl1X+0YwARmJO94x a8dBL4C+OVvO+lghbY4NIvqv0OR39jzxGLFU7GdnZgMHypR0SeV4kEiVJIa6RpnrKSD7 CpGA== X-Gm-Message-State: APf1xPCvnQ6Yw71mwbSAI6+TsM7RY3edR4+He2ThxqIRSMVWbZCNpL61 9Am0puxIxWecIfaY870JgFAGbmnh1gjiLehqzo4= X-Received: by 10.223.165.67 with SMTP id j3mr23698867wrb.111.1520514712981; Thu, 08 Mar 2018 05:11:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.177.4 with HTTP; Thu, 8 Mar 2018 05:11:51 -0800 (PST) In-Reply-To: <1520489971-31174-3-git-send-email-jianchao.w.wang@oracle.com> References: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> <1520489971-31174-3-git-send-email-jianchao.w.wang@oracle.com> From: Ming Lei Date: Thu, 8 Mar 2018 21:11:51 +0800 Message-ID: Subject: Re: [PATCH V4 2/5] nvme: add helper interface to flush in-flight requests To: Jianchao Wang Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Linux Kernel Mailing List , linux-nvme Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()? > - 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. Thanks, Ming Lei