Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/03cf19f63c73
branches:  netbsd-8
changeset: 851309:03cf19f63c73
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jan 22 12:30:20 2018 +0000

description:
Pull up following revision(s) (requested by jdolecek in ticket #506):
        sys/kern/kern_softint.c: revision 1.45
        sys/rump/librump/rumpkern/rump.c: revision 1.331
        sys/kern/subr_pserialize.c: revision 1.10
        sys/kern/subr_psref.c: revision 1.10
Prevent panic or hangup in softint_disestablish(), pserialize_perform() or
psref_target_destroy() while mp_online == false.
 See http://mail-index.netbsd.org/tech-kern/2017/12/25/msg022829.html
Set mp_online = true. This change might fix PR#52886.

diffstat:

 sys/kern/kern_softint.c          |  11 +++++++----
 sys/kern/subr_pserialize.c       |   9 +++++++--
 sys/kern/subr_psref.c            |  14 ++++++++++----
 sys/rump/librump/rumpkern/rump.c |   6 ++++--
 4 files changed, 28 insertions(+), 12 deletions(-)

diffs (130 lines):

diff -r 03eb0c7bfb81 -r 03cf19f63c73 sys/kern/kern_softint.c
--- a/sys/kern/kern_softint.c   Mon Jan 22 12:13:15 2018 +0000
+++ b/sys/kern/kern_softint.c   Mon Jan 22 12:30:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_softint.c,v 1.43.10.1 2017/11/23 13:40:22 martin Exp $    */
+/*     $NetBSD: kern_softint.c,v 1.43.10.2 2018/01/22 12:30:20 martin Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -170,13 +170,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.43.10.1 2017/11/23 13:40:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.43.10.2 2018/01/22 12:30:20 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/intr.h>
 #include <sys/ipi.h>
 #include <sys/mutex.h>
+#include <sys/kernel.h>
 #include <sys/kthread.h>
 #include <sys/evcnt.h>
 #include <sys/cpu.h>
@@ -430,8 +431,10 @@
         * it again.  So, we are only looking for handler records with
         * SOFTINT_ACTIVE already set.
         */
-       where = xc_broadcast(0, (xcfunc_t)nullop, NULL, NULL);
-       xc_wait(where);
+       if (__predict_true(mp_online)) {
+               where = xc_broadcast(0, (xcfunc_t)nullop, NULL, NULL);
+               xc_wait(where);
+       }
 
        for (;;) {
                /* Collect flag values from each CPU. */
diff -r 03eb0c7bfb81 -r 03cf19f63c73 sys/kern/subr_pserialize.c
--- a/sys/kern/subr_pserialize.c        Mon Jan 22 12:13:15 2018 +0000
+++ b/sys/kern/subr_pserialize.c        Mon Jan 22 12:30:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pserialize.c,v 1.8.10.1 2017/11/30 14:40:46 martin Exp $  */
+/*     $NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $  */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.1 2017/11/30 14:40:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $");
 
 #include <sys/param.h>
 
@@ -157,6 +157,11 @@
        KASSERT(psz->psz_owner == NULL);
        KASSERT(ncpu > 0);
 
+       if (__predict_false(mp_online == false)) {
+               psz_ev_excl.ev_count++;
+               return;
+       }
+
        /*
         * Set up the object and put it onto the queue.  The lock
         * activity here provides the necessary memory barrier to
diff -r 03eb0c7bfb81 -r 03cf19f63c73 sys/kern/subr_psref.c
--- a/sys/kern/subr_psref.c     Mon Jan 22 12:13:15 2018 +0000
+++ b/sys/kern/subr_psref.c     Mon Jan 22 12:30:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_psref.c,v 1.7.2.1 2018/01/02 10:36:12 snj Exp $   */
+/*     $NetBSD: subr_psref.c,v 1.7.2.2 2018/01/22 12:30:20 martin Exp $        */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.7.2.1 2018/01/02 10:36:12 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.7.2.2 2018/01/22 12:30:20 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/condvar.h>
@@ -429,8 +429,14 @@
                .ret = false,
        };
 
-       /* Ask all CPUs to say whether they hold a psref to the target.  */
-       xc_wait(xc_broadcast(0, &psreffed_p_xc, &P, NULL));
+       if (__predict_true(mp_online)) {
+               /*
+                * Ask all CPUs to say whether they hold a psref to the
+                * target.
+                */
+               xc_wait(xc_broadcast(0, &psreffed_p_xc, &P, NULL));
+       } else
+               psreffed_p_xc(&P, NULL);
 
        return P.ret;
 }
diff -r 03eb0c7bfb81 -r 03cf19f63c73 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Mon Jan 22 12:13:15 2018 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Mon Jan 22 12:30:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.329.10.1 2017/11/30 14:40:46 martin Exp $   */
+/*     $NetBSD: rump.c,v 1.329.10.2 2018/01/22 12:30:20 martin Exp $   */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.329.10.1 2017/11/30 14:40:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.329.10.2 2018/01/22 12:30:20 martin Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -392,6 +392,8 @@
        /* Once all CPUs are detected, initialize the per-CPU cprng_fast.  */
        cprng_fast_init();
 
+       mp_online = true;
+
        /* CPUs are up.  allow kernel threads to run */
        rump_thread_allow(NULL);
 



Home | Main Index | Thread Index | Old Index