From nobody Mon Jan 10 01:44:05 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 833B5193CAB3; Mon, 10 Jan 2022 01:44: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 4JXGnx1s5yz3KZl; Mon, 10 Jan 2022 01:44:05 +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 1FCFA1CD44; Mon, 10 Jan 2022 01:44:05 +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 20A1i5E1051941; Mon, 10 Jan 2022 01:44:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20A1i5oh051940; Mon, 10 Jan 2022 01:44:05 GMT (envelope-from git) Date: Mon, 10 Jan 2022 01:44:05 GMT Message-Id: <202201100144.20A1i5oh051940@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: 90bc1cf65778 - main - iflib: Relax timer period from 0.5 to 0.5-0.75s. 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: 90bc1cf65778aafb1f226c8fe08218cfed5e40b2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641779045; 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=KDoobisqzqd357kymVAnnrcguTWRkbCvzbZjfuJJvjE=; b=SEMJmJoskkBqmxKs19sXD6f4G/ftb7BgjrWf9KUTxnP3Lx35Jcknr9FNaPDToOfM6nCBhK kUeInsN09QY8eVRh/CuOOCDyVYRG31+VRj1DdkSBp/Tlfq/X5okTCkSFbknUBTqvHScmNL sjQytUszkR3XvaT6Vzl69ZjZskpn+kGPxZXb1uwJx0GCyCGaOLYiQwc2lIflCnDPVK5Wka RdCxuN1oilJ2UvrhMmyY2Ithw+tFAx26O3C81nwCnurf01+SQ+ZR4nAcyA+EhAxOXSbEFh 87sgmbud/mIzU2/tQ3rn8EBvFAzvF+ogdyzOEOkBf9yI5Xw26BY2N2+A9S4psA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641779045; a=rsa-sha256; cv=none; b=DReYHaJRi3B4PP6PR/xT0nrvD/gPcX8KC9U2cWMjbelwrDmcKejzFA03tEQItyIfb2N0h6 yfae7q9YM8syDZy18XRsQaNQOMwoIwUEYNk7kFzEdx7bHcUP51lfwHvOyHalYETpKHBiXP 8cYGWFCED9jQINyf/7pbuNJXwKeAV+BBUrsBUsY4/ZVFUt8X9QTaa9xyeOBiRTJz3szc68 EcE4i3uNcxyd9SR7ek+commv6hW7zBJJ8BSFEa7TeQLzr2XJaRLH9cKEPTGsjq+5y3ILKs z7uN/5WxlahgB+DXiEwu8BIdUFuPTkN/V+tKVaUsTr7gslG0TeU0SS5AnuMkDw== 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=90bc1cf65778aafb1f226c8fe08218cfed5e40b2 commit 90bc1cf65778aafb1f226c8fe08218cfed5e40b2 Author: Alexander Motin AuthorDate: 2022-01-10 01:32:50 +0000 Commit: Alexander Motin CommitDate: 2022-01-10 01:32:50 +0000 iflib: Relax timer period from 0.5 to 0.5-0.75s. While there switch it from hardclock ticks to milliseconds. MFC after: 2 weeks --- sys/net/iflib.c | 56 +++++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 3fcab699f9e0..180b42731e1f 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -337,7 +337,6 @@ struct iflib_txq { uint64_t ift_map_failed; uint64_t ift_txd_encap_efbig; uint64_t ift_pullups; - uint64_t ift_last_timer_tick; struct mtx ift_mtx; struct mtx ift_db_mtx; @@ -587,9 +586,9 @@ SYSCTL_INT(_net_iflib, OID_AUTO, min_tx_latency, CTLFLAG_RW, static int iflib_no_tx_batch = 0; SYSCTL_INT(_net_iflib, OID_AUTO, no_tx_batch, CTLFLAG_RW, &iflib_no_tx_batch, 0, "minimize transmit latency at the possible expense of throughput"); -static int iflib_timer_default = 1000; -SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW, - &iflib_timer_default, 0, "number of ticks between iflib_timer calls"); +static int iflib_timer_period = 500; +SYSCTL_INT(_net_iflib, OID_AUTO, timer_period, CTLFLAG_RW, + &iflib_timer_period, 0, "milliseconds between iflib_timer calls"); #if IFLIB_DEBUG_COUNTERS @@ -2393,7 +2392,6 @@ iflib_timer(void *arg) iflib_txq_t txq = arg; if_ctx_t ctx = txq->ift_ctx; if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; - uint64_t this_tick = ticks; if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) return; @@ -2403,30 +2401,28 @@ iflib_timer(void *arg) ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - if (this_tick - txq->ift_last_timer_tick >= iflib_timer_default) { - txq->ift_last_timer_tick = this_tick; - IFDI_TIMER(ctx, txq->ift_id); - if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) && - ((txq->ift_cleaned_prev == txq->ift_cleaned) || - (sctx->isc_pause_frames == 0))) - goto hung; - - if (txq->ift_qstatus != IFLIB_QUEUE_IDLE && - ifmp_ring_is_stalled(txq->ift_br)) { - KASSERT(ctx->ifc_link_state == LINK_STATE_UP, - ("queue can't be marked as hung if interface is down")); - txq->ift_qstatus = IFLIB_QUEUE_HUNG; - } - txq->ift_cleaned_prev = txq->ift_cleaned; - } + IFDI_TIMER(ctx, txq->ift_id); + if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) && + ((txq->ift_cleaned_prev == txq->ift_cleaned) || + (sctx->isc_pause_frames == 0))) + goto hung; + if (txq->ift_qstatus != IFLIB_QUEUE_IDLE && + ifmp_ring_is_stalled(txq->ift_br)) { + KASSERT(ctx->ifc_link_state == LINK_STATE_UP, + ("queue can't be marked as hung if interface is down")); + txq->ift_qstatus = IFLIB_QUEUE_HUNG; + } + txq->ift_cleaned_prev = txq->ift_cleaned; + /* handle any laggards */ if (txq->ift_db_pending) GROUPTASK_ENQUEUE(&txq->ift_task); sctx->isc_pause_frames = 0; - if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) - callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, - txq, txq->ift_timer.c_cpu); + if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) + callout_reset_sbt_on(&txq->ift_timer, + iflib_timer_period * SBT_1MS, 0, + iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1)); return; hung: @@ -2544,8 +2540,9 @@ done: IFDI_INTR_ENABLE(ctx); txq = ctx->ifc_txqs; for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) - callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, - txq->ift_timer.c_cpu); + callout_reset_sbt_on(&txq->ift_timer, + iflib_timer_period * SBT_1MS, 0, + iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1)); /* Re-enable txsync/rxsync. */ netmap_enable_all_rings(ifp); @@ -4067,8 +4064,9 @@ _task_fn_admin(void *context) } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { - callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, - txq->ift_timer.c_cpu); + callout_reset_sbt_on(&txq->ift_timer, + iflib_timer_period * SBT_1MS, 0, + iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1)); } IFDI_LINK_INTR_ENABLE(ctx); if (do_reset) @@ -5721,7 +5719,7 @@ iflib_device_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) static int iflib_module_init(void) { - iflib_timer_default = hz / 2; + return (0); }