From b8c4149cffcb8f2ca901d97893e02d752a7abfc4 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 19 May 2003 08:02:36 +0000 Subject: [PATCH] Turn pmap_install_pte() into a critical section. We better not get interrupted while writing into the VHPT table. While here, make sure memory accesses a properly ordered. Tag invalidation must happen first so that the hardware VHPT walker will not be able to match this entry while we're updating it and we have to make sure the new new tag gets written only after the PTE is completely updated. Approved by: re (blanket) --- sys/ia64/ia64/pmap.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index c76871ee5f3..9921764d3c3 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -719,18 +719,24 @@ pmap_install_pte(struct ia64_lpte *vhpte, struct ia64_lpte *pte) { u_int64_t *vhp, *p; - /* invalidate the pte */ - atomic_set_64(&vhpte->pte_tag, 1L << 63); - ia64_mf(); /* make sure everyone sees */ + vhp = (u_int64_t *)vhpte; + p = (u_int64_t *)pte; - vhp = (u_int64_t *) vhpte; - p = (u_int64_t *) pte; + critical_enter(); + + /* Invalidate the tag so the VHPT walker will not match this entry. */ + vhp[2] = 1UL << 63; + ia64_mf(); vhp[0] = p[0]; vhp[1] = p[1]; - vhp[2] = p[2]; /* sets ti to one */ - ia64_mf(); + + /* Install a proper tag now that we're done. */ + vhp[2] = p[2]; + ia64_mf(); + + critical_exit(); } /*