Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by thor...



details:   https://anonhg.NetBSD.org/src/rev/8b81b856b045
branches:  netbsd-9
changeset: 963933:8b81b856b045
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jun 07 17:07:07 2020 +0000

description:
Pull up following revision(s) (requested by thorpej in ticket #949):

        sys/kern/subr_pcu.c: revision 1.22

Relax the KASSERT() in pcu_discard_all() to allow non-curlwp if it is
in LSIDL state, which can happen if the new LWP is exiting before it's
ever run, e.g. if an error occurs in _lwp_create(2).

diffstat:

 sys/kern/subr_pcu.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 517442abc8f2 -r 8b81b856b045 sys/kern/subr_pcu.c
--- a/sys/kern/subr_pcu.c       Sun Jun 07 17:03:11 2020 +0000
+++ b/sys/kern/subr_pcu.c       Sun Jun 07 17:07:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pcu.c,v 1.21 2017/10/16 15:03:57 bouyer Exp $     */
+/*     $NetBSD: subr_pcu.c,v 1.21.8.1 2020/06/07 17:07:07 martin Exp $ */
 
 /*-
  * Copyright (c) 2011, 2014 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.21 2017/10/16 15:03:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.21.8.1 2020/06/07 17:07:07 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -130,7 +130,12 @@
 {
        const uint32_t pcu_valid = l->l_pcu_valid;
 
-       KASSERT(l == curlwp || ((l->l_flag & LW_SYSTEM) && pcu_valid == 0));
+       /*
+        * The check for LSIDL here is to catch the case where the LWP exits
+        * due to an error in the LWP creation path before it ever runs.
+        */
+       KASSERT(l == curlwp || l->l_stat == LSIDL ||
+               ((l->l_flag & LW_SYSTEM) && pcu_valid == 0));
 
        if (__predict_true(pcu_valid == 0)) {
                /* PCUs are not in use. */



Home | Main Index | Thread Index | Old Index