Re: git: 62d47d73b7eb - main - tcp: stop timers and clean scoreboard in tcp_close()
Date: Mon, 12 Feb 2024 19:09:53 UTC
In message <202402100934.41A9Y11l044213@gitrepo.freebsd.org>, Richard Scheffene gger writes: > The branch main has been updated by rscheff: > > URL: https://cgit.FreeBSD.org/src/commit/?id=62d47d73b7eb01f3b0a37541df5e7aaa > 36f54335 > > commit 62d47d73b7eb01f3b0a37541df5e7aaa36f54335 > Author: Richard Scheffenegger <rscheff@FreeBSD.org> > AuthorDate: 2024-02-10 09:28:42 +0000 > Commit: Richard Scheffenegger <rscheff@FreeBSD.org> > CommitDate: 2024-02-10 09:30:00 +0000 > > tcp: stop timers and clean scoreboard in tcp_close() > > Stop timers when in tcp_close() instead of doing that in tcp_discardcb(). > A connection in CLOSED state shall not need any timers. Assert that no > timer is rescheduled after that in tcp_timer_activate() and verfiy that > this is also the expected state in tcp_discardcb(). > > PR: 276761 > Reviewed By: glebius, tuexen, #transport > Sponsored by: NetApp, Inc. > Differential Revision: https://reviews.freebsd.org/D43792 > --- > sys/netinet/tcp_subr.c | 4 ++-- > sys/netinet/tcp_timer.c | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c > index 6043a3d458e5..90e1496a822c 100644 > --- a/sys/netinet/tcp_subr.c > +++ b/sys/netinet/tcp_subr.c > @@ -2383,10 +2383,9 @@ tcp_discardcb(struct tcpcb *tp) > #endif > > INP_WLOCK_ASSERT(inp); > + MPASS(!callout_active(&tp->t_callout)); > MPASS(TAILQ_EMPTY(&tp->snd_holes)); > > - tcp_timer_stop(tp); > - > /* free the reassembly queue, if any */ > tcp_reass_flush(tp); > > @@ -2522,6 +2521,7 @@ tcp_close(struct tcpcb *tp) > tcp_fastopen_decrement_counter(tp->t_tfo_pending); > tp->t_tfo_pending = NULL; > } > + tcp_timer_stop(tp); > if (tp->t_fb->tfb_tcp_timer_stop_all != NULL) > tp->t_fb->tfb_tcp_timer_stop_all(tp); > in_pcbdrop(inp); > diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c > index f0eb3bad33cf..ed50659abf8e 100644 > --- a/sys/netinet/tcp_timer.c > +++ b/sys/netinet/tcp_timer.c > @@ -907,6 +907,7 @@ tcp_timer_activate(struct tcpcb *tp, tt_which which, u_in > t delta) > #endif > > INP_WLOCK_ASSERT(inp); > + MPASS(tp->t_state > TCPS_CLOSED); > > if (delta > 0) { > what = TT_STARTING; > Every machine in my farm is getting kernel page faults as of this revision. #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:57 #1 doadump (textdump=textdump@entry=1) at /opt/src/git-src/sys/kern/kern_sh utdown.c:403 #2 0xffffffff806c68b9 in kern_reboot (howto=260) at /opt/src/git-src/sys/kern/kern_shutdown.c:521 #3 0xffffffff806c6dc2 in vpanic (fmt=0xffffffff80ae244b "%s", ap=ap@entry=0xfffffe008304abc0) at /opt/src/git-src/sys/kern/kern_shutdown.c :973 #4 0xffffffff806c6c13 in panic (fmt=<unavailable>) at /opt/src/git-src/sys/kern/kern_shutdown.c:889 #5 0xffffffff80a5b18f in trap_fatal (frame=0xfffffe008304acb0, eva=72) at /opt/src/git-src/sys/amd64/amd64/trap.c:950 #6 0xffffffff80a5b1df in trap_pfault (frame=0xfffffe008304acb0, usermode=false, signo=<optimized out>, ucode=<optimized out>) at /opt/src/git-src/sys/amd64/amd64/trap.c:758 #7 <signal handler called> #8 0xffffffff8084dd72 in cc_cong_signal (tp=0xfffff8008d207540, th=0x0, type=2) at /opt/src/git-src/sys/netinet/tcp_input.c:465 #9 0xffffffff8086ba4f in tcp_timer_rexmt (tp=0xfffff8008d207540) at /opt/src/git-src/sys/netinet/tcp_timer.c:803 #10 0xffffffff8086b1fe in tcp_timer_enter (xtp=0xfffff8008d207540) at /opt/src/git-src/sys/netinet/tcp_timer.c:880 #11 0xffffffff806e603e in softclock_call_cc (c=0xfffff8008d2076d8, cc=cc@entry=0xffffffff820b10c0, direct=direct@entry=0) at /opt/src/git-src/sys/kern/kern_timeout.c:714 #12 0xffffffff806e77b8 in softclock_thread (arg=arg@entry=0xffffffff820b10c0 ) at /opt/src/git-src/sys/kern/kern_timeout.c:846 #13 0xffffffff8067f05f in fork_exit (callout=0xffffffff806e76c0 <softclock_thread>, arg=0xffffffff820b10c0, frame=0xfffffe008304af40) at /opt/src/git-src/sys/kern/kern_fork.c:1157 #14 <signal handler called> #15 0x21ffa5a87b4e3f70 in ?? () When rebooting one of my machines, the others panic as above. This is 100% reproducible when one of the machines in my basement are rebooted. -- Cheers, Cy Schubert <Cy.Schubert@cschubert.com> FreeBSD UNIX: <cy@FreeBSD.org> Web: https://FreeBSD.org NTP: <cy@nwtime.org> Web: https://nwtime.org e^(i*pi)+1=0