Page MenuHomeFreeBSD

tcp: Congestion control move to using reference counting.
Needs ReviewPublic

Authored by rrs on Dec 3 2021, 3:29 PM.


Group Reviewers

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

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

Lint Skipped
Unit Tests Skipped

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.


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