From nobody Tue Feb 21 21:47:38 2023 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 4PLtDp40c1z3tGwl; Tue, 21 Feb 2023 21:47:38 +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 4PLtDp3J9Cz4JJG; Tue, 21 Feb 2023 21:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677016058; 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=LeQtD6vCx7yDpl4mrfv5FuPMkV8/vcm/B4zcEEluKrU=; b=dL5eZmI45SJ+uVIjQZeDjl5HLv7cV4vD2Uo6jOVUjflkn/JK+OBzf5OGTKvwOhclE2oPSk AgOSgOvGNs7oqu0aOLqHj3MG8PhyvsnpSp2QK9sAnzU3dVy8ARJDcrBG5BWtMaqXbOp8W8 8W/t4CYJ8qGFatYPo/BdC61GnONYLIEjDCcAQYv1AIcUoEyuqaKCWB+dxRjZF99Bbgtykq G+M+NUILngtJoFicBuu9JXL8cHG06aE8/5FwuoaLS+hCpN0Ku1KCi0FNY9FCfUeylqnvMf kp6FX5Yr682oyYO72uSfBUlGJsn+1mZcYgvNJJtOGjAcGQziFNLvLLNSd19LEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677016058; 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=LeQtD6vCx7yDpl4mrfv5FuPMkV8/vcm/B4zcEEluKrU=; b=mXfLboJKMHBIWwhdyNcv/nfenYZoIVKiQU4AHa3Jy2CHCcXzFtYaljKrbIhekRo7IMw3qi Xpg9i8Jcq+kLQTECq+ROVL4/S0JLhgIE3LqoqnMGnsYJyEbmgGRPRwV7D9la+Md4FTEFM0 tU92eBzLyC/V7OE6UmLuBa7lq2nf0sgADiwHpb6Ak/glWZ608w1C6eV1GrkAOXsU1jqLuE yh57PXwmJlLIqoYwdEfisQiO8rfTZynBDwXKPLgOdOwy6T9OuA4oJL60hOo/EQQaAtT6Ue ajBqAGX/sfPDQBqpTK+j+O/Z3PtG6VMxJYznzYj3fTxYkmYRL6aikVHmtsjm6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677016058; a=rsa-sha256; cv=none; b=U2SE2J49vim9xVzR7lmM9NTuqq+rwQ8V5toS69VQwVUO02VRrlmUa5DiwbqIvJYnXREGFi 4oEkO3PSzJTLiqF7yNDToy1q9NAUfAIY5Q3doH+4fivOjI6uWIU1SqyhE076TISXGPwN2l eQp1xDSYrfyVWew3//NE4UtO7HhyvwkhAPPvE4KQ/ImVrxR4EZdKv+CuIRSirYz0ICbcEg 0ZqJchyaUFQMaA6SjBU7R4Kazpm36jgxZ+dpMNxG0P9LZksSYdq/LYR5aKwPj77uRS429F A6Sts/tajDnveTrhSe0T7UOTXGraxgXk8AB6gis0w62znAsCccrHKy+v9lT55w== 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 4PLtDp1Nz4zbqL; Tue, 21 Feb 2023 21:47:38 +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 31LLlcNf081810; Tue, 21 Feb 2023 21:47:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LLlcwZ081809; Tue, 21 Feb 2023 21:47:38 GMT (envelope-from git) Date: Tue, 21 Feb 2023 21:47:38 GMT Message-Id: <202302212147.31LLlcwZ081809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 76578d601e7f - main - bblog: improve timeout event handling 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76578d601e7fae45edd397b9863b77c3029483ab Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=76578d601e7fae45edd397b9863b77c3029483ab commit 76578d601e7fae45edd397b9863b77c3029483ab Author: Michael Tuexen AuthorDate: 2023-02-21 21:38:18 +0000 Commit: Michael Tuexen CommitDate: 2023-02-21 21:46:15 +0000 bblog: improve timeout event handling Extend the BBLog RTO event to deal with all timers of the base stack. Also provide information about starting, stopping, and running off. The expiration of the retransmission timer is reported as it was done before. Reviewed by: rscheff@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D38710 --- sys/netinet/tcp_timer.c | 45 +++++++++++++++++++++++++++++++++++++++++---- sys/netinet/tcp_var.h | 7 +++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 0186d6a9827a..019f01391f22 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -542,7 +542,6 @@ tcp_timer_rexmt(struct tcpcb *tp) TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); CURVNET_SET(inp->inp_vnet); tcp_free_sackholes(tp); - TCP_LOG_EVENT(tp, NULL, NULL, NULL, TCP_LOG_RTO, 0, 0, NULL, false); if (tp->t_fb->tfb_tcp_rexmit_tmr) { /* The stack has a timer action too. */ (*tp->t_fb->tfb_tcp_rexmit_tmr)(tp); @@ -790,6 +789,35 @@ tcp_timer_rexmt(struct tcpcb *tp) return (rv); } +static void +tcp_bblog_timer(struct tcpcb *tp, tt_which which, tt_what what, uint32_t ticks) +{ + struct tcp_log_buffer *lgb; + uint64_t ms; + + INP_WLOCK_ASSERT(tptoinpcb(tp)); + if (tp->t_logstate != TCP_LOG_STATE_OFF) + lgb = tcp_log_event_(tp, NULL, NULL, NULL, TCP_LOG_RTO, 0, 0, + NULL, false, NULL, NULL, 0, NULL); + else + lgb = NULL; + if (lgb != NULL) { + lgb->tlb_flex1 = (what << 8) | which; + if (what == TT_STARTING) { + /* Convert ticks to ms and store it in tlb_flex2. */ + if (hz == 1000) + lgb->tlb_flex2 = ticks; + else { + ms = (((uint64_t)ticks * 1000) + (hz - 1)) / hz; + if (ms > UINT32_MAX) + lgb->tlb_flex2 = UINT32_MAX; + else + lgb->tlb_flex2 = (uint32_t)ms; + } + } + } +} + static inline tt_which tcp_timer_next(struct tcpcb *tp, sbintime_t *precision) { @@ -816,6 +844,7 @@ tcp_timer_enter(void *xtp) struct inpcb *inp = tptoinpcb(tp); sbintime_t precision; tt_which which; + bool tp_valid; INP_WLOCK_ASSERT(inp); MPASS((curthread->td_pflags & TDP_INTCPCALLOUT) == 0); @@ -827,7 +856,10 @@ tcp_timer_enter(void *xtp) tp->t_timers[which] = SBT_MAX; tp->t_precisions[which] = 0; - if (tcp_timersw[which](tp)) { + tcp_bblog_timer(tp, which, TT_PROCESSING, 0); + tp_valid = tcp_timersw[which](tp); + if (tp_valid) { + tcp_bblog_timer(tp, which, TT_PROCESSED, 0); if ((which = tcp_timer_next(tp, &precision)) != TT_N) { callout_reset_sbt_on(&tp->t_callout, tp->t_timers[which], precision, tcp_timer_enter, @@ -847,6 +879,7 @@ tcp_timer_activate(struct tcpcb *tp, tt_which which, u_int delta) { struct inpcb *inp = tptoinpcb(tp); sbintime_t precision; + tt_what what; #ifdef TCP_OFFLOAD if (tp->t_flags & TF_TOE) @@ -855,11 +888,15 @@ tcp_timer_activate(struct tcpcb *tp, tt_which which, u_int delta) INP_WLOCK_ASSERT(inp); - if (delta > 0) + if (delta > 0) { + what = TT_STARTING; callout_when(tick_sbt * delta, 0, C_HARDCLOCK, &tp->t_timers[which], &tp->t_precisions[which]); - else + } else { + what = TT_STOPPING; tp->t_timers[which] = SBT_MAX; + } + tcp_bblog_timer(tp, which, what, delta); if ((which = tcp_timer_next(tp, &precision)) != TT_N) callout_reset_sbt_on(&tp->t_callout, tp->t_timers[which], diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index cd457893e36f..1be3244e15c5 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -135,6 +135,13 @@ typedef enum { TT_N, } tt_which; +typedef enum { + TT_PROCESSING = 0, + TT_PROCESSED, + TT_STARTING, + TT_STOPPING, +} tt_what; + /* * Tcp control block, one per tcp connection. */