HomeFreeBSD

tcp_hpts: rewrite inpcb synchronization

Description

tcp_hpts: rewrite inpcb synchronization

Just trust the pcb database, that if we did in_pcbref(), no way
an inpcb can go away. And if we never put a dropped inpcb on
our queue, and tcp_discardcb() always removes an inpcb to be
dropped from the queue, then any inpcb on the queue is valid.

Now, to solve LOR between inpcb lock and HPTS queue lock do the
following trick. When we are about to process a certain time
slot, take the full queue of the head list into on stack list,
drop the HPTS lock and work on our queue. This of course opens
a race when an inpcb is being removed from the on stack queue,
which was already mentioned in comments. To address this race
introduce generation count into queues. If we want to remove
an inpcb with generation count mismatch, we can't do that, we
can only mark it with desired new time slot or -1 for remove.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33026

Details

Provenance
glebiusAuthored on Dec 2 2021, 6:48 PM
Reviewer
rrs
Differential Revision
D33026: tcp_hpts: rewrite inpcb synchronization
Parents
rGf971e791391d: tcp_hpts: rename input queue to drop queue and trim dead code
Branches
Unknown
Tags
Unknown