Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by knaka...



details:   https://anonhg.NetBSD.org/src/rev/f5c410d6862e
branches:  netbsd-8
changeset: 851072:f5c410d6862e
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Oct 24 08:50:44 2017 +0000

description:
Pull up following revision(s) (requested by knakahara in ticket #304):
        sys/net/if_loop.c: revision 1.95
loop_clone_create() must be called after ncpu is counted up for all CPUs.
loop_clone_create() uses ncpu in the following call-path.
    - loop_clone_create()
      - if_attach()
        - if_percpuq_create()
          - softint_establish() // use ncpu
          - percpu_foreach() // use ncpu
However, loopinit() of built-in module is called from
module_init_class(MODULE_CLASS_DRIVER) which is called before ncpu is counted
up in some architectures. So, It is too fast.
On the other hand, it is too late for rump netinet component to call
loop_clone_create() in config_finalize().
As the result, loop_clone_create() shuld be called in loopattach() for built-in
module, and in loopinit() for dynamic module.

diffstat:

 sys/net/if_loop.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r a15575a0d509 -r f5c410d6862e sys/net/if_loop.c
--- a/sys/net/if_loop.c Tue Oct 24 08:47:24 2017 +0000
+++ b/sys/net/if_loop.c Tue Oct 24 08:50:44 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_loop.c,v 1.94 2017/03/28 08:47:19 ozaki-r Exp $     */
+/*     $NetBSD: if_loop.c,v 1.94.6.1 2017/10/24 08:50:44 snj Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.94 2017/03/28 08:47:19 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.94.6.1 2017/10/24 08:50:44 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -146,10 +146,9 @@
 loopattach(int n)
 {
 
-       /*
-        * Nothing to do here, initialization is handled by the
-        * module initialization code in loopnit() below).
-        */
+#ifndef _MODULE
+       loop_clone_create(&loop_cloner, 0);     /* lo0 always exists */
+#endif
 }
 
 void
@@ -159,7 +158,9 @@
        if (lo0ifp != NULL)     /* can happen in rump kernel */
                return;
 
-       (void)loop_clone_create(&loop_cloner, 0);       /* lo0 always exists */
+#ifdef _MODULE
+       loop_clone_create(&loop_cloner, 0);     /* lo0 always exists */
+#endif
        if_clone_attach(&loop_cloner);
 }
 



Home | Main Index | Thread Index | Old Index