aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2006-02-12 22:48:35 -0500
committerPaul Mackerras <paulus@samba.org>2006-02-23 19:36:31 -0500
commitcb2c9b2741346eb23b177187a51ff5abf08295bd (patch)
tree31433b46f96a00e22ca7e8402fd0bfe1fea3408d /include/asm-powerpc
parent47f78a49206b7f9b0d283ba46a2a5a6ee1796472 (diff)
[PATCH] powerpc: Fix runlatch performance issues
The runlatch SPR can take a lot of time to write. My original runlatch code would set it on every exception entry even though most of the time this was not required. It would also continually set it in the idle loop, which is an issue on an SMT capable processor. Now we cache the runlatch value in a threadinfo bit, and only check for it in decrementer and hardware interrupt exceptions as well as the idle loop. Boot on POWER3, POWER5 and iseries, and compile tested on pmac32. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/reg.h33
-rw-r--r--include/asm-powerpc/thread_info.h4
2 files changed, 5 insertions, 32 deletions
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 12ecc9b9f285..72bfe3af0460 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -615,27 +615,9 @@
615#define proc_trap() asm volatile("trap") 615#define proc_trap() asm volatile("trap")
616 616
617#ifdef CONFIG_PPC64 617#ifdef CONFIG_PPC64
618static inline void ppc64_runlatch_on(void) 618
619{ 619extern void ppc64_runlatch_on(void);
620 unsigned long ctrl; 620extern void ppc64_runlatch_off(void);
621
622 if (cpu_has_feature(CPU_FTR_CTRL)) {
623 ctrl = mfspr(SPRN_CTRLF);
624 ctrl |= CTRL_RUNLATCH;
625 mtspr(SPRN_CTRLT, ctrl);
626 }
627}
628
629static inline void ppc64_runlatch_off(void)
630{
631 unsigned long ctrl;
632
633 if (cpu_has_feature(CPU_FTR_CTRL)) {
634 ctrl = mfspr(SPRN_CTRLF);
635 ctrl &= ~CTRL_RUNLATCH;
636 mtspr(SPRN_CTRLT, ctrl);
637 }
638}
639 621
640extern unsigned long scom970_read(unsigned int address); 622extern unsigned long scom970_read(unsigned int address);
641extern void scom970_write(unsigned int address, unsigned long value); 623extern void scom970_write(unsigned int address, unsigned long value);
@@ -645,15 +627,6 @@ extern void scom970_write(unsigned int address, unsigned long value);
645#define __get_SP() ({unsigned long sp; \ 627#define __get_SP() ({unsigned long sp; \
646 asm volatile("mr %0,1": "=r" (sp)); sp;}) 628 asm volatile("mr %0,1": "=r" (sp)); sp;})
647 629
648#else /* __ASSEMBLY__ */
649
650#define RUNLATCH_ON(REG) \
651BEGIN_FTR_SECTION \
652 mfspr (REG),SPRN_CTRLF; \
653 ori (REG),(REG),CTRL_RUNLATCH; \
654 mtspr SPRN_CTRLT,(REG); \
655END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
656
657#endif /* __ASSEMBLY__ */ 630#endif /* __ASSEMBLY__ */
658#endif /* __KERNEL__ */ 631#endif /* __KERNEL__ */
659#endif /* _ASM_POWERPC_REG_H */ 632#endif /* _ASM_POWERPC_REG_H */
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index c044ec16a879..237fc2b72974 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -113,7 +113,7 @@ static inline struct thread_info *current_thread_info(void)
113#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling 113#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
114 TIF_NEED_RESCHED */ 114 TIF_NEED_RESCHED */
115#define TIF_32BIT 5 /* 32 bit binary */ 115#define TIF_32BIT 5 /* 32 bit binary */
116/* #define SPARE 6 */ 116#define TIF_RUNLATCH 6 /* Is the runlatch enabled? */
117#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ 117#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
118#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ 118#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
119#define TIF_SINGLESTEP 9 /* singlestepping active */ 119#define TIF_SINGLESTEP 9 /* singlestepping active */
@@ -131,7 +131,7 @@ static inline struct thread_info *current_thread_info(void)
131#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 131#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
132#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 132#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
133#define _TIF_32BIT (1<<TIF_32BIT) 133#define _TIF_32BIT (1<<TIF_32BIT)
134/* #define _SPARE (1<<SPARE) */ 134#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
135#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 135#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)