Skip to contentSkip to conversation

Spinlock timeout ppc64 addon

PATCH In review Jake Moilanen 1 participant 1 message Jul 6, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Spinlock timeout ppc64 addon

Here's the PPC64 add-on to spinlock timeouts.

Please comment or apply.

Thanks,
Jake

---

arch/ppc64/kernel/chrp_setup.c renamed from arch/ppc64/kernel/chrp_setup.c~spinlock-timeout-ppc64 +0 -4
diff -puN arch/ppc64/kernel/chrp_setup.c~spinlock-timeout-ppc64 arch/ppc64/kernel/chrp_setup.c
@@ -405,10 +405,6 @@ chrp_progress(char *s, unsigned short he
 
 extern void setup_default_decr(void);
 
-/* Some sane defaults: 125 MHz timebase, 1GHz processor */
-#define DEFAULT_TB_FREQ		125000000UL
-#define DEFAULT_PROC_FREQ	(DEFAULT_TB_FREQ * 8)
-
 void __init pSeries_calibrate_decr(void)
 {
 	struct device_node *cpu;
arch/ppc64/kernel/time.c renamed from arch/ppc64/kernel/time.c~spinlock-timeout-ppc64 +1 -1
diff -puN arch/ppc64/kernel/time.c~spinlock-timeout-ppc64 arch/ppc64/kernel/time.c
@@ -81,7 +81,7 @@ static unsigned long first_settimeofday 
 
 #define XSEC_PER_SEC (1024*1024)
 
-unsigned long tb_ticks_per_jiffy;
+unsigned long tb_ticks_per_jiffy = DEFAULT_TB_FREQ / HZ;
 unsigned long tb_ticks_per_usec;
 unsigned long tb_ticks_per_sec;
 unsigned long next_xtime_sync_tb;
include/asm-ppc64/processor.h renamed from include/asm-ppc64/processor.h~spinlock-timeout-ppc64 +3 -0
diff -puN include/asm-ppc64/processor.h~spinlock-timeout-ppc64 include/asm-ppc64/processor.h
@@ -438,6 +438,9 @@ GLUE(.,name):
 
 #endif /* __ASSEMBLY__ */
 
+/* Some sane defaults: 125 MHz timebase, 1GHz processor */
+#define DEFAULT_TB_FREQ		125000000UL
+#define DEFAULT_PROC_FREQ	(DEFAULT_TB_FREQ * 8)
 
 /* Macros for setting and retrieving special purpose registers */
 
include/asm-ppc64/spinlock.h renamed from include/asm-ppc64/spinlock.h~spinlock-timeout-ppc64 +11 -0
diff -puN include/asm-ppc64/spinlock.h~spinlock-timeout-ppc64 include/asm-ppc64/spinlock.h
@@ -216,5 +216,16 @@ static __inline__ int is_write_locked(rw
 
 #define rwlock_is_locked(x)	((x)->lock)
 
+#ifdef CONFIG_SPINLOCK_TIMEOUT
+
+#define ARCH_HAS_SPINLOCK_TIMEOUT
+
+extern unsigned long tb_ticks_per_jiffy;
+
+#define get_spinlock_timeout() (mftb() + (tb_ticks_per_jiffy * SPINLOCK_TIMEOUT * HZ))
+#define check_spinlock_timeout(timeout) (mftb() >= timeout ? 1 : 0)
+
+#endif /* CONFIG_SPINLOCK_TIMEOUT */
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SPINLOCK_H */

_