Fix a bug in TBI optimization uncovered by the "access_type" changes. Thanks

to Bernd Ernesti for providing crash dumps to Charles Hannum who tracked
it down.
This commit is contained in:
thorpej 1999-04-09 00:38:10 +00:00
parent bbb1c4b60f
commit e468d4c8d9
2 changed files with 16 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.88 1999/03/29 05:31:24 mycroft Exp $ */ /* $NetBSD: pmap.c,v 1.89 1999/04/09 00:38:10 thorpej Exp $ */
/*- /*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -155,7 +155,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 1999/03/29 05:31:24 mycroft Exp $"); __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 1999/04/09 00:38:10 thorpej Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1569,7 +1569,7 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
vm_prot_t access_type; vm_prot_t access_type;
{ {
boolean_t managed; boolean_t managed;
pt_entry_t *pte, npte; pt_entry_t *pte, npte, opte;
paddr_t opa; paddr_t opa;
boolean_t tflush = TRUE; boolean_t tflush = TRUE;
boolean_t hadasm = FALSE; /* XXX gcc -Wuninitialized */ boolean_t hadasm = FALSE; /* XXX gcc -Wuninitialized */
@ -1663,6 +1663,9 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
pte = pmap_l3pte(pmap, va, l2pte); pte = pmap_l3pte(pmap, va, l2pte);
} }
/* Remember all of the old PTE; used for TBI check later. */
opte = *pte;
/* /*
* Check to see if the old mapping is valid. If not, validate the * Check to see if the old mapping is valid. If not, validate the
* new one immediately. * new one immediately.
@ -1714,15 +1717,6 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
pmap->pm_stats.wired_count--; pmap->pm_stats.wired_count--;
} }
/*
* Check to see if the PALcode portion of the
* PTE is the same. If so, no TLB invalidation
* is necessary.
*/
if (PG_PALCODE(pmap_pte_prot(pte)) ==
PG_PALCODE(pte_prot(pmap, prot)))
tflush = FALSE;
/* /*
* Set the PTE. * Set the PTE.
*/ */
@ -1802,6 +1796,13 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
printf("pmap_enter: new pte = 0x%lx\n", npte); printf("pmap_enter: new pte = 0x%lx\n", npte);
#endif #endif
/*
* If the PALcode portion of the new PTE is the same as the
* old PTE, no TBI is necessary.
*/
if (PG_PALCODE(opte) == PG_PALCODE(npte))
tflush = FALSE;
/* /*
* Set the new PTE. * Set the new PTE.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pte.h,v 1.25 1998/08/14 16:50:03 thorpej Exp $ */ /* $NetBSD: pte.h,v 1.26 1999/04/09 00:38:11 thorpej Exp $ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -110,11 +110,9 @@ typedef alpha_pt_entry_t pt_entry_t;
/* /*
* These are the PALcode PTE bits that we care about when checking to see * These are the PALcode PTE bits that we care about when checking to see
* if a PTE has changed in such a way as to require a TBI. We don't care * if a PTE has changed in such a way as to require a TBI.
* about the FOx bits because we always remember the state of those bits and
* set them to mirror what the TB has (they are used for mod/ref emulation).
*/ */
#define PG_PALCODE(x) ((x) & (ALPHA_PTE_PALCODE & ~(PG_FOR|PG_FOW|PG_FOE))) #define PG_PALCODE(x) ((x) & ALPHA_PTE_PALCODE)
#if defined(_KERNEL) || defined(__KVM_ALPHA_PRIVATE) #if defined(_KERNEL) || defined(__KVM_ALPHA_PRIVATE)
#define NPTEPG_SHIFT (PAGE_SHIFT - PTESHIFT) #define NPTEPG_SHIFT (PAGE_SHIFT - PTESHIFT)