set LP_RUNNING when starting lwp0 and idle lwps.

add assertions.
This commit is contained in:
yamt 2009-07-19 10:11:55 +00:00
parent 1a3805652d
commit 0436400c70
4 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.393 2009/07/19 02:50:44 rmind Exp $ */
/* $NetBSD: init_main.c,v 1.394 2009/07/19 10:11:55 yamt Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.393 2009/07/19 02:50:44 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.394 2009/07/19 10:11:55 yamt Exp $");
#include "opt_ddb.h"
#include "opt_ipsec.h"
@ -285,6 +285,7 @@ main(void)
#ifndef LWP0_CPU_INFO
l->l_cpu = curcpu();
#endif
l->l_pflag |= LP_RUNNING;
/*
* Attempt to find console and initialize

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_idle.c,v 1.22 2009/06/28 09:25:05 ad Exp $ */
/* $NetBSD: kern_idle.c,v 1.23 2009/07/19 10:11:55 yamt Exp $ */
/*-
* Copyright (c)2002, 2006, 2007 YAMAMOTO Takashi,
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.22 2009/06/28 09:25:05 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.23 2009/07/19 10:11:55 yamt Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@ -68,6 +68,7 @@ idle_loop(void *dummy)
KERNEL_UNLOCK_ALL(l, NULL);
l->l_stat = LSONPROC;
l->l_pflag |= LP_RUNNING;
for (;;) {
LOCKDEBUG_BARRIER(NULL, 0);
KASSERT((l->l_flag & LW_IDLE) != 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_softint.c,v 1.28 2009/05/18 21:31:27 bouyer Exp $ */
/* $NetBSD: kern_softint.c,v 1.29 2009/07/19 10:11:55 yamt Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@ -176,7 +176,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.28 2009/05/18 21:31:27 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.29 2009/07/19 10:11:55 yamt Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -783,6 +783,7 @@ softint_dispatch(lwp_t *pinned, int s)
u_int timing;
lwp_t *l;
KASSERT((pinned->l_pflag & LP_RUNNING) != 0);
l = curlwp;
si = l->l_private;

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_synch.c,v 1.266 2009/06/29 23:39:00 yamt Exp $ */
/* $NetBSD: kern_synch.c,v 1.267 2009/07/19 10:11:55 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.266 2009/06/29 23:39:00 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.267 2009/07/19 10:11:55 yamt Exp $");
#include "opt_kstack.h"
#include "opt_perfctrs.h"
@ -588,6 +588,7 @@ mi_switch(lwp_t *l)
binuptime(&bt);
KASSERT((l->l_pflag & LP_RUNNING) != 0);
KASSERT(l->l_cpu == curcpu());
ci = l->l_cpu;
spc = &ci->ci_schedstate;
@ -722,6 +723,7 @@ mi_switch(lwp_t *l)
KASSERT(l->l_ctxswtch == 0);
l->l_ctxswtch = 1;
l->l_ncsw++;
KASSERT((l->l_pflag & LP_RUNNING) != 0);
l->l_pflag &= ~LP_RUNNING;
/*