From e796443d470c017a74b5a53aeff1ead3f7cf5c31 Mon Sep 17 00:00:00 2001 From: Peter Grehan Date: Tue, 3 Aug 2004 04:14:55 +0000 Subject: [PATCH] Remove race condition between reading of MSR, setting md_savecrit, and setting MSR. This was most evident with the idle proc running with interrupts disabled and causing a lockup. Switch over to the i386 style which does things in the right order. debug assisted by: gallatin, and the invaluable KTR option. --- sys/powerpc/include/critical.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/powerpc/include/critical.h b/sys/powerpc/include/critical.h index 93a177b1fcac..cc0768af4d3b 100644 --- a/sys/powerpc/include/critical.h +++ b/sys/powerpc/include/critical.h @@ -58,12 +58,8 @@ void cpu_critical_fork_exit(void); static __inline void cpu_critical_enter(struct thread *td) { - u_int msr; - msr = mfmsr(); - td->td_md.md_savecrit = msr; - msr &= ~PSL_EE; - mtmsr(msr); + td->td_md.md_savecrit = intr_disable(); } /* @@ -77,7 +73,7 @@ static __inline void cpu_critical_exit(struct thread *td) { - mtmsr(td->td_md.md_savecrit); + intr_restore(td->td_md.md_savecrit); }