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: remove invalid assert and add a note tha...



details:   https://anonhg.NetBSD.org/src/rev/a234717a3cd4
branches:  trunk
changeset: 759849:a234717a3cd4
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat Dec 18 01:13:36 2010 +0000

description:
mi_switch: remove invalid assert and add a note that preemption/interrupt
may happen while migrating LWP is set.

Reported by Manuel Bouyer.

diffstat:

 sys/kern/kern_synch.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r ed5de796875c -r a234717a3cd4 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Sat Dec 18 01:07:25 2010 +0000
+++ b/sys/kern/kern_synch.c     Sat Dec 18 01:13:36 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.284 2010/11/02 15:17:37 pooka Exp $   */
+/*     $NetBSD: kern_synch.c,v 1.285 2010/12/18 01:13:36 rmind 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.284 2010/11/02 15:17:37 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.285 2010/12/18 01:13:36 rmind Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -654,9 +654,13 @@
                        l->l_stat = LSRUN;
                        lwp_setlock(l, spc->spc_mutex);
                        sched_enqueue(l, true);
-                       /* Handle migration case */
-                       KASSERT(spc->spc_migrating == NULL);
-                       if (l->l_target_cpu !=  NULL) {
+                       /*
+                        * Handle migration.  Note that "migrating LWP" may
+                        * be reset here, if interrupt/preemption happens
+                        * early in idle LWP.
+                        */
+                       if (l->l_target_cpu != NULL) {
+                               KASSERT((l->l_pflag & LP_INTR) == 0);
                                spc->spc_migrating = l;
                        }
                } else



Home | Main Index | Thread Index | Old Index