Skip to content

Commit

Permalink
Add missing data barriers after storeing a new valid pagetable entry.
Browse files Browse the repository at this point in the history
When moving from an invalid to a valid entry we don't need to invalidate
the tlb, however we do need to ensure the store is ordered before later
memory accesses. This is because this later access may be to a virtual
address within the newly mapped region.

Add the needed barriers to places where we don't later invalidate the
tlb. When we do invalidate the tlb there will be a barrier to correctly
order this.

This fixes a panic on boot on ThunderX2 when INVARIANTS is turned off:
panic: vm_fault_hold: fault on nofault entry, addr: 0xffff000040c11000

Reported by:	jchandra
Tested by:	jchandra
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D19097
  • Loading branch information
zxombie committed Feb 7, 2019
1 parent 2b51ea1 commit 4933549
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sys/arm64/arm64/pmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2862,6 +2862,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_entry_t newpte,

/* Create the new mapping */
pmap_load_store(pte, newpte);
dsb(ishst);

critical_exit();
intr_restore(intr);
Expand Down Expand Up @@ -3281,6 +3282,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
} else {
/* New mappig */
pmap_load_store(l3, new_l3);
dsb(ishst);
}

#if VM_NRESERVLEVEL > 0
Expand Down Expand Up @@ -3435,6 +3437,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags,
* Map the superpage.
*/
(void)pmap_load_store(l2, new_l2);
dsb(ishst);

atomic_add_long(&pmap_l2_mappings, 1);
CTR2(KTR_PMAP, "pmap_enter_l2: success for va %#lx in pmap %p",
Expand Down

0 comments on commit 4933549

Please sign in to comment.