git: f4d499fd6702 - main - CTL: Relax callouts precisions.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Fri, 07 Jan 2022 19:32:16 UTC
The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=f4d499fd670283ee09f8870088c1b394843ae468

commit f4d499fd670283ee09f8870088c1b394843ae468
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2022-01-07 19:30:44 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-01-07 19:30:44 +0000

    CTL: Relax callouts precisions.
    
    MFC after:      2 weeks
---
 sys/cam/ctl/ctl.c     | 7 ++++---
 sys/cam/ctl/ctl_tpc.c | 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 069b01cc04b1..7b2c73693f9c 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -5903,7 +5903,8 @@ ctl_ie_timer(void *arg)
 		t = scsi_4btoul(lun->MODE_IE.interval_timer);
 		if (t == 0 || t == UINT32_MAX)
 			t = 3000;  /* 5 min */
-		callout_schedule(&lun->ie_callout, t * hz / 10);
+		callout_schedule(&lun->ie_callout, SBT_1S / 10 * t,
+		    SBT_1S / 10, 0);
 	}
 }
 
@@ -5935,8 +5936,8 @@ ctl_ie_page_handler(struct ctl_scsiio *ctsio,
 			t = scsi_4btoul(pg->interval_timer);
 			if (t == 0 || t == UINT32_MAX)
 				t = 3000;  /* 5 min */
-			callout_reset(&lun->ie_callout, t * hz / 10,
-			    ctl_ie_timer, lun);
+			callout_reset_sbt(&lun->ie_callout, SBT_1S / 10 * t,
+			    SBT_1S / 10, ctl_ie_timer, lun, 0);
 		}
 	} else {
 		lun->ie_asc = 0;
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index 60cd5611643d..66ac2a1023e9 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -187,7 +187,7 @@ tpc_timeout(void *arg)
 		free(token, M_CTL);
 	}
 	mtx_unlock(&softc->tpc_lock);
-	callout_schedule(&softc->tpc_timeout, hz);
+	callout_schedule_sbt(&softc->tpc_timeout, SBT_1S, SBT_1S, 0);
 }
 
 void
@@ -197,7 +197,8 @@ ctl_tpc_init(struct ctl_softc *softc)
 	mtx_init(&softc->tpc_lock, "CTL TPC mutex", NULL, MTX_DEF);
 	TAILQ_INIT(&softc->tpc_tokens);
 	callout_init_mtx(&softc->tpc_timeout, &softc->ctl_lock, 0);
-	callout_reset(&softc->tpc_timeout, hz, tpc_timeout, softc);
+	callout_reset_sbt(&softc->tpc_timeout, SBT_1S, SBT_1S,
+	    tpc_timeout, softc, 0);
 }
 
 void