Re: Rework UNIX sockets locking to be fine grained

2021-12-06 Thread Vitaliy Makkoveev
Updated on top of latest source. Index: sys/kern/uipc_socket.c === RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.269 diff -u -p -r1.269 uipc_socket.c --- sys/kern/uipc_socket.c 11 Nov 2021 16:35:09 -

Re: Rework UNIX sockets locking to be fine grained

2021-12-02 Thread Vitaliy Makkoveev
Thanks! Bulk build make us sure all packages have been built with new headers. > On 2 Dec 2021, at 16:26, Christian Weisgerber wrote: > > Vitaliy Makkoveev: > >> Include missing "sys/refcnt.h" header to unpcb.h to fix libkvm and >> netstat(1) build. No functional changes. > > I ran an amd64

Re: Rework UNIX sockets locking to be fine grained

2021-12-02 Thread Christian Weisgerber
Vitaliy Makkoveev: > Include missing "sys/refcnt.h" header to unpcb.h to fix libkvm and > netstat(1) build. No functional changes. I ran an amd64 package bulk build with this, four ncpu=4 machines. No problems. (Other than for dpb's ssh connection multiplexing, I don't think Unix domain sockets

Re: Rework UNIX sockets locking to be fine grained

2021-12-01 Thread Vitaliy Makkoveev
This diff included into the snaps. > On 30 Nov 2021, at 19:48, Vitaliy Makkoveev wrote: > > Include missing "sys/refcnt.h" header to unpcb.h to fix libkvm and > netstat(1) build. No functional changes. > > Index: sys/kern/uipc_socket.c >

Re: Rework UNIX sockets locking to be fine grained

2021-12-01 Thread Vitaliy Makkoveev
On Wed, Dec 01, 2021 at 12:55:06PM +0100, Martin Pieuchot wrote: > On 24/11/21(Wed) 15:04, Vitaliy Makkoveev wrote: > > [...] > > Really, this is the simplest way. The shared lock for the pair of > > sockets moves re-lock dances to the connect and disconnect stages which > > should be also

Re: Rework UNIX sockets locking to be fine grained

2021-12-01 Thread Martin Pieuchot
On 24/11/21(Wed) 15:04, Vitaliy Makkoveev wrote: > [...] > Really, this is the simplest way. The shared lock for the pair of > sockets moves re-lock dances to the connect and disconnect stages which > should be also protected by locks. And not for the pair. Many SOCK_DGRAM > sockets could be

Re: Rework UNIX sockets locking to be fine grained

2021-11-30 Thread Vitaliy Makkoveev
Include missing "sys/refcnt.h" header to unpcb.h to fix libkvm and netstat(1) build. No functional changes. Index: sys/kern/uipc_socket.c === RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.269 diff -u -p -r1.269

Re: Rework UNIX sockets locking to be fine grained

2021-11-24 Thread Vitaliy Makkoveev
On Wed, Nov 24, 2021 at 11:36:22AM +0100, Martin Pieuchot wrote: > On 22/11/21(Mon) 14:42, Vitaliy Makkoveev wrote: > > On Sat, Nov 20, 2021 at 03:12:31AM +0300, Vitaliy Makkoveev wrote: > > > Updated diff. Re-lock dances were simplified in the unix(4) sockets > > > layer. > > > > > > Reference

Re: Rework UNIX sockets locking to be fine grained

2021-11-24 Thread Martin Pieuchot
On 22/11/21(Mon) 14:42, Vitaliy Makkoveev wrote: > On Sat, Nov 20, 2021 at 03:12:31AM +0300, Vitaliy Makkoveev wrote: > > Updated diff. Re-lock dances were simplified in the unix(4) sockets > > layer. > > > > Reference counters added to unix(4) sockets layer too. This makes > > pointer

Re: Rework UNIX sockets locking to be fine grained

2021-11-22 Thread Vitaliy Makkoveev
On Sat, Nov 20, 2021 at 03:12:31AM +0300, Vitaliy Makkoveev wrote: > Updated diff. Re-lock dances were simplified in the unix(4) sockets > layer. > > Reference counters added to unix(4) sockets layer too. This makes > pointer dereference of peer's control block always safe after re-lock. > >

Re: Rework UNIX sockets locking to be fine grained

2021-11-20 Thread Vitaliy Makkoveev
On Sat, Nov 20, 2021 at 07:16:40PM +0100, Matthias Schmidt wrote: > Hi Vitaliy, > > * Vitaliy Makkoveev wrote: > > Updated diff. Re-lock dances were simplified in the unix(4) sockets > > layer. > > I am running this diff and the one before on a Thinkpad T450s which is > my daily driver (office,

Re: Rework UNIX sockets locking to be fine grained

2021-11-20 Thread Matthias Schmidt
Hi Vitaliy, * Vitaliy Makkoveev wrote: > Updated diff. Re-lock dances were simplified in the unix(4) sockets > layer. I am running this diff and the one before on a Thinkpad T450s which is my daily driver (office, coding, web, videos, musik, etc) and noticed no regressions so far.

Re: Rework UNIX sockets locking to be fine grained

2021-11-19 Thread Vitaliy Makkoveev
Updated diff. Re-lock dances were simplified in the unix(4) sockets layer. Reference counters added to unix(4) sockets layer too. This makes pointer dereference of peer's control block always safe after re-lock. The `unp_refs' list cleanup done in the unp_detach(). This removes the case where

Rework UNIX sockets locking to be fine grained

2021-11-18 Thread Vitaliy Makkoveev
The UNIX sockets garbage collector was moved out of global `unp_lock' rwlock(9) which locks the whole layer. Now it's used to protect per-socket data and it's time to replace it to per-socket's `so_lock'. Unlike PF_ROUTE and PF_KEY sockets we have the paths where multiple sockets should be locked