Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Make pcu_save_all and pcu_discard_all KASSERTs acce...



details:   https://anonhg.NetBSD.org/src/rev/27f80c525cb2
branches:  trunk
changeset: 765846:27f80c525cb2
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Jun 07 17:51:58 2011 +0000

description:
Make pcu_save_all and pcu_discard_all KASSERTs accept LW_SYSTEM threads
since kthread_create will call lwp_create with lwp0 which may not be curlwp.

diffstat:

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

diffs (36 lines):

diff -r a25a6ed6d52c -r 27f80c525cb2 sys/kern/subr_pcu.c
--- a/sys/kern/subr_pcu.c       Tue Jun 07 17:47:24 2011 +0000
+++ b/sys/kern/subr_pcu.c       Tue Jun 07 17:51:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pcu.c,v 1.7 2011/06/06 22:04:34 matt Exp $        */
+/*     $NetBSD: subr_pcu.c,v 1.8 2011/06/07 17:51:58 matt Exp $        */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.7 2011/06/06 22:04:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.8 2011/06/07 17:51:58 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -108,7 +108,7 @@
 {
        const uint32_t pcu_inuse = l->l_pcu_used;
 
-       KASSERT(l == curlwp);
+       KASSERT(l == curlwp || ((l->l_flag & LW_SYSTEM) && pcu_inuse == 0));
 
        if (__predict_true(pcu_inuse == 0)) {
                /* PCUs are not in use. */
@@ -138,7 +138,7 @@
 {
        const uint32_t pcu_inuse = l->l_pcu_used;
 
-       KASSERT(l == curlwp);
+       KASSERT(l == curlwp || ((l->l_flag & LW_SYSTEM) && pcu_inuse == 0));
 
        if (__predict_true(pcu_inuse == 0)) {
                /* PCUs are not in use. */



Home | Main Index | Thread Index | Old Index