Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 cpu_load_pmap: disable interrupts. add a c...



details:   https://anonhg.NetBSD.org/src/rev/92f4eb30085b
branches:  trunk
changeset: 779701:92f4eb30085b
user:      yamt <yamt%NetBSD.org@localhost>
date:      Tue Jun 12 17:14:19 2012 +0000

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

diffstat:

 sys/arch/x86/x86/cpu.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (45 lines):

diff -r 4800b95ebbde -r 92f4eb30085b sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Tue Jun 12 12:26:42 2012 +0000
+++ b/sys/arch/x86/x86/cpu.c    Tue Jun 12 17:14:19 2012 +0000
@@ -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 @@
 cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
 {
 #ifdef PAE
-       int i, s;
-       struct cpu_info *ci;
+       struct cpu_info *ci = curcpu();
+       pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
+       int i;
 
-       s = splvm(); /* just to be safe */
-       ci = curcpu();
-       pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
+       /*
+        * 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));



Home | Main Index | Thread Index | Old Index