On 08/07/20(Wed) 12:05, Vitaliy Makkoveev wrote:
> `pppx_devs_lk' used to protect `pxd_entry' list. We lock `pppx_devs_lk'
> in pppx_if_output() to be sure `pxd' is not destroyed by concurrent
> pppxclose() but it's useless. We destroy all corresponding `pxi' before
> `pxd' and `ifnet's are already detached.

This lock seems to only prevent races if malloc(9) sleeps inside
pppxopen().  Could you address that and remove the lock altogether?

What is really protecting the data structure and lifetime of its
elements is the KERNEL_LOCK() currently.

> Index: sys/net/if_pppx.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_pppx.c,v
> retrieving revision 1.91
> diff -u -p -r1.91 if_pppx.c
> --- sys/net/if_pppx.c 6 Jul 2020 20:37:51 -0000       1.91
> +++ sys/net/if_pppx.c 8 Jul 2020 09:04:31 -0000
> @@ -957,7 +957,6 @@ pppx_if_output(struct ifnet *ifp, struct
>               th = mtod(m, struct pppx_hdr *);
>               th->pppx_proto = 0;     /* not used */
>               th->pppx_id = pxi->pxi_session->ppp_id;
> -             rw_enter_read(&pppx_devs_lk);
>               error = mq_enqueue(&pxi->pxi_dev->pxd_svcq, m);
>               if (error == 0) {
>                       if (pxi->pxi_dev->pxd_waiting) {
> @@ -966,7 +965,6 @@ pppx_if_output(struct ifnet *ifp, struct
>                       }
>                       selwakeup(&pxi->pxi_dev->pxd_rsel);
>               }
> -             rw_exit_read(&pppx_devs_lk);
>       }
>  
>  out:
> 

Reply via email to