In my previous patch that fixes a bunch of TLB issues, a new bug was introduced. Since we now rely on mm->cpu_vm_mask to indicate the true MMU owner, we need to update this flag whenever there is ownership change. It turns out that activate_mm() does the ownership as well. Here is the patch that fixes this problem. A big thank to Clausen for spotting this and tracing it to a great depth. Jun
diff -Nru link/include/asm-mips/mmu_context.h.orig link/include/asm-mips/mmu_context.h --- link/include/asm-mips/mmu_context.h.orig Thu Feb 20 10:22:57 2003 +++ link/include/asm-mips/mmu_context.h Wed Feb 26 17:43:43 2003 @@ -126,6 +126,7 @@ activate_mm(struct mm_struct *prev, struct mm_struct *next) { unsigned long flags; + int cpu = smp_processor_id(); local_irq_save(flags); @@ -134,7 +135,11 @@ write_c0_entryhi(cpu_context(smp_processor_id(), next)); TLBMISS_HANDLER_SETUP_PGD(next->pgd); - + + /* mark mmu ownership change */ + clear_bit(cpu, &prev->cpu_vm_mask); + set_bit(cpu, &next->cpu_vm_mask); + local_irq_restore(flags); } diff -Nru link/include/asm-mips64/mmu_context.h.orig link/include/asm-mips64/mmu_context.h --- link/include/asm-mips64/mmu_context.h.orig Thu Feb 20 10:23:10 2003 +++ link/include/asm-mips64/mmu_context.h Wed Feb 26 17:44:03 2003 @@ -117,6 +117,7 @@ activate_mm(struct mm_struct *prev, struct mm_struct *next) { unsigned long flags; + int cpu = smp_processor_id(); local_irq_save(flags); @@ -125,7 +126,11 @@ write_c0_entryhi(cpu_context(smp_processor_id(), next)); TLBMISS_HANDLER_SETUP_PGD(next->pgd); - + + /* mark mmu ownership change */ + clear_bit(cpu, &prev->cpu_vm_mask); + set_bit(cpu, &next->cpu_vm_mask); + local_irq_restore(flags); }