Page MenuHomeFreeBSD

tcp: Make all TCP timers start and stop atomically under the inp_lock (work in progress)
Needs ReviewPublic

Authored by hselasky on Sep 18 2022, 9:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 22, 3:24 PM
Unknown Object (File)
Fri, Sep 19, 10:25 AM
Unknown Object (File)
Sep 10 2025, 5:35 PM
Unknown Object (File)
Aug 17 2025, 10:18 PM
Unknown Object (File)
Jul 25 2025, 6:58 AM
Unknown Object (File)
Apr 26 2025, 6:21 PM
Unknown Object (File)
Mar 3 2025, 1:52 PM
Unknown Object (File)
Feb 26 2025, 6:33 PM
Subscribers

Details

Reviewers
glebius
rscheff
Group Reviewers
transport
Summary

Pass the RW-lock to be used when setting up callouts for the TCP stack.
This ensures that several lingering state checks can simply be removed.

MFC after: 1 week
Sponsored by: NVIDIA Networking

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

hselasky retitled this revision from tcp: Make all TCP timers behave atomically (work in progress) to tcp: Make all TCP timers start and stop atomically under the inp_lock (work in progress).

Shouldn't these flags be cleared in the tcp_timer_stop() function?

I think this patch is in the right direction. Does it allow to assert that now tcp_freecb() is called only and only from tcp_discardcb()?

glebius@ : I will test a bit first. I wasn't sure what is guaranteed to be called in which order, but I think you are right, that the additional stop of the timers you commented about is not needed. I just checked where the two flags checked are set (DROPPED and TIMEDWAIT), and stopped all timers from there, but I guess it can't be dropped before going into TIMEDWAIT first ...

glebius@ : I will test a bit first. I wasn't sure what is guaranteed to be called in which order, but I think you are right, that the additional stop of the timers you commented about is not needed. I just checked where the two flags checked are set (DROPPED and TIMEDWAIT), and stopped all timers from there, but I guess it can't be dropped before going into TIMEDWAIT first ...

That's why I would prefer to not rush with your patch and go with my sequence of changes, that already is in the progress:

  1. Remove compressed time wait.
  2. Merge inpcb+tcpcb, so that the structure that contains the lock is the same structure we protect in the callouts.
  3. Go with the patch that would be very close to this one.

glebius@: I have no rush with this patch.