Module Name: src Committed By: rmind Date: Wed Jun 15 20:50:02 UTC 2011
Modified Files: src/sys/arch/x86/x86: pmap_tlb.c src/sys/arch/xen/x86: cpu.c x86_xpmap.c Log Message: Few XEN fixes: - cpu_load_pmap: perform tlbflush() after xen_set_user_pgd(). - xen_pmap_bootstrap: perform xpq_queue_tlb_flush() in the end. - pmap_tlb_shootdown: do not check PG_G for Xen. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/pmap_tlb.c cvs rdiff -u -r1.58 -r1.59 src/sys/arch/xen/x86/cpu.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/x86/x86_xpmap.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/pmap_tlb.c diff -u src/sys/arch/x86/x86/pmap_tlb.c:1.2 src/sys/arch/x86/x86/pmap_tlb.c:1.3 --- src/sys/arch/x86/x86/pmap_tlb.c:1.2 Sun Jun 12 03:35:50 2011 +++ src/sys/arch/x86/x86/pmap_tlb.c Wed Jun 15 20:50:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.2 2011/06/12 03:35:50 rmind Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.3 2011/06/15 20:50:02 rmind Exp $ */ /*- * Copyright (c) 2008-2011 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.2 2011/06/12 03:35:50 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.3 2011/06/15 20:50:02 rmind Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -209,7 +209,9 @@ pmap_tlb_packet_t *tp; int s; +#ifndef XEN KASSERT((pte & PG_G) == 0 || pm == pmap_kernel()); +#endif /* * If tearing down the pmap, do nothing. We will flush later Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.58 src/sys/arch/xen/x86/cpu.c:1.59 --- src/sys/arch/xen/x86/cpu.c:1.58 Wed Jun 15 19:54:16 2011 +++ src/sys/arch/xen/x86/cpu.c Wed Jun 15 20:50:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.58 2011/06/15 19:54:16 rmind Exp $ */ +/* $NetBSD: cpu.c,v 1.59 2011/06/15 20:50:02 rmind Exp $ */ /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */ /*- @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.58 2011/06/15 19:54:16 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.59 2011/06/15 20:50:02 rmind Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -1170,9 +1170,9 @@ if ((new_pgd[i] & PG_V) || (old_pgd[i] & PG_V)) xpq_queue_pte_update(addr, new_pgd[i]); } - tlbflush(); xen_set_user_pgd(pmap_pdirpa(pmap, 0)); ci->ci_xen_current_user_pgd = pmap_pdirpa(pmap, 0); + tlbflush(); splx(s); } #endif /* __x86_64__ */ Index: src/sys/arch/xen/x86/x86_xpmap.c diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.27 src/sys/arch/xen/x86/x86_xpmap.c:1.28 --- src/sys/arch/xen/x86/x86_xpmap.c:1.27 Wed Jun 15 19:54:16 2011 +++ src/sys/arch/xen/x86/x86_xpmap.c Wed Jun 15 20:50:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_xpmap.c,v 1.27 2011/06/15 19:54:16 rmind Exp $ */ +/* $NetBSD: x86_xpmap.c,v 1.28 2011/06/15 20:50:02 rmind Exp $ */ /* * Copyright (c) 2006 Mathieu Ropert <m...@adviseo.fr> @@ -69,7 +69,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.27 2011/06/15 19:54:16 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.28 2011/06/15 20:50:02 rmind Exp $"); #include "opt_xen.h" #include "opt_ddb.h" @@ -498,6 +498,10 @@ /* zero out free space after tables */ memset((void *)(init_tables + ((count + l2_4_count) * PAGE_SIZE)), 0, (UPAGES + 1) * NBPG); + + /* Finally, flush TLB. */ + xpq_queue_tlb_flush(); + return (init_tables + ((count + l2_4_count) * PAGE_SIZE)); } @@ -508,8 +512,6 @@ * new_count is # of new tables (PTE only) * we assume areas don't overlap */ - - static void xen_bootstrap_tables (vaddr_t old_pgd, vaddr_t new_pgd, int old_count, int new_count, int final) @@ -854,7 +856,6 @@ pte++; } xpq_flush_queue(); - xpq_queue_tlb_flush(); }