From nobody Tue Jan 16 19:05:13 2024 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 4TDz3Z3xpjz57qrm; Tue, 16 Jan 2024 19:05:14 +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 4TDz3Z1b5gz54Qd; Tue, 16 Jan 2024 19:05:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705431914; 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=3t0+ub8gXJGEUlO10m3dnG9piPwud2k81lwXFdAFYnQ=; b=T+OCyX6ukKI/P2/GmR7Nc6Ys8Re/UBWro5CiC95s9M0NtJXuQiw4U7GkDkHop5tcKvJb6D rr6wRAVvTvbjcfZmM/kwv+TyQfsm6JdIrN9cjlrpuF3sFg45SL3K4A8ZeqG9hRzRN4UZy7 KEwI56+LaJSX9bEHVCgcv1gUTRA6Tw6MrwH7SHzZCvSTZLbdv0zsYYs3z1hKHrpw/xS/vK fhTsVF07SqQnLPZY/niYDR5YpAots06aMCGAjI4Z3LCl09DicOwHNMpbgedmSZ+buF2O2D CuXMoS7O69XfF87XwEDbwo6Fs+UPcBi0/fVGIBkVxoT2mUHrehbdaVPcZSfOyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705431914; 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=3t0+ub8gXJGEUlO10m3dnG9piPwud2k81lwXFdAFYnQ=; b=rTklWcgMVrxr2g+TwBphN6QLHXW43SeFE2jlParO2VIW7LmzKS7uq9K0INZKglnfcMVNwA kA0+txXh3Qa5cAV69oOHHG4Ya2kzL6+PkHOLsGYuJKSfMQwW73xtLWL2+zYvXe8Mu0onLr DGKGF5LW3Q5rryB59yr0Pbhyet8I23Ke/6KW9vJ0LA3jLbtkguqTFilseTdZOw1AN57fI5 jKJEa6Aw7QySfsKUWdD5i3WwrlFxA0mD2pNw++9gBz7BaBo7jzaF0tNPw+5bv7YWMuYtFx qqW0ZKyE3qjHRoNdkEWfsLWQABmw6g65HgqOVWT/3uQabrY3GVK+5WJEyU9Q+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705431914; a=rsa-sha256; cv=none; b=nbpOiQLJv5snYHSF+AbJSjLs4jldL8zOYxKmhiAGWEMVcdKcGsmFJjr7tE+QzYHNPfUP6w NHzYZY+fzPF9jndLb3p9LuHhUaL7JJFT/bU8/rCqeGA6wqCdl87BfaZWlRnKqpF5emKQDb pglbJu3phSMKTxxGo5M4bDcegiBg/CUle3dTEy0n0wb3jOLrBZg/UnObOg4VlxyyewPM+U G8rqnXQ4WhHNyvFyMCfdt7ENhlxXhCc2FamzOXbUSV6ztEXtrOcJBjhilRUE1HjxQFdpdj 7LQklQs4EHAMphkbxbhJZMPvzTRSX0GWouL1Q6RInNjAQC4Z+4uitKPd769T8g== 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 4TDz3Z0ByBzs8c; Tue, 16 Jan 2024 19:05:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40GJ5D9S010115; Tue, 16 Jan 2024 19:05:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40GJ5Dxs010112; Tue, 16 Jan 2024 19:05:13 GMT (envelope-from git) Date: Tue, 16 Jan 2024 19:05:13 GMT Message-Id: <202401161905.40GJ5Dxs010112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Smirnoff Subject: git: 08cad73479df - stable/14 - tcp/hpts: make stacks responsible for clearing themselves out HPTS 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 08cad73479df9ba6aab280af1cfd2eacb508a5a7 Auto-Submitted: auto-generated The branch stable/14 has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=08cad73479df9ba6aab280af1cfd2eacb508a5a7 commit 08cad73479df9ba6aab280af1cfd2eacb508a5a7 Author: Gleb Smirnoff AuthorDate: 2023-12-04 18:19:46 +0000 Commit: Gleb Smirnoff CommitDate: 2024-01-16 18:47:49 +0000 tcp/hpts: make stacks responsible for clearing themselves out HPTS There already is the tfb_tcp_timer_stop_all method that is supposed to stop all time events associated with a given tcpcb by given stack. Some time ago it was doing actual callout_stop(). Today bbr/rack just mark their internal state as inactive in their tfb_tcp_timer_stop_all methods, but tcpcb stays in HPTS wheel and potentially called in from HPTS. Change the methods to also call tcp_hpts_remove(). Note: I'm not sure if internal flag is still relevant once we are out of HPTS wheel. Call the method when connection goes into TCP_CLOSED state, instead of calling it later when tcpcb is freed. Also call it when we switch between stacks. Reviewed by: tuexen, rrs Differential Revision: https://reviews.freebsd.org/D42857 (cherry picked from commit d2ef52ef3dee38cccb7f54d33ecc2a4b944dad9d) --- sys/netinet/tcp_stacks/bbr.c | 3 +++ sys/netinet/tcp_stacks/rack.c | 4 ++++ sys/netinet/tcp_subr.c | 8 ++------ sys/netinet/tcp_usrreq.c | 6 ++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 3805a911df41..c643f0321099 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -5278,6 +5278,9 @@ bbr_stopall(struct tcpcb *tp) bbr = (struct tcp_bbr *)tp->t_fb_ptr; bbr->rc_all_timers_stopped = 1; + + tcp_hpts_remove(tp); + return (0); } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index af03f2e1640c..db8131ffb377 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -8213,8 +8213,12 @@ static int rack_stopall(struct tcpcb *tp) { struct tcp_rack *rack; + rack = (struct tcp_rack *)tp->t_fb_ptr; rack->t_timers_stopped = 1; + + tcp_hpts_remove(tp); + return (0); } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 19d71a9e9058..023078d1d4f9 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2381,9 +2381,6 @@ tcp_discardcb(struct tcpcb *tp) INP_WLOCK_ASSERT(inp); tcp_timer_stop(tp); - if (tp->t_fb->tfb_tcp_timer_stop_all) { - tp->t_fb->tfb_tcp_timer_stop_all(tp); - } /* free the reassembly queue, if any */ tcp_reass_flush(tp); @@ -2523,9 +2520,8 @@ tcp_close(struct tcpcb *tp) tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; } -#ifdef TCPHPTS - tcp_hpts_remove(tp); -#endif + if (tp->t_fb->tfb_tcp_timer_stop_all != NULL) + tp->t_fb->tfb_tcp_timer_stop_all(tp); in_pcbdrop(inp); TCPSTAT_INC(tcps_closed); if (tp->t_state != TCPS_CLOSED) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 767045480abf..f65b09f17a5f 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1759,10 +1759,8 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) * Ensure the new stack takes ownership with a * clean slate on peak rate threshold. */ -#ifdef TCPHPTS - /* Assure that we are not on any hpts */ - tcp_hpts_remove(tp); -#endif + if (tp->t_fb->tfb_tcp_timer_stop_all != NULL) + tp->t_fb->tfb_tcp_timer_stop_all(tp); if (blk->tfb_tcp_fb_init) { error = (*blk->tfb_tcp_fb_init)(tp, &ptr); if (error) {