On Mon, Nov 21, 2016 at 11:35:07AM +0100, Martin Pieuchot wrote:
> These are more entry points that I'd like to always call at IPL_SOFTNET.
> 
> With that we can get rid of most of the splsoftnet() dances in our tree.
> 
> ok?

NFS hits you again.  nfs_boot_init() calls ifioctl().  Perhaps put
the splsoftnet() inside ifioctl().

The uipc_domain part is OK, I think we will not find a better layer
for the network lock.

bluhm

> 
> Index: kern/sys_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/sys_socket.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 sys_socket.c
> --- kern/sys_socket.c 21 Nov 2016 10:30:42 -0000      1.24
> +++ kern/sys_socket.c 21 Nov 2016 10:32:02 -0000
> @@ -119,8 +119,12 @@ soo_ioctl(struct file *fp, u_long cmd, c
>        * interface and routing ioctls should have a
>        * different entry since a socket's unnecessary
>        */
> -     if (IOCGROUP(cmd) == 'i')
> -             return (ifioctl(so, cmd, data, p));
> +     if (IOCGROUP(cmd) == 'i') {
> +             s = splsoftnet();
> +             error = ifioctl(so, cmd, data, p);
> +             splx(s);
> +             return (error);
> +     }
>       if (IOCGROUP(cmd) == 'r')
>               return (EOPNOTSUPP);
>       s = splsoftnet();
> Index: kern/uipc_domain.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_domain.c,v
> retrieving revision 1.45
> diff -u -p -r1.45 uipc_domain.c
> --- kern/uipc_domain.c        3 Mar 2016 00:34:10 -0000       1.45
> +++ kern/uipc_domain.c        21 Nov 2016 10:32:02 -0000
> @@ -219,13 +219,15 @@ pfctlinput(int cmd, struct sockaddr *sa)
>  {
>       struct domain *dp;
>       struct protosw *pr;
> -     int i;
> +     int i, s;
>  
> +     s = splsoftnet();
>       for (i = 0; (dp = domains[i]) != NULL; i++) {
>               for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
>                       if (pr->pr_ctlinput)
>                               (*pr->pr_ctlinput)(cmd, sa, 0, NULL);
>       }
> +     splx(s);
>  }
>  
>  void
> @@ -234,13 +236,15 @@ pfslowtimo(void *arg)
>       struct timeout *to = (struct timeout *)arg;
>       struct domain *dp;
>       struct protosw *pr;
> -     int i;
> +     int i, s;
>  
> +     s = splsoftnet();
>       for (i = 0; (dp = domains[i]) != NULL; i++) {
>               for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
>                       if (pr->pr_slowtimo)
>                               (*pr->pr_slowtimo)();
>       }
> +     splx(s);
>       timeout_add_msec(to, 500);
>  }
>  
> @@ -250,12 +254,14 @@ pffasttimo(void *arg)
>       struct timeout *to = (struct timeout *)arg;
>       struct domain *dp;
>       struct protosw *pr;
> -     int i;
> +     int i, s;
>  
> +     s = splsoftnet();
>       for (i = 0; (dp = domains[i]) != NULL; i++) {
>               for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
>                       if (pr->pr_fasttimo)
>                               (*pr->pr_fasttimo)();
>       }
> +     splx(s);
>       timeout_add_msec(to, 200);
>  }

Reply via email to