mi_switch: move LOCKDEBUG_BARRIER later to accomodate holding two locks
on entry.
This commit is contained in:
parent
0ca61464d2
commit
9079e8e09e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_synch.c,v 1.329 2019/12/06 21:36:10 ad Exp $ */
|
||||
/* $NetBSD: kern_synch.c,v 1.330 2019/12/07 17:36:33 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.329 2019/12/06 21:36:10 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.330 2019/12/07 17:36:33 ad Exp $");
|
||||
|
||||
#include "opt_kstack.h"
|
||||
#include "opt_dtrace.h"
|
||||
@ -525,7 +525,6 @@ mi_switch(lwp_t *l)
|
||||
KASSERT(lwp_locked(l, NULL));
|
||||
KASSERT(kpreempt_disabled());
|
||||
KASSERT(mutex_owned(curcpu()->ci_schedstate.spc_mutex));
|
||||
LOCKDEBUG_BARRIER(l->l_mutex, 1);
|
||||
|
||||
kstack_check_magic(l);
|
||||
|
||||
@ -647,6 +646,9 @@ mi_switch(lwp_t *l)
|
||||
mutex_spin_exit(spc->spc_mutex);
|
||||
}
|
||||
|
||||
/* We're down to only one lock, so do debug checks. */
|
||||
LOCKDEBUG_BARRIER(l->l_mutex, 1);
|
||||
|
||||
/*
|
||||
* Mark that context switch is going to be performed
|
||||
* for this LWP, to protect it from being switched
|
||||
@ -756,6 +758,8 @@ mi_switch(lwp_t *l)
|
||||
/* Nothing to do - just unlock and return. */
|
||||
mutex_spin_exit(spc->spc_mutex);
|
||||
l->l_pflag &= ~LP_PREEMPTING;
|
||||
/* We're down to only one lock, so do debug checks. */
|
||||
LOCKDEBUG_BARRIER(l->l_mutex, 1);
|
||||
lwp_unlock(l);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user