Module Name: src
Committed By: thorpej
Date: Sat Jun 6 18:13:02 UTC 2020
Modified Files:
src/sys/kern: subr_pcu.c
Log Message:
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).
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_pcu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_pcu.c
diff -u src/sys/kern/subr_pcu.c:1.21 src/sys/kern/subr_pcu.c:1.22
--- src/sys/kern/subr_pcu.c:1.21 Mon Oct 16 15:03:57 2017
+++ src/sys/kern/subr_pcu.c Sat Jun 6 18:13:01 2020
@@ -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 @@ pcu_discard_all(lwp_t *l)
{
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. */