timers

From: Andrew Morton (andrewm@uow.edu.au)
Date: Sat Jun 03 2000 - 11:06:00 EST


All the attempts to eliminate timer_exit() have ended up too complex to
countenance, so it looks like we're stuck with it.

The module unload race window which exists between the call to
timer_exit() and the return from the handler can be avoided by waiting
on timers during sys_delete_module(). Future work.

This patch does two things:

- #define del_timer_async del_timer

  For tracking the audit process

- Puts a deadlock detector in del_timer_sync.

--- linux-2.4.0test1-ac5/kernel/timer.c Mon May 15 21:25:15 2000
+++ linux-akpm/kernel/timer.c Sat Jun 3 17:22:01 2000
@@ -238,7 +238,17 @@
 
                 if (!running)
                         return ret;
- timer_synchronize(timer);
+
+ {
+ int count = 50*1000*1000;
+ while (timer_is_running(timer) && --count)
+ ;
+ if (count == 0) {
+ printk( "del_timer_sync(%p): deadlock! Called from %p\n",
+ timer, __builtin_return_address(0));
+ printk("See http://www.uow.edu.au/~andrewm/linux/deadlock.html\n");
+ }
+ }
         }
 
         return ret;
--- linux-2.4.0test1-ac5/include/linux/timer.h Tue May 30 18:45:52 2000
+++ linux-akpm/include/linux/timer.h Sun Jun 4 00:46:39 2000
@@ -93,8 +93,10 @@
 #define timer_set_running(t) (void)(t)
 #define timer_is_running(t) (0)
 #define timer_synchronize(t) do { (void)(t); barrier(); } while(0)
-#define del_timer_sync(t) del_timer(t)
+#define del_timer_sync del_timer
 #endif
+
+#define del_timer_async del_timer
 
 /*
  * These inlines deal with timer wrapping correctly. You are

-
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 : Wed Jun 07 2000 - 21:00:17 EST