From nobody Fri Jan 21 02:27:00 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4AF66196914D; Fri, 21 Jan 2022 02:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jg3DP6NGNz4nn6; Fri, 21 Jan 2022 02:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642732022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h39UslEZURh2cLoYAzGfNq5PA/n0pcPkwf8dKNNFN5c=; b=xMn4grqIUwW/OaLlG6AtvRYCiPifl6K0HszYnqIsI4ihZxjmr/DCn9utDB30JV4MK7E03Y dFKjAtLSqYFhzLQ3621mo3rI1Cr3J3CeoxAHp+ttnM7FDTn26fP900VdtuZlEuZYbQKYtW dpgt1AvVproofextWrowu98EkfZh5pXiXkj7p1ubdN7UTcIA0UkCAQAQetB2QXhrF8fsOe +g8IoQ8jAd9XMX+FgTTVjmTmdNGLX97y7qv0ttEPZSDUh+UfdDtHOadW+2QxlOwg7ZCCt0 o+5+orCqwSnQ88eXO0KuBgOmb4BeOGej8RXUwWFjRnv24g9st1TTKJlbMiDz+g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8F9E134F2; Fri, 21 Jan 2022 02:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20L2R02k001408; Fri, 21 Jan 2022 02:27:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20L2R0iO001407; Fri, 21 Jan 2022 02:27:00 GMT (envelope-from git) Date: Fri, 21 Jan 2022 02:27:00 GMT Message-Id: <202201210227.20L2R0iO001407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 932df0a25861 - stable/13 - nvme: Remove pause while resetting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 932df0a258617a8b22001e1d213826b3549d6e46 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642732022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h39UslEZURh2cLoYAzGfNq5PA/n0pcPkwf8dKNNFN5c=; b=bcmYtY+8FGd4loRaPhDwFRTIJa2d5xhGRQjllBezgC7wGdKSuP2zlqPlpINO4HibrtWjvj 55W3bdjjaCgMejYb9r7URWM/5YtJJeCGWeBPTqgkXIBnA0i/v6ZcVdTN/nYU+G28wJyE7N rFeUbnGoRLptkjH365K3Or2fkbTnqFAlwGUcHYxn7vyck7CYeOuUzcjK+bkOa0IpNMxktw UvCkx0NYqhr2CqKlEOWOkQBN2XZNmr1o+2jRXbfIj1Wl6iT2ZgrG+bSAuLp561Yc8Ya+o/ hAhh9/0SAkD2P8L7Q82C3gLWgydGQ2skw5aAgoTpbKRpDbJY4uWneuOgC4W6yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642732022; a=rsa-sha256; cv=none; b=vs42s1GlNedDO3tsJCJss7avVAQptnPTDq6L11VJCg3HgFuCI2dOi7xJ1zCyjApt5/3LM3 YnfeZaxhfP6miKSfiv2uIvuKwT54gXqPg4yh/zGb9/S2VYMX6cj4yJkBzDdumj9MSNEtSq km5zYPeovYUwVPgiBpsq5ZsgU8x0oGpQ1E/9hn7xyCcLLUEDlUPCSNIZcEb8HVx5bs0v5Y BM1G5ZeYrIpHejvfk0K+6SkwXLt+fz0gDNjmFtGh0iAjcte24V5lDyJyz2MQ1pF77vyK9k VFzxm74TQn0kuBwXyz0DWNAQFiwBZEy8jClWTe6TSeScxSA8T8zWV+y/pGkrWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=932df0a258617a8b22001e1d213826b3549d6e46 commit 932df0a258617a8b22001e1d213826b3549d6e46 Author: Warner Losh AuthorDate: 2021-10-01 17:09:05 +0000 Commit: Alexander Motin CommitDate: 2022-01-21 02:07:30 +0000 nvme: Remove pause while resetting After some study of the code and the standard, I think we can just drop the pause(), unconditionally. If we're not initialized, then there's nothing to wait for from a software perspective. If we are initialized, then there might be outstanding I/O. If so, then the qpair 'recovery state' will transition to WAITING in nvme_ctrlr_disable_qpairs, which will ignore any interrupts for items that complete before we complete the reset by setting cc.en=0. If we go on to fail the controller, we'll cancel the outstanding I/O transactions. If we reset the controller, the hardware throws away pending transactions and we retry all the pending I/O transactions. Any transactions that happend to complete before cc.en=0 will have the same effect in the end (doing the same transaction twice is just inefficient, it won't affect the state of the device any differently than having done it once). The standard imposes no wait times here, so it isn't needed from that perspective. Unanswered Question: Do we may need to disable interrupts while we disable in legacy mode since those are level-sensitive. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32248 (cherry picked from commit e5e26e4a24a1142e02a9b477877e13ed0c194f36) --- sys/dev/nvme/nvme_ctrlr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index eb95fa33b90b..d0be0da39902 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -410,13 +410,13 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) int err; TSENTER(); - nvme_ctrlr_disable_qpairs(ctrlr); - pause("nvmehwreset", hz / 10); + nvme_ctrlr_disable_qpairs(ctrlr); err = nvme_ctrlr_disable(ctrlr); if (err != 0) return err; + err = nvme_ctrlr_enable(ctrlr); TSEXIT(); return (err); @@ -1653,13 +1653,10 @@ nvme_ctrlr_suspend(struct nvme_controller *ctrlr) * flushes any metadata the drive may have stored so it can survive * having its power removed and prevents the unsafe shutdown count from * incriminating. Once we delete the qpairs, we have to disable them - * before shutting down. The delay is out of paranoia in - * nvme_ctrlr_hw_reset, and is repeated here (though we should have no - * pending I/O that the delay copes with). + * before shutting down. */ nvme_ctrlr_delete_qpairs(ctrlr); nvme_ctrlr_disable_qpairs(ctrlr); - pause("nvmesusp", hz / 10); nvme_ctrlr_shutdown(ctrlr); return (0);