On Mon, Aug 29, 2022 at 07:34:14PM +0200, Alexander Bluhm wrote:
> Hi,
> 
> The diff below is needed to protect the receive socket buffer in
> UDP input with per PCB mutex.
> 
> With that, parallel UDP input and soreceive can be activated.  There
> are still issues with socket splicing and maybe pipex.  So I will
> not switch to shared lock in receive path soon.  But I want to get
> the mutex part commited so that it gets tested.
> 
> ok?

OK claudio@

It is not great to use use a PCB mutex to lock something that is only
in struct socket. While I understand that this allows you to move forward
it would be nice if the lock interaction between socket, pcb and
socketbuffers would be slowly streamlined instead of introducing more
complex locking (which depends on a lot if stuff).
 
> mvs: Do you know whether pipex in udp_input() is MP safe?
> 
> bluhm
> 
> Index: netinet/udp_usrreq.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
> retrieving revision 1.294
> diff -u -p -r1.294 udp_usrreq.c
> --- netinet/udp_usrreq.c      29 Aug 2022 08:08:17 -0000      1.294
> +++ netinet/udp_usrreq.c      29 Aug 2022 17:12:08 -0000
> @@ -657,12 +657,17 @@ udp_sbappend(struct inpcb *inp, struct m
>       }
>  #endif
>       m_adj(m, hlen);
> +
> +     mtx_enter(&inp->inp_mtx);
>       if (sbappendaddr(so, &so->so_rcv, srcaddr, m, opts) == 0) {
> +             mtx_leave(&inp->inp_mtx);
>               udpstat_inc(udps_fullsock);
>               m_freem(m);
>               m_freem(opts);
>               return;
>       }
> +     mtx_leave(&inp->inp_mtx);
> +
>       sorwakeup(so);
>  }
>  
> 

-- 
:wq Claudio

Reply via email to