git: 972a7d95ebfa - main - iscsi: Use calloutng instead of ticks in iscsi initiator

From: Richard Scheffenegger <rscheff_at_FreeBSD.org>
Date: Tue, 15 Feb 2022 17:43:42 UTC
The branch main has been updated by rscheff:

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

commit 972a7d95ebfa25dbed9af1b8f4028411a49a2d4f
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2022-02-15 16:35:47 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2022-02-15 16:36:22 +0000

    iscsi: Use calloutng instead of ticks in iscsi initiator
    
    callout *_sbt functions are used to reduce ping/timeout scheduling
    overhead, while allowing later improvments in the functionality.
    Keep similar 1000ms callouts while adding a 10 ms window, to allow
    some kernel scheduling improvements.
    
    Reviewed By: jhb
    Sponsored by:        NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D34222
---
 sys/dev/iscsi/icl_soft_proxy.c |  5 ++++-
 sys/dev/iscsi/iscsi.c          | 10 ++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sys/dev/iscsi/icl_soft_proxy.c b/sys/dev/iscsi/icl_soft_proxy.c
index 22beacb0f941..a0bae7f62e8a 100644
--- a/sys/dev/iscsi/icl_soft_proxy.c
+++ b/sys/dev/iscsi/icl_soft_proxy.c
@@ -173,6 +173,7 @@ void
 icl_listen_free(struct icl_listen *il)
 {
 	struct icl_listen_sock *ils;
+	sbintime_t sbt, pr;
 
 	sx_xlock(&il->il_lock);
 	while (!TAILQ_EMPTY(&il->il_sockets)) {
@@ -184,7 +185,9 @@ icl_listen_free(struct icl_listen *il)
 			ils->ils_socket->so_error = ENOTCONN;
 			SOLISTEN_UNLOCK(ils->ils_socket);
 			wakeup(&ils->ils_socket->so_timeo);
-			pause("icl_unlisten", 1 * hz);
+			sbt = mstosbt(995);
+			pr = mstosbt(10);
+			pause_sbt("icl_unlisten", sbt, pr, 0);
 			sx_xlock(&il->il_lock);
 		}
 
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index aefae6920ae1..1621e31576cf 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -546,6 +546,7 @@ iscsi_callout(void *context)
 	struct iscsi_bhs_nop_out *bhsno;
 	struct iscsi_session *is;
 	bool reconnect_needed = false;
+	sbintime_t sbt, pr;
 
 	is = context;
 
@@ -555,7 +556,9 @@ iscsi_callout(void *context)
 		return;
 	}
 
-	callout_schedule(&is->is_callout, 1 * hz);
+	sbt = mstosbt(995);
+	pr  = mstosbt(10);
+	callout_schedule_sbt(&is->is_callout, sbt, pr, 0);
 
 	if (is->is_conf.isc_enable == 0)
 		goto out;
@@ -1835,6 +1838,7 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
 	struct iscsi_session *is;
 	const struct iscsi_session *is2;
 	int error;
+	sbintime_t sbt, pr;
 
 	iscsi_sanitize_session_conf(&isa->isa_conf);
 	if (iscsi_valid_session_conf(&isa->isa_conf) == false)
@@ -1912,7 +1916,9 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
 		return (error);
 	}
 
-	callout_reset(&is->is_callout, 1 * hz, iscsi_callout, is);
+	sbt = mstosbt(995);
+	pr = mstosbt(10);
+	callout_reset_sbt(&is->is_callout, sbt, pr, iscsi_callout, is, 0);
 	TAILQ_INSERT_TAIL(&sc->sc_sessions, is, is_next);
 
 	ISCSI_SESSION_LOCK(is);