Skip to contentSkip to conversation

optimise rthal_timer locking

PATCH Applied Jan Kiszka 2 participants 2 messages Jun 21, 2006

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 optimise rthal_timer locking

Hi,

long pending in my tree, I finally decided to role this one out as it is quite lone-standing:

This patch avoids to additionally switch off the local IRQs in rthal_timer_program_shot for the PIPELINE_HEAD case - the caller is expected to hold the nucleus lock with IRQs off anyway. Applies to i386 and ia64.

Jan

asm-i386/hal.h +6 -0
Index: include/asm-i386/hal.h
===================================================================
@@ -177,9 +177,13 @@ rthal_time_t rthal_get_8254_tsc(void);
 
 static inline void rthal_timer_program_shot (unsigned long delay)
 {
+/* With head-optimization, callers are expected to have switched off
+   hard-IRQs already -- no need for additional protection in this case. */
+#ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
     unsigned long flags;
 
     rthal_local_irq_save_hw(flags);
+#endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
 #ifdef CONFIG_X86_LOCAL_APIC
     if (!delay) {
         /* Kick the timer interrupt immediately. */
@@ -201,7 +205,9 @@ static inline void rthal_timer_program_s
 	outb(delay >> 8,0x40);
     }
 #endif /* CONFIG_X86_LOCAL_APIC */
+#ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
     rthal_local_irq_restore_hw(flags);
+#endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
 }
 
 static const char *const rthal_fault_labels[] = {
asm-ia64/hal.h +8 -1
Index: include/asm-ia64/hal.h
===================================================================
@@ -65,11 +65,18 @@ static inline unsigned long long rthal_r
 
 static inline void rthal_timer_program_shot (unsigned long delay)
 {
+/* With head-optimization, callers are expected to have switched off
+   hard-IRQs already -- no need for additional protection in this case. */
+#ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
     unsigned long flags;
-    if (!delay) { delay = 10; }
+
     rthal_local_irq_save_hw(flags);
+#endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
+    if (!delay) { delay = 10; }
     ia64_set_itm(ia64_get_itc() + delay);
+#ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
     rthal_local_irq_restore_hw(flags);
+#endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
 }
 
     /* Private interface -- Internal use only */
#1 lore raw
Quoted 9 lines · Jan Kiszka

Hi,

long pending in my tree, I finally decided to role this one out as it is quite lone-standing:

This patch avoids to additionally switch off the local IRQs in rthal_timer_program_shot for the PIPELINE_HEAD case - the caller is expected to hold the nucleus lock with IRQs off anyway. Applies to i386 and ia64.

Applied, thanks.

Quoted 6 lines

Jan
_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.