Skip to contentSkip to conversation

2.5.69 process.c: cpu_idle() cleanup

Linux-ia64 Jes Sorensen 1 participant 1 message May 11, 2003

lore
Share & tools
lore
#0 lore raw

Hi David.

Looking at the 2.5.69 cpu_idle() code and noticing that it has some SGI specific hooks in it. However I can see other platforms having leds or lcds or something else they want to flash or play little jingles when the box is idle.

As such I suggest we make these hooks that any platform can register. Adding the extra code to the idle loop doesn't seem all that expensive ;-)

This patch goes on top of the gettimeoffset() patch I posted earlier this afternoon.

Cheers,
Jes

arch/ia64/kernel/process.c +8 -10
diff -urN -X /home/jes/exclude-linux linux-2.5.69-030509-timer/arch/ia64/kernel/process.c linux-2.5.69-030509/arch/ia64/kernel/process.c
@@ -33,16 +33,16 @@
 #include <asm/unwind.h>
 #include <asm/user.h>
 
-#ifdef CONFIG_IA64_SGI_SN
-#include <asm/sn/idle.h>
-#endif
-
 #ifdef CONFIG_PERFMON
 # include <asm/perfmon.h>
 #endif
 
 #include "sigframe.h"
 
+void (*ia64_mark_idle_hook)(void);
+void (*ia64_mark_not_idle_hook)(void);
+
+
 void
 ia64_do_show_stack (struct unw_frame_info *info, void *arg)
 {
@@ -187,15 +187,13 @@
 #endif
 
 		while (!need_resched()) {
-#ifdef CONFIG_IA64_SGI_SN
-			snidle();
-#endif
+			if (ia64_mark_idle_hook)
+				ia64_mark_idle_hook();
 			(*idle)();
 		}
 
-#ifdef CONFIG_IA64_SGI_SN
-		snidleoff();
-#endif
+		if (ia64_mark_not_idle_hook)
+			ia64_mark_not_idle_hook();
 
 #ifdef CONFIG_SMP
 		normal_xtp();
arch/ia64/sn/kernel/idle.c +50 -0

50 lines not on this page · raw message

arch/ia64/sn/kernel/setup.c +8 -1
diff -urN -X /home/jes/exclude-linux linux-2.5.69-030509-timer/arch/ia64/sn/kernel/setup.c linux-2.5.69-030509/arch/ia64/sn/kernel/setup.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1999,2001-2002 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999,2001-2003 Silicon Graphics, Inc. All rights reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it 
  * under the terms of version 2 of the GNU General Public License 
@@ -79,6 +79,10 @@
 extern void bte_init_node (nodepda_t *, cnodeid_t);
 extern void bte_init_cpu (void);
 extern void sn_timer_init (void);
+extern void (*ia64_mark_idle_hook)(void);
+extern void (*ia64_mark_not_idle_hook)(void);
+extern void snidle(void);
+extern void snidleoff(void);
 
 unsigned long sn_rtc_cycles_per_second;   
 
@@ -304,6 +308,9 @@
 	current->thread.flags |= IA64_THREAD_FPEMU_NOPRINT;
 
 	sn_timer_init();
+
+	ia64_mark_idle_hook = &snidle;
+	ia64_mark_not_idle_hook = &snidleoff;
 }
 
 /**
include/asm-ia64/sn/idle.h +0 -57

57 lines not on this page · raw message