Module Name:    src
Committed By:   yamt
Date:           Tue Jun 12 17:14:19 UTC 2012

Modified Files:
        src/sys/arch/x86/x86: cpu.c

Log Message:
cpu_load_pmap: disable interrupts.  add a comment to explain why.  PR/44995


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/x86/x86/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.98 src/sys/arch/x86/x86/cpu.c:1.99
--- src/sys/arch/x86/x86/cpu.c:1.98	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/x86/x86/cpu.c	Tue Jun 12 17:14:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.98 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: cpu.c,v 1.99 2012/06/12 17:14:19 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98 2012/04/20 22:23:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.99 2012/06/12 17:14:19 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -1228,16 +1228,20 @@ void
 cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
 {
 #ifdef PAE
-	int i, s;
-	struct cpu_info *ci;
-
-	s = splvm(); /* just to be safe */
-	ci = curcpu();
+	struct cpu_info *ci = curcpu();
 	pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
+	int i;
+
+	/*
+	 * disable interrupts to block TLB shootdowns, which can reload cr3.
+	 * while this doesn't block NMIs, it's probably ok as NMIs unlikely
+	 * reload cr3.
+	 */
+	x86_disable_intr();
 	for (i = 0 ; i < PDP_SIZE; i++) {
 		l3_pd[i] = pmap->pm_pdirpa[i] | PG_V;
 	}
-	splx(s);
+	x86_enable_intr();
 	tlbflush();
 #else /* PAE */
 	lcr3(pmap_pdirpa(pmap, 0));

Reply via email to