From nobody Fri Jan 07 17:59:23 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 B1AF6194B400; Fri, 7 Jan 2022 17:59:24 +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 4JVrZh18NWz4bJR; Fri, 7 Jan 2022 17:59:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 03EF57970; Fri, 7 Jan 2022 17:59:24 +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 207HxNIC082355; Fri, 7 Jan 2022 17:59:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 207HxNTK082354; Fri, 7 Jan 2022 17:59:23 GMT (envelope-from git) Date: Fri, 7 Jan 2022 17:59:23 GMT Message-Id: <202201071759.207HxNTK082354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: b3c9b6060f9a - main - nvme: Do not rearm timeout for commands without one. 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/main X-Git-Reftype: branch X-Git-Commit: b3c9b6060f9a3525196867d8e812b24fc0bc61e1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641578364; 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=tPKfL3UGrzZ8fkm4gFXkVQM7vD+vzDlXkiqioxz8egE=; b=ZHIBshtBkI4mxHqttZbWueb46sK6Y4Hs0VsZyzWPMJpkCouj1d72vHWJ0JbIGavoN/r1t1 79O0bAABMdJuNzqjgYCF5i/hsnpDVwMrmzXiW56YVAUtwYUfEnmUrJIq08RCbt8Myu3cYA +DTmqKU/rxqwtbEMNo7a09A2PjF5C1I19MhrTYw58hZ8FcdiD1MOEeZz6jdh2lyFTYtB0I 65akDAX7J+KymNkABHFpXMehJZilO0Sa5cUB9W9/12YFx/bM8BgeRA1C5LIErw4mQqwYZL FNXP5MUAcD/Pb1at9ARGDYQwF/RbUWsGc54XObS5o6JhJzSspJerfU7chWrUzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641578364; a=rsa-sha256; cv=none; b=sNBvRjrqcv4r6qKyWUQPequ+K+pGglH6GX4Y9sh3w1AyNJjShb2AI7XXKZ8b0f8o9dZUC3 s0o0Ld8ID9xnieSkUl9mm2F6RcPcodUqO0oqq1c3NPcVJvgO3U7R10wDHvOMb01Z9RC7va VYhWWE7yv/qmSdhuueekyI1icDkA0H/E7hd2A+efrvpZu9LQzxOoV4csohPCR3PUONkOqy 8Lz5HH06YO/jS2M1P1OWmShM0X0X3HI6PRNM5B7W4IascjyQGdsoq2nCUUFlK4hUqhitrO Fwsik0lvABIu6uqNpTTEHJLZaxwvqbmWd8zAWqLgg2Lf6/gI623RDZYsNhkaeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b3c9b6060f9a3525196867d8e812b24fc0bc61e1 commit b3c9b6060f9a3525196867d8e812b24fc0bc61e1 Author: Alexander Motin AuthorDate: 2022-01-07 17:54:49 +0000 Commit: Alexander Motin CommitDate: 2022-01-07 17:59:16 +0000 nvme: Do not rearm timeout for commands without one. Admin queues almost always have several ASYNC_EVENT_REQUEST outstanding. They have no timeouts, but their presence in qpair->outstanding_tr caused useless timeout callout rearming twice a second. While there, relax timeout callout period from 0.5s to 0.5-1s to improve aggregation. Command timeouts are measured in seconds, so we don't need to be precise here. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33781 --- sys/dev/nvme/nvme_qpair.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 54718492ff09..0bf485cea47f 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -948,7 +948,6 @@ nvme_qpair_timeout(void *arg) struct nvme_qpair *qpair = arg; struct nvme_controller *ctrlr = qpair->ctrlr; struct nvme_tracker *tr; - struct nvme_tracker *tr_temp; sbintime_t now; bool idle; uint32_t csts; @@ -962,8 +961,12 @@ again: if (idle) break; now = getsbinuptime(); - TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { - if (now > tr->deadline && tr->deadline != 0) { + idle = true; + TAILQ_FOREACH(tr, &qpair->outstanding_tr, tailq) { + if (tr->deadline == SBT_MAX) + continue; + idle = false; + if (now > tr->deadline) { /* * We're now passed our earliest deadline. We * need to do expensive things to cope, but next @@ -1028,7 +1031,7 @@ again: * Rearm the timeout. */ if (!idle) { - callout_schedule(&qpair->timer, hz / 2); + callout_schedule_sbt(&qpair->timer, SBT_1S / 2, SBT_1S / 2, 0); } else { qpair->timer_armed = false; } @@ -1061,8 +1064,8 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) tr->deadline = getsbinuptime() + timeout * SBT_1S; if (!qpair->timer_armed) { qpair->timer_armed = true; - callout_reset_on(&qpair->timer, hz / 2, - nvme_qpair_timeout, qpair, qpair->cpu); + callout_reset_sbt_on(&qpair->timer, SBT_1S / 2, SBT_1S / 2, + nvme_qpair_timeout, qpair, qpair->cpu, 0); } } else tr->deadline = SBT_MAX;