From owner-dev-commits-src-main@freebsd.org Mon Jun 21 01:15:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E302965D04C; Mon, 21 Jun 2021 01:15:34 +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 4G7Wmk5pffz3Nlg; Mon, 21 Jun 2021 01:15:34 +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 AF54F13D6D; Mon, 21 Jun 2021 01:15:34 +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 15L1FYpx002266; Mon, 21 Jun 2021 01:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L1FYbM002265; Mon, 21 Jun 2021 01:15:34 GMT (envelope-from git) Date: Mon, 21 Jun 2021 01:15:34 GMT Message-Id: <202106210115.15L1FYbM002265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4afa62be7167 - main - cam: Set the CAM_QOS_VALID when valid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4afa62be71674b76c31ea513d6c470089a6c1848 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2021 01:15:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4afa62be71674b76c31ea513d6c470089a6c1848 commit 4afa62be71674b76c31ea513d6c470089a6c1848 Author: Warner Losh AuthorDate: 2021-06-18 17:57:57 +0000 Commit: Warner Losh CommitDate: 2021-06-21 01:14:13 +0000 cam: Set the CAM_QOS_VALID when valid When the elapsed time of the operation is complete and stored in the QOS field, set the CAM_QOS_VALID bit. In iosched, test to make sure it's set before using it. Sponsored by: Netflix --- sys/cam/cam_iosched.c | 3 ++- sys/cam/cam_xpt.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index ba1bc4843163..d30eb34747e1 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -1685,7 +1685,8 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc, struct bio *bp, printf("Completing command with bio_cmd == %#x\n", bp->bio_cmd); } - if (!(bp->bio_flags & BIO_ERROR) && done_ccb != NULL) { + if ((bp->bio_flags & BIO_ERROR) == 0 && done_ccb != NULL && + (done_ccb->ccb_h.status & CAM_QOS_VALID) != 0) { sbintime_t sim_latency; sim_latency = cam_iosched_sbintime_t(done_ccb->ccb_h.qos.periph_data); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 762feaf5dd49..b0e112868383 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4617,6 +4617,7 @@ xpt_done(union ccb *done_ccb) /* Store the time the ccb was in the sim */ done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); + done_ccb->ccb_h.status |= CAM_QOS_VALID; hash = (u_int)(done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + done_ccb->ccb_h.target_lun) % cam_num_doneqs; queue = &cam_doneqs[hash];