kernel - Fix some rare pmap races in i386 and x86_64 (followup)
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 22 Feb 2010 02:47:34 +0000 (18:47 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 22 Feb 2010 02:47:34 +0000 (18:47 -0800)
* pmap_interlock_wait() is SMP-only.  Fix UP build.

* pmap_setlwpvm for i386 was missing a call to pmap_interlock_wait()

sys/platform/pc32/i386/pmap.c
sys/platform/pc64/x86_64/pmap.c

index 2785d81..0b483e9 100644 (file)
@@ -3422,6 +3422,8 @@ pmap_setlwpvm(struct lwp *lp, struct vmspace *newvm)
                        pmap = vmspace_pmap(newvm);
 #if defined(SMP)
                        atomic_set_int(&pmap->pm_active, mycpu->gd_cpumask);
+                       if (pmap->pm_active & CPUMASK_LOCK)
+                               pmap_interlock_wait(newvm);
 #else
                        pmap->pm_active |= 1;
 #endif
@@ -3441,6 +3443,7 @@ pmap_setlwpvm(struct lwp *lp, struct vmspace *newvm)
        crit_exit();
 }
 
+#ifdef SMP
 /*
  * Called when switching to a locked pmap
  */
@@ -3459,6 +3462,8 @@ pmap_interlock_wait(struct vmspace *vm)
        }
 }
 
+#endif
+
 vm_offset_t
 pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
 {
index 3f76afa..6a24eb1 100644 (file)
@@ -3755,11 +3755,11 @@ pmap_setlwpvm(struct lwp *lp, struct vmspace *newvm)
                        pmap = vmspace_pmap(newvm);
 #if defined(SMP)
                        atomic_set_int(&pmap->pm_active, mycpu->gd_cpumask);
+                       if (pmap->pm_active & CPUMASK_LOCK)
+                               pmap_interlock_wait(newvm);
 #else
                        pmap->pm_active |= 1;
 #endif
-                       if (pmap->pm_active & CPUMASK_LOCK)
-                               pmap_interlock_wait(newvm);
 #if defined(SWTCH_OPTIM_STATS)
                        tlb_flush_count++;
 #endif
@@ -3776,6 +3776,8 @@ pmap_setlwpvm(struct lwp *lp, struct vmspace *newvm)
        crit_exit();
 }
 
+#ifdef SMP
+
 /*
  * Called when switching to a locked pmap
  */
@@ -3795,6 +3797,8 @@ pmap_interlock_wait(struct vmspace *vm)
        }
 }
 
+#endif
+
 vm_offset_t
 pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
 {