Source-Changes-HG archive

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

[src/trunk]: src/sys/kern mi_switch: move an over eager KASSERT defeated by k...



details:   https://anonhg.NetBSD.org/src/rev/e96ab8114b96
branches:  trunk
changeset: 1005436:e96ab8114b96
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Dec 07 21:14:36 2019 +0000

description:
mi_switch: move an over eager KASSERT defeated by kernel preemption.
Discovered during automated test.

diffstat:

 sys/kern/kern_synch.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r fbad0420ab5c -r e96ab8114b96 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Sat Dec 07 19:50:33 2019 +0000
+++ b/sys/kern/kern_synch.c     Sat Dec 07 21:14:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.330 2019/12/07 17:36:33 ad Exp $      */
+/*     $NetBSD: kern_synch.c,v 1.331 2019/12/07 21:14:36 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.330 2019/12/07 17:36:33 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.331 2019/12/07 21:14:36 ad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_dtrace.h"
@@ -753,6 +753,7 @@
                 * Note that, unless the caller disabled preemption, we can
                 * be preempted at any time after this splx().
                 */
+               KASSERT(l->l_cpu == ci);
                splx(oldspl);
        } else {
                /* Nothing to do - just unlock and return. */
@@ -763,9 +764,7 @@
                lwp_unlock(l);
        }
 
-       /* Only now is it safe to consider l_cpu again. */
        KASSERT(l == curlwp);
-       KASSERT(l->l_cpu == ci);
        KASSERT(l->l_stat == LSONPROC);
 
        SYSCALL_TIME_WAKEUP(l);



Home | Main Index | Thread Index | Old Index