Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Relax the KASSERT() in pcu_discard_all() to allow n...
details: https://anonhg.NetBSD.org/src/rev/fe9c78ac34ad
branches: trunk
changeset: 1010785:fe9c78ac34ad
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Jun 06 18:13:01 2020 +0000
description:
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 716982919555 -r fe9c78ac34ad sys/kern/subr_pcu.c
--- a/sys/kern/subr_pcu.c Sat Jun 06 18:11:21 2020 +0000
+++ b/sys/kern/subr_pcu.c Sat Jun 06 18:13:01 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.22 2020/06/06 18:13:01 thorpej 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.22 2020/06/06 18:13:01 thorpej 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