From: Alexander Bluhm Subject: Re: Switch AF_KEY sockets to the new locking scheme To: Vitaliy Makkoveev Cc: tech@openbsd.org Date: Fri, 17 May 2024 16:23:25 +0200 On Wed, May 08, 2024 at 01:52:21PM +0300, Vitaliy Makkoveev wrote: > The simplest case. Nothing to change in sockets layer, only set > SB_MTXLOCK on buffers. This diff doesn't conflict with "Turn sblock() > to `sb_lock' ..." [1] diff. > > 1. https://marc.info/?t=171478067200001&r=1&w=2 > > Not related to this diff, but pkpcb uses solock() only to protect > `kcb_flags' and `kcb_reg'. Protected paths are pretty small and have no > context switch, so per-pkpcb mutex(9) could be used instead of solock(). > This removes context switch from `kcb_list' walkthroughs and this SRP > could be converted to SMR list. OK bluhm@ > @@ -595,14 +594,14 @@ pfkeyv2_sendmessage(void **headers, int > > /* Send to all registered promiscuous listeners */ > SRPL_FOREACH(kp, &sr, &pkptable.pkp_list, kcb_list) { > + int flags = READ_ONCE(kp->kcb_flags); > + > if (kp->kcb_rdomain != rdomain) > continue; > You can move the READ_ONCE after continue.