Skip to contentSkip to conversation

missing mmu ownership change

PATCH New Jun Sun 1 participant 1 message Feb 27, 2003 MIPS

lore
Share & tools
lore

Jun Sun

author
#0 lore raw

PATCH 1/1 missing mmu ownership change

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

include/asm-mips/mmu_context.h renamed from include/asm-mips/mmu_context.h.orig +6 -1
diff -Nru link/include/asm-mips/mmu_context.h.orig link/include/asm-mips/mmu_context.h
@@ -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);
 }
 
include/asm-mips64/mmu_context.h renamed from include/asm-mips64/mmu_context.h.orig +6 -1
diff -Nru link/include/asm-mips64/mmu_context.h.orig link/include/asm-mips64/mmu_context.h
@@ -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);
 }