There are some races during context creation and switching on SMP
sparc32. This fixes one problem and if you have contexts > NR_TASKS then
you probably wont see the others. (There are problems when we need to
steal a context from antother cpu)
Anton
--- linux/arch/sparc/mm/srmmu.c Sat Jul 24 14:03:58 1999
+++ linux_work/arch/sparc/mm/srmmu.c Wed Jul 28 19:56:45 1999
@@ -114,6 +114,7 @@
#define srmmu_ahashfn(addr) ((addr) >> 24)
int viking_mxcc_present = 0;
+static spinlock_t srmmu_context_spinlock = SPIN_LOCK_UNLOCKED;
/* Physical memory can be _very_ non-contiguous on the sun4m, especially
* the SS10/20 class machines and with the latest openprom revisions.
@@ -819,7 +820,9 @@
static void srmmu_switch_to_context(struct task_struct *tsk)
{
if(tsk->mm->context == NO_CONTEXT) {
+ spin_lock(&srmmu_context_spinlock);
alloc_context(tsk->mm);
+ spin_unlock(&srmmu_context_spinlock);
ctxd_set(&srmmu_context_table[tsk->mm->context], tsk->mm->pgd);
}
srmmu_set_context(tsk->mm->context);
@@ -827,7 +830,9 @@
static void srmmu_init_new_context(struct mm_struct *mm)
{
+ spin_lock(&srmmu_context_spinlock);
alloc_context(mm);
+ spin_unlock(&srmmu_context_spinlock);
flush_cache_mm(mm);
ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
@@ -1398,7 +1403,9 @@
if(tsk->mm->context == NO_CONTEXT) {
ctxd_t *ctxp;
+ spin_lock(&srmmu_context_spinlock);
alloc_context(tsk->mm);
+ spin_unlock(&srmmu_context_spinlock);
ctxp = &srmmu_context_table[tsk->mm->context];
srmmu_set_entry((pte_t *)ctxp, __pte((SRMMU_ET_PTD | (srmmu_v2p((unsigned long) tsk->mm->pgd) >> 4))));
hypersparc_flush_page_to_ram((unsigned long)ctxp);
@@ -1411,7 +1418,9 @@
{
ctxd_t *ctxp;
+ spin_lock(&srmmu_context_spinlock);
alloc_context(mm);
+ spin_unlock(&srmmu_context_spinlock);
ctxp = &srmmu_context_table[mm->context];
srmmu_set_entry((pte_t *)ctxp, __pte((SRMMU_ET_PTD | (srmmu_v2p((unsigned long) mm->pgd) >> 4))));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/