From nobody Mon Jan 10 14:40:45 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 D991C1947D7A; Mon, 10 Jan 2022 14:40:45 +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 4JXc254GkGz3N03; Mon, 10 Jan 2022 14:40:45 +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 737D326D51; Mon, 10 Jan 2022 14:40:45 +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 20AEejq5088617; Mon, 10 Jan 2022 14:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20AEejqh088616; Mon, 10 Jan 2022 14:40:45 GMT (envelope-from git) Date: Mon, 10 Jan 2022 14:40:45 GMT Message-Id: <202201101440.20AEejqh088616@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: 618d49f5cad1 - main - Revert "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: 618d49f5cad1dfd59eab6561ecf93d053610609d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641825645; 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=F36IMzAofeCtjmjV6GAMMz7MOcdBNQTKQp8I7e9mxWc=; b=LZrwv4ZWJ0XgliGGj5hKQGud1QzVTEOloxj9Gqkh7vurg9Jv0qgJC5RU2XEQTLlRucmScr 31gnTGxw/vH1RML4pcEIQfxspNdoJrQwJ8Vq/cM8n4QxPOIOxfmlfNKAPEnY1Xa+T/pxr8 1HeAjj1EW71RyoLfDAkr/zv9N19xzsYRrdxc+FoxlY5uYPQJ00okeLQbrCcRCZoEJydmBQ TZgseN9FPeQ8IHRvFS1j/Vz/3ymck814AaAym3DvS9GQJsvtdU+FhFakoqYZ4AHqjncA8C PuWrxtUomFLc2G+irAE33ppwTPtOhNsoZfQPxZRPme7QULxfimnw2c79BQtEWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641825645; a=rsa-sha256; cv=none; b=AoAHLc+BivHhz9Tm5GTOC8mTauQftvonUDZOBXJLmUuUyVS+A3h7RKq3ogmSiOxHBmWe6W KGOmHUgdZlFulgs5kcJpV6lLMGgj7/7Ma5+kBB3Xc0Rh5J/agoanQ63/x0rM7T5yqf9AYc wGYjjtW6DE4IQ89E7imZW1RNF198RhTJcGeiJAqjmSmrscWs68cAbqxTRFqcYkZZW1ZsZH q0S9ZkKFDgd50xZ3N6lu2n5ZgErDs+ki5iisZi74zVFyj5PZr8SO7tmecaC9pQIL1PdQHK j9/bPM3GctudFxc/SHKSSx9b6r8yqYH6NSJT2BqpG+T4iovdxerMrRVZ4Mz1GQ== 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=618d49f5cad1dfd59eab6561ecf93d053610609d commit 618d49f5cad1dfd59eab6561ecf93d053610609d Author: Alexander Motin AuthorDate: 2022-01-10 14:35:01 +0000 Commit: Alexander Motin CommitDate: 2022-01-10 14:40:38 +0000 Revert "iflib: Relax timer period from 0.5 to 0.5-0.75s." I've noticed relations between iflib_timer() vs ixl_admin_timer(). Both scheduled at the same 2Hz rate, but the second is rescheduling the first each time, so if the first get any slower, it won't be executed at all. Revert this until deeper investigation. This reverts commit 90bc1cf65778aafb1f226c8fe08218cfed5e40b2. --- sys/net/iflib.c | 56 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 180b42731e1f..3fcab699f9e0 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -337,6 +337,7 @@ 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; @@ -586,9 +587,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_period = 500; -SYSCTL_INT(_net_iflib, OID_AUTO, timer_period, CTLFLAG_RW, - &iflib_timer_period, 0, "milliseconds between iflib_timer calls"); +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"); #if IFLIB_DEBUG_COUNTERS @@ -2392,6 +2393,7 @@ 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; @@ -2401,28 +2403,30 @@ iflib_timer(void *arg) ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - 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; - + 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; + } /* 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_sbt_on(&txq->ift_timer, - iflib_timer_period * SBT_1MS, 0, - iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1)); + 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); return; hung: @@ -2540,9 +2544,8 @@ done: IFDI_INTR_ENABLE(ctx); txq = ctx->ifc_txqs; for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) - callout_reset_sbt_on(&txq->ift_timer, - iflib_timer_period * SBT_1MS, 0, - iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1)); + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, + txq->ift_timer.c_cpu); /* Re-enable txsync/rxsync. */ netmap_enable_all_rings(ifp); @@ -4064,9 +4067,8 @@ _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_sbt_on(&txq->ift_timer, - iflib_timer_period * SBT_1MS, 0, - iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1)); + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, + txq->ift_timer.c_cpu); } IFDI_LINK_INTR_ENABLE(ctx); if (do_reset) @@ -5719,7 +5721,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); }