shm bugs revisited (2)

Ingo Molnar mingo en chiara.csoma.elte.hu
Jue Ene 27 14:16:57 CST 2000


On 27 Jan 2000, Christoph Rohland wrote:

> running 2.3.{40,41-pre2}+smp-41-A1 is see inconsistent data when using
> shm (2.3.39 seems to be o.K.):

does it happen with smp-2.3.41-A2 (attached)? Reverted the optimization of
reading the pagetable address from current->. (like Manfred suggested too)

-- mingo
------------ próxima parte ------------
--- linux/kernel/sched.c.orig	Thu Jan 27 10:22:30 2000
+++ linux/kernel/sched.c	Thu Jan 27 10:22:36 2000
@@ -412,6 +412,8 @@
 static inline void __schedule_tail(struct task_struct *prev)
 {
 #ifdef __SMP__
+	if (!prev->mm)
+		prev->active_mm = NULL;
 	if ((prev->state == TASK_RUNNING) &&
 			(prev != idle_task(smp_processor_id()))) {
 		unsigned long flags;
@@ -586,10 +588,8 @@
 			switch_mm(oldmm, mm, next, this_cpu);
 		}
 
-		if (!prev->mm) {
-			prev->active_mm = NULL;
+		if (!prev->mm)
 			mmdrop(oldmm);
-		}
 	}
 
 	/*
--- linux/include/asm-i386/pgtable.h.orig	Thu Jan 27 10:22:27 2000
+++ linux/include/asm-i386/pgtable.h	Thu Jan 27 10:29:22 2000
@@ -29,12 +29,13 @@
 
 #define __flush_tlb()							\
 	do {								\
-		__asm__ __volatile__					\
-			("movl %0, %%cr3;"				\
-				:					\
-				: "r" __pa(current->active_mm->pgd)	\
-				: "memory"				\
-		);							\
+		unsigned int tmpreg;					\
+									\
+		__asm__ __volatile__(					\
+			"movl %%cr3, %0;  # flush TLB \n"		\
+			"movl %0, %%cr3;              \n"		\
+			: "=r" (tmpreg)					\
+			:: "memory");					\
 	} while (0)
 
 /*
@@ -43,14 +44,16 @@
  */
 #define __flush_tlb_global()						\
 	do {								\
+		unsigned int tmpreg;					\
+									\
 		__asm__ __volatile__(					\
-			"movl %0, %%cr4; # turn off PGE \n"		\
-			"mov %2, %%cr3;  # flush TLB \n"		\
-			"mov %1, %%cr4;  # turn PGE back on \n"		\
-			:						\
-			: "r" (mmu_cr4_features),			\
-			  "r" (mmu_cr4_features & ~X86_CR4_PGE),	\
-			  "r" (__pa(current->active_mm->pgd))		\
+			"movl %1, %%cr4;  # turn off PGE     \n"	\
+			"movl %%cr3, %0;  # flush TLB        \n"	\
+			"movl %0, %%cr3;                     \n"	\
+			"movl %2, %%cr4;  # turn PGE back on \n"	\
+			: "=r" (tmpreg)					\
+			: "r" (mmu_cr4_features & ~X86_CR4_PGE),	\
+			  "r" (mmu_cr4_features)			\
 			: "memory");					\
 	} while (0)
 


Más información sobre la lista de distribución Ayuda