All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] Clean-up powerpc SMP timer support
@ 2005-12-09 17:34 Heikki Lindholm
  2005-12-09 18:27 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Heikki Lindholm @ 2005-12-09 17:34 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

Follow-up for the previously posted powerpc SMP timer support code.

It's better to let each processor set its own disarm_decr. Additionally, 
cuts down unused code from UP build. Tested on a G5 SMP & UP.

-- Heikki Lindholm

[-- Attachment #2: xenomai-powerpc-smp-timers-051209.patch --]
[-- Type: text/plain, Size: 2088 bytes --]

diff -Nru xenomai.orig/ksrc/arch/powerpc/hal.c xenomai/ksrc/arch/powerpc/hal.c
--- xenomai.orig/ksrc/arch/powerpc/hal.c	2005-12-07 19:22:11.000000000 +0200
+++ xenomai/ksrc/arch/powerpc/hal.c	2005-12-09 16:19:11.110664000 +0200
@@ -131,6 +131,7 @@
 }
 
 static void rthal_critical_sync(void) {
+#ifdef CONFIG_SMP
 	rthal_declare_cpuid;
 	
 	rthal_load_cpuid();
@@ -139,20 +140,24 @@
 			/* timer_request */
 			if (rthal_periodic_p[cpuid]) 
 				rthal_set_local_cpu_timer();
-			
+			else
+				disarm_decr[cpuid] = 1;
 			break;
 		case 2:
 			/* timer_release */
 			if (rthal_periodic_p[cpuid])
 				rthal_set_local_cpu_timer();
 			else
+				disarm_decr[cpuid] = 0;
 				set_dec(tb_ticks_per_jiffy);
 			
 			break;
 		case 3:
 			/* cancel action */
+			disarm_decr[cpuid] = 0;
 			break;
 	}
+#endif /* CONFIG_SMP */
 }
 
 static void rthal_smp_relay_tick(unsigned irq, void *cookie)
@@ -183,7 +188,6 @@
 	else {
 		/* Oneshot setup. */
 		for_each_present_cpu(i) {
-			disarm_decr[i] = 1;
 			rthal_periodic_p[i] = 0;
 		}
 #ifdef CONFIG_40x
@@ -191,10 +195,10 @@
 #endif /* CONFIG_40x */
 		rthal_timer_program_shot(tb_ticks_per_jiffy);
 	}
+	rthal_load_cpuid();
+
 	if (err) 
 		goto out;
-	
-	rthal_load_cpuid();
 
 	rthal_irq_release(RTHAL_TIMER_IRQ);
 	if ((err = rthal_irq_request(RTHAL_TIMER_IRQ,
@@ -225,14 +229,14 @@
 	
 	if (rthal_periodic_p[cpuid])
 		rthal_set_local_cpu_timer();
+	else
+		disarm_decr[cpuid] = 1;
 	
 out:
 	if (err) {
 		rthal_sync_op = 3;
 		__ipipe_decr_ticks = tb_ticks_per_jiffy;
-		for_each_present_cpu(i) {
-			disarm_decr[i] = 0;
-		}
+		disarm_decr[cpuid] = 0;
 	}
 	rthal_critical_exit(flags);
 	
@@ -253,10 +257,6 @@
 	if (rthal_periodic_p[cpuid])
 		rthal_set_cpu_timers_unsafe(0);
 	else {
-		int i;
-		for_each_present_cpu(i) {
-			disarm_decr[i] = 0;
-		}
 #ifdef CONFIG_40x
 		mtspr(SPRN_TCR,mfspr(SPRN_TCR)|TCR_ARE); /* Auto-reload on. */
 		mtspr(SPRN_PIT,tb_ticks_per_jiffy);
@@ -273,6 +273,8 @@
 
 	if (rthal_periodic_p[cpuid])
 		rthal_set_local_cpu_timer();
+	else
+		disarm_decr[cpuid] = 0;
     
 	rthal_critical_exit(flags);
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai-core] [PATCH] Clean-up powerpc SMP timer support
  2005-12-09 17:34 [Xenomai-core] [PATCH] Clean-up powerpc SMP timer support Heikki Lindholm
@ 2005-12-09 18:27 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2005-12-09 18:27 UTC (permalink / raw)
  To: Heikki Lindholm; +Cc: xenomai

Heikki Lindholm wrote:
> Follow-up for the previously posted powerpc SMP timer support code.
> 
> It's better to let each processor set its own disarm_decr. Additionally, 
> cuts down unused code from UP build. Tested on a G5 SMP & UP.

Applied, thanks.

-- 

Philippe.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-09 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-09 17:34 [Xenomai-core] [PATCH] Clean-up powerpc SMP timer support Heikki Lindholm
2005-12-09 18:27 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.