longstanding global_irq_lock race fixes

From: Andrea Arcangeli (andrea@suse.de)
Date: Sat Jan 08 2000 - 11:06:49 EST


I did this patch some time ago. It would be better to kill the global
cli/sti so fixing the races properly, but I don't have such hardware to
test the code I am not going to do that. The fixes below only fixes the
current races. It applyed cleanly to 2.3.36.

diff -urN 2.3.22/arch/sparc/mm/asyncd.c 2.3.22-deadlocks/arch/sparc/mm/asyncd.c
--- 2.3.22/arch/sparc/mm/asyncd.c Tue Sep 14 14:35:01 1999
+++ 2.3.22-deadlocks/arch/sparc/mm/asyncd.c Sat Oct 16 23:09:33 1999
@@ -259,10 +259,11 @@
                 save_flags(flags); cli();
 
                 while (!async_queue) {
- spin_lock_irq(&current->sigmask_lock);
+ spin_lock(&current->sigmask_lock);
                         flush_signals(current);
- spin_unlock_irq(&current->sigmask_lock);
+ spin_unlock(&current->sigmask_lock);
                         interruptible_sleep_on(&asyncd_wait);
+ __sti(); cli();
                 }
 
                 restore_flags(flags);
diff -urN 2.3.22/arch/sparc64/mm/asyncd.c 2.3.22-deadlocks/arch/sparc64/mm/asyncd.c
--- 2.3.22/arch/sparc64/mm/asyncd.c Tue Sep 14 14:33:10 1999
+++ 2.3.22-deadlocks/arch/sparc64/mm/asyncd.c Sat Oct 16 23:17:48 1999
@@ -262,10 +262,11 @@
                 save_flags(flags); cli();
 
                 while (!async_queue) {
- spin_lock_irq(&current->sigmask_lock);
+ spin_lock(&current->sigmask_lock);
                         flush_signals(current);
- spin_unlock_irq(&current->sigmask_lock);
+ spin_unlock(&current->sigmask_lock);
                         interruptible_sleep_on(&asyncd_wait);
+ __sti(); cli(); /* acquire gloabl_irq_lock */
                 }
 
                 restore_flags(flags);
diff -urN 2.3.22/drivers/ap1000/ddv.c 2.3.22-deadlocks/drivers/ap1000/ddv.c
--- 2.3.22/drivers/ap1000/ddv.c Tue Jul 13 02:00:56 1999
+++ 2.3.22-deadlocks/drivers/ap1000/ddv.c Sun Oct 17 00:43:11 1999
@@ -386,10 +386,11 @@
                 save_flags(flags); cli();
 
                 while (!rem_queue) {
- spin_lock_irq(&current->sigmask_lock);
+ spin_lock(&current->sigmask_lock);
                         flush_signals(current);
- spin_unlock_irq(&current->sigmask_lock);
+ spin_unlock(&current->sigmask_lock);
                         interruptible_sleep_on(&ddv_daemon_wait);
+ __sti(); cli();
                 }
 
                 rem = rem_queue;

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:12 EST