Skip to contentSkip to conversation

Make heartbeat per-cpu (fix gemini, RTAS scan on chrps)

PATCH New Cort Dougan 1 participant 1 message Apr 22, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make heartbeat per-cpu (fix gemini, RTAS scan on chrps)

This patch makes the heartbeat calls per-cpu. This allows gemini to only call it on cpu 0 (to update the lights) and fixes the problem with CHRP SMP boards that would end up calling the RTAS scan only on a few CPUS. This patches balances out the RTAS calls deterministically rather than statistically.

arch/ppc/kernel/apus_setup.c +4 -4
diff -Nru a/arch/ppc/kernel/apus_setup.c b/arch/ppc/kernel/apus_setup.c
@@ -109,8 +109,8 @@
 void (*mach_floppy_eject) (void) = NULL;
 #endif
 #ifdef CONFIG_HEARTBEAT
-void (*mach_heartbeat) (int) = NULL;
-extern void apus_heartbeat (void);
+void (*mach_heartbeat[NR_CPUS]) (int) = NULL;
+extern void apus_heartbeat[NR_CPUS] (void);
 #endif
 
 extern unsigned long amiga_model;
@@ -1075,8 +1075,8 @@
 	/*ppc_md.post_irq       = apus_post_irq;*/
 
 #ifdef CONFIG_HEARTBEAT
-	ppc_md.heartbeat      = apus_heartbeat;
-	ppc_md.heartbeat_count = 1;
+	ppc_md.heartbeat[0]      = apus_heartbeat;
+	ppc_md.heartbeat_count[0] = 1;
 #endif
 #ifdef APUS_DEBUG
 	__debug_serinit();
arch/ppc/kernel/chrp_setup.c +46 -8

78 lines not on this page · raw message

arch/ppc/kernel/gemini_setup.c +5 -5
diff -Nru a/arch/ppc/kernel/gemini_setup.c b/arch/ppc/kernel/gemini_setup.c
@@ -196,7 +196,7 @@
 		direction *= -1;
 	led += direction;
 	*(char *)led = 0xff;
-	ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
+	ppc_md.heartbeat_count[0] = ppc_md.heartbeat_reset[0];
 }
 
 int
@@ -325,7 +325,7 @@
 
 	/* Stop LED's on shutdown. From Tim Moloney <[email protected]> */
 
-	ppc_md.heartbeat = NULL;
+	ppc_md.heartbeat[0] = NULL;
 	for (i = 0; i < GEMINI_LEDS; i++)
 		gemini_led_off(i);
 	for(;;);
@@ -664,9 +664,9 @@
 #endif
 		ROOT_DEV = to_kdev_t(0x0801); /* /dev/sda1 */
 
-	ppc_md.heartbeat = gemini_heartbeat;
-	ppc_md.heartbeat_reset = HZ/8;
-	ppc_md.heartbeat_count = 1;
+	ppc_md.heartbeat[0] = gemini_heartbeat;
+	ppc_md.heartbeat_reset[0] = HZ/8;
+	ppc_md.heartbeat_count[0] = 1;
 
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
arch/ppc/kernel/time.c +4 -5
diff -Nru a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
@@ -194,15 +194,14 @@
 		write_unlock(&xtime_lock);
 
 		/*
-		 * We only run the heartbeat on cpu 0.  We also
-		 * need to make sure we catch up with lost interrupts
+		 * We need to make sure we catch up with lost interrupts
 		 * so we do it in this loop rather than after this
 		 * loop like we used to do.
 		 *     -- Cort <[email protected]>
 		 */
-		if ( !smp_processor_id() && ppc_md.heartbeat &&
-		     !ppc_md.heartbeat_count-- )
-			ppc_md.heartbeat();
+		if ( ppc_md.heartbeat[smp_processor_id()] &&
+		     !ppc_md.heartbeat_count[smp_processor_id()]-- )
+			ppc_md.heartbeat[smp_processor_id()]();
 
 	}
 	if ( !disarm_decr[smp_processor_id()] )
include/asm-ppc/machdep.h +4 -3
diff -Nru a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
@@ -10,6 +10,7 @@
 #ifdef CONFIG_APUS
 #include <asm-m68k/machdep.h>
 #endif
+#include <linux/threads.h>
 
 struct pt_regs;
 struct pci_bus;
@@ -39,9 +40,9 @@
 	unsigned long	(*get_rtc_time)(void);
 	void		(*calibrate_decr)(void);
 
-	void		(*heartbeat)(void);
-	unsigned long	heartbeat_reset;
-	unsigned long	heartbeat_count;
+	void		(*heartbeat[NR_CPUS])(void);
+	unsigned long	heartbeat_reset[NR_CPUS];
+	unsigned long	heartbeat_count[NR_CPUS];
 
 	unsigned long	(*find_end_of_memory)(void);
 	void		(*setup_io_mappings)(void);