Fix the same race condition on 32-bit AIM CPUs that was fixed for 64-bit
ones in r211967 involving VSID allocation.
This commit is contained in:
parent
50398e411f
commit
e9b5f21819
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212278
@ -203,6 +203,7 @@ extern struct pmap ofw_pmap;
|
|||||||
* Lock for the pteg and pvo tables.
|
* Lock for the pteg and pvo tables.
|
||||||
*/
|
*/
|
||||||
struct mtx moea_table_mutex;
|
struct mtx moea_table_mutex;
|
||||||
|
struct mtx moea_vsid_mutex;
|
||||||
|
|
||||||
/* tlbie instruction synchronization */
|
/* tlbie instruction synchronization */
|
||||||
static struct mtx tlbie_mtx;
|
static struct mtx tlbie_mtx;
|
||||||
@ -819,6 +820,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
|
|||||||
*/
|
*/
|
||||||
mtx_init(&moea_table_mutex, "pmap table", NULL, MTX_DEF |
|
mtx_init(&moea_table_mutex, "pmap table", NULL, MTX_DEF |
|
||||||
MTX_RECURSE);
|
MTX_RECURSE);
|
||||||
|
mtx_init(&moea_vsid_mutex, "VSID table", NULL, MTX_DEF);
|
||||||
|
|
||||||
mtx_init(&tlbie_mtx, "tlbie", NULL, MTX_SPIN);
|
mtx_init(&tlbie_mtx, "tlbie", NULL, MTX_SPIN);
|
||||||
|
|
||||||
@ -1589,6 +1591,7 @@ moea_pinit(mmu_t mmu, pmap_t pmap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mtx_lock(&moea_vsid_mutex);
|
||||||
/*
|
/*
|
||||||
* Allocate some segment registers for this pmap.
|
* Allocate some segment registers for this pmap.
|
||||||
*/
|
*/
|
||||||
@ -1623,9 +1626,11 @@ moea_pinit(mmu_t mmu, pmap_t pmap)
|
|||||||
moea_vsid_bitmap[n] |= mask;
|
moea_vsid_bitmap[n] |= mask;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
pmap->pm_sr[i] = VSID_MAKE(i, hash);
|
pmap->pm_sr[i] = VSID_MAKE(i, hash);
|
||||||
|
mtx_unlock(&moea_vsid_mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mtx_unlock(&moea_vsid_mutex);
|
||||||
panic("moea_pinit: out of segments");
|
panic("moea_pinit: out of segments");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1737,10 +1742,12 @@ moea_release(mmu_t mmu, pmap_t pmap)
|
|||||||
if (pmap->pm_sr[0] == 0)
|
if (pmap->pm_sr[0] == 0)
|
||||||
panic("moea_release");
|
panic("moea_release");
|
||||||
|
|
||||||
|
mtx_lock(&moea_vsid_mutex);
|
||||||
idx = VSID_TO_HASH(pmap->pm_sr[0]) & (NPMAPS-1);
|
idx = VSID_TO_HASH(pmap->pm_sr[0]) & (NPMAPS-1);
|
||||||
mask = 1 << (idx % VSID_NBPW);
|
mask = 1 << (idx % VSID_NBPW);
|
||||||
idx /= VSID_NBPW;
|
idx /= VSID_NBPW;
|
||||||
moea_vsid_bitmap[idx] &= ~mask;
|
moea_vsid_bitmap[idx] &= ~mask;
|
||||||
|
mtx_unlock(&moea_vsid_mutex);
|
||||||
PMAP_LOCK_DESTROY(pmap);
|
PMAP_LOCK_DESTROY(pmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user