On Thu, Aug 04, 2022 at 02:18:49AM +0300, Vitaliy Makkoveev wrote:
> Also, I like to have exclusive layer locks like `tcp_lock???,
> `udp_lock???, etc.. And take them with shared netlock held as the
> first step of inet sockets unlocking.

With PRU_LOCK and PRU_UNLOCK each layer can decide itself which
kind is appropriate.  For divert packet per PCB lock is trivial.
For loops delivering to all sockets like UDP multicast or RAW
sockets, a mutex per layer an easier start.

> > sblock()/sbunlock() relie on exclusive socket or layer lock,
> > which protects `sb_flags??? modification. This diff breaks them,
> > because nothing stops concurrent soreceive() threads to set
> > SB_LOCK flag and and be sure that socket buffer is locked.

Either sb_flags is protected by the exclusice netlock or by a shared
netlock and PCB mutex.  So only one thread can access them.  Right?

> > I started the work to allow socket buffer locking without socket
> > lock held, but the work is far from the diff expose.

Good to hear.  I am advancing from the other direction.  In protocol
layer is much room for MP improvement.

bluhm

Reply via email to