diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-05-02 21:24:26 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-05-02 21:24:26 +0000 |
commit | d9eaf2483158cb7685217d0fdd3e0ce1491da21f (patch) | |
tree | fbdf0ad31788a6cdf7db9df0ff02e46c7687ae53 /sys | |
parent | 3c6d56bce56c581130a47fe5239adabb00c789a0 (diff) |
The pmap_vp_enter() function should only ever be called for userland mappings
with the PMAP_CANFAIL flag set. Use PR_NOWAIT in the pool_get() calls such
that we return an error instead of deadlocking if we cannot allocate
a pool item.
ok drahn@ (who says this is needed for SMP as well)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/arm64/pmap.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c index 0e9c8dda9cb..b6884cc6c90 100644 --- a/sys/arch/arm64/arm64/pmap.c +++ b/sys/arch/arm64/arm64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.33 2017/04/15 11:15:02 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.34 2017/05/02 21:24:25 kettenis Exp $ */ /* * Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com> * @@ -322,17 +322,10 @@ pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted, int flags) struct pmapvp2 *vp2; struct pmapvp3 *vp3; - int vp_pool_flags; - if (pm == pmap_kernel()) { - vp_pool_flags = PR_NOWAIT; - } else { - vp_pool_flags = PR_WAITOK |PR_ZERO; - } - if (pm->have_4_level_pt) { vp1 = pm->pm_vp.l0->vp[VP_IDX0(va)]; if (vp1 == NULL) { - vp1 = pool_get(&pmap_vp_pool, vp_pool_flags); + vp1 = pool_get(&pmap_vp_pool, PR_NOWAIT | PR_ZERO); if (vp1 == NULL) { if ((flags & PMAP_CANFAIL) == 0) panic("%s: unable to allocate L1", @@ -347,7 +340,7 @@ pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted, int flags) vp2 = vp1->vp[VP_IDX1(va)]; if (vp2 == NULL) { - vp2 = pool_get(&pmap_vp_pool, vp_pool_flags); + vp2 = pool_get(&pmap_vp_pool, PR_NOWAIT | PR_ZERO); if (vp2 == NULL) { if ((flags & PMAP_CANFAIL) == 0) panic("%s: unable to allocate L2", __func__); @@ -358,7 +351,7 @@ pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted, int flags) vp3 = vp2->vp[VP_IDX2(va)]; if (vp3 == NULL) { - vp3 = pool_get(&pmap_vp_pool, vp_pool_flags); + vp3 = pool_get(&pmap_vp_pool, PR_NOWAIT | PR_ZERO); if (vp3 == NULL) { if ((flags & PMAP_CANFAIL) == 0) panic("%s: unable to allocate L3", __func__); |