summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanoj Sarcar <kanoj@engr.sgi.com>2000-04-24 18:27:37 +0000
committerKanoj Sarcar <kanoj@engr.sgi.com>2000-04-24 18:27:37 +0000
commitb300fe5b8a34b50493217d022bf3830d64d74656 (patch)
treef6108c3e5dde7e359aa29a9abe430ba766afa359
parent2bba74b71906107e5bce42b542b862f90cf048b3 (diff)
Fix the init_new_context code not to zap the percpu tlbpid array when
doing a clone-vm operation. Also, the intercpu tlbflush code now properly does its job by flushing the tlbpid only on the current processor, and not on all.
-rw-r--r--arch/mips64/mm/andes.c4
-rw-r--r--arch/mips64/mm/r4xx0.c4
-rw-r--r--include/asm-mips64/mmu_context.h31
3 files changed, 16 insertions, 23 deletions
diff --git a/arch/mips64/mm/andes.c b/arch/mips64/mm/andes.c
index aad9bbb23..17b88ba94 100644
--- a/arch/mips64/mm/andes.c
+++ b/arch/mips64/mm/andes.c
@@ -251,7 +251,7 @@ static void andes_flush_tlb_mm(struct mm_struct *mm)
printk("[tlbmm<%d>]", mm->context);
#endif
__save_and_cli(flags);
- get_new_mmu_context(mm);
+ get_new_cpu_mmu_context(mm, smp_processor_id());
if(mm == current->mm)
set_entryhi(CPU_CONTEXT(smp_processor_id(), mm) & 0xff);
__restore_flags(flags);
@@ -300,7 +300,7 @@ andes_flush_tlb_range(struct mm_struct *mm, unsigned long start,
}
set_entryhi(oldpid);
} else {
- get_new_mmu_context(mm);
+ get_new_cpu_mmu_context(mm, smp_processor_id());
if(mm == current->mm)
set_entryhi(CPU_CONTEXT(smp_processor_id(), mm) &
0xff);
diff --git a/arch/mips64/mm/r4xx0.c b/arch/mips64/mm/r4xx0.c
index d2bd99982..c2b9c4066 100644
--- a/arch/mips64/mm/r4xx0.c
+++ b/arch/mips64/mm/r4xx0.c
@@ -2056,7 +2056,7 @@ static void r4k_flush_tlb_mm(struct mm_struct *mm)
printk("[tlbmm<%d>]", mm->context);
#endif
__save_and_cli(flags);
- get_new_mmu_context(mm);
+ get_new_cpu_mmu_context(mm, smp_processor_id());
if(mm == current->mm)
set_entryhi(CPU_CONTEXT(smp_processor_id(), mm) & 0xff);
__restore_flags(flags);
@@ -2104,7 +2104,7 @@ static void r4k_flush_tlb_range(struct mm_struct *mm, unsigned long start,
}
set_entryhi(oldpid);
} else {
- get_new_mmu_context(mm);
+ get_new_cpu_mmu_context(mm, smp_processor_id());
if(mm == current->mm)
set_entryhi(CPU_CONTEXT(smp_processor_id(),
mm) & 0xff);
diff --git a/include/asm-mips64/mmu_context.h b/include/asm-mips64/mmu_context.h
index 578c782d6..eeb8d9091 100644
--- a/include/asm-mips64/mmu_context.h
+++ b/include/asm-mips64/mmu_context.h
@@ -51,15 +51,6 @@ get_new_cpu_mmu_context(struct mm_struct *mm, unsigned long cpu)
CPU_CONTEXT(cpu, mm) = ASID_CACHE(cpu) = asid;
}
-extern inline void
-get_new_mmu_context(struct mm_struct *mm)
-{
-#ifdef CONFIG_SMP
- memset((void *)mm->context, 0, smp_num_cpus * sizeof(unsigned long));
-#endif
- get_new_cpu_mmu_context(mm, smp_processor_id());
-}
-
/*
* Initialize the context related info for a new mm_struct
* instance.
@@ -70,18 +61,20 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
#ifndef CONFIG_SMP
mm->context = 0;
#else
- /* this allocation can be moved to copy_thread */
- mm->context = (unsigned long)kmalloc(smp_num_cpus *
+ /* Make sure not to do anything during a clone-vm operation */
+ if ((current == tsk) || (current->mm != mm)) {
+ mm->context = (unsigned long)kmalloc(smp_num_cpus *
sizeof(unsigned long), GFP_KERNEL);
- /*
- * Init the "context" values so that a tlbpid allocation
- * happens on the first switch.
- */
- if (mm->context)
- memset((void *)mm->context, 0, smp_num_cpus *
+ /*
+ * Init the "context" values so that a tlbpid allocation
+ * happens on the first switch.
+ */
+ if (mm->context)
+ memset((void *)mm->context, 0, smp_num_cpus *
sizeof(unsigned long));
- else
- printk("Warning: init_new_context failed\n");
+ else
+ printk("Warning: init_new_context failed\n");
+ }
#endif
}