Page MenuHomeFreeBSD

tcp: Congestion control move to using reference counting.
ClosedPublic

Authored by rrs on Dec 3 2021, 3:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 7:57 PM
Unknown Object (File)
Fri, Mar 29, 8:04 AM
Unknown Object (File)
Feb 24 2024, 12:10 PM
Unknown Object (File)
Feb 17 2024, 12:51 PM
Unknown Object (File)
Feb 7 2024, 5:31 AM
Unknown Object (File)
Jan 27 2024, 7:54 PM
Unknown Object (File)
Jan 27 2024, 7:54 PM
Unknown Object (File)
Jan 27 2024, 7:54 PM
Subscribers

Details

Summary

In the transport call on 12/3 Gleb asked to move the CC modules towards
using reference counting to prevent folks from unloading a module in use.
It was also agreed that Michael would do a user space utility like tcp_drop
that could be used to move all connections that are using a specific CC
to some other CC.

This is the half I committed to doing, making it so that we maintain a refcount
on a cc module every time a pcb refers to it and decrementing that every
time a pcb no longer uses a cc module. This also helps us simplify the
whole unloading process by getting rid of tcp_ccunload() which munged
through all the tcb's. Instead we mark a module as being removed and
prevent further references to it. We also make sure that if a module is
marked as being removed it cannot be made as the default and also
the opposite of that, if its a default it fails and does not mark it as being
removed.

Test Plan
  1. First loading and unloading modules
  2. Setup a connection that refers to a loaded module by changing to the module. Then attempt to unload it.
  3. Make sure after the connection no longer refers to it the module can be unloaded.
  4. Make sure that after we get in a state where we are unloading a module that no new references to it are allowed

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rrs requested review of this revision.Dec 3 2021, 3:29 PM

Update the patch to correspond to what our conference call said. I.e. we still
have the racy unload. And if it fails and you were doing a force and the module
gets removed boom.

But if it succeeds (which it mostly will) you are golden. Since it moves
folks to the default.

So, this changes CCs to have the same "zombie state" for transition to unload as already is done for the TCP stacks. I'm not sure overall outcome of our discussion yesterday was that the "zombie state" is the way to go. But this makes unload sequence more safe than it is now and makes it par with TCP stacks unload sequence. I think until Michael makes the connctl(8) tool this is the right thing to do.

sys/netinet/cc/cc.c
613

On MOD_SHUTDOWN, I think, we shouldn't do anything, should we?

rrs marked an inline comment as done.Jan 18 2022, 12:54 PM
rrs added inline comments.
sys/netinet/cc/cc.c
613

I think you are right. It has always been we act in all three cases but this is wrong. Let
me fix this!

rrs marked an inline comment as done.

Fix Gleb's comment on MOD_SHUTDOWN doing nothing!

Update the diff to work correctly with the new socket options arg's.

A couple of comment updates, and when we attach
we get a lock in the attach function so no need to CC_LOCK.

Get rid of the unused ccunload module from tcp_subr.c/tcp_var.h

This revision is now accepted and ready to land.Feb 10 2022, 5:15 PM