SPARC/LEON: Made sysclk and per-cpu ticker use same timer
PATCH 1/1 SPARC/LEON: Made sysclk and per-cpu ticker use same timer
This patch makes the per-cpu ticker share the timer with the system clock, it will save HZ interrupts on the boot CPU and free one timer resource.
The LEON SMP port requires only one timer from now on.
--- arch/sparc/include/asm/leon.h | 2 +- arch/sparc/include/asm/leon_amba.h | 3 +- arch/sparc/kernel/entry.S | 3 +- arch/sparc/kernel/leon_kernel.c | 45 ++++++++---------------------------- arch/sparc/kernel/leon_smp.c | 9 ++++++- 5 files changed, 23 insertions(+), 39 deletions(-)
arch/sparc/include/asm/leon.h +1 -1
@@ -240,7 +240,7 @@ static inline int sparc_leon3_cpuid(void)#ifdef CONFIG_SMP # define LEON3_IRQ_RESCHEDULE 13 -# define LEON3_IRQ_TICKER (leon_percpu_timer_dev[0].irq) +# define LEON3_IRQ_TICKER (leon3_gptimer_irq + leon3_gptimer_idx)# define LEON3_IRQ_CROSS_CALL 15#endif
arch/sparc/include/asm/leon_amba.h +2 -1
@@ -182,11 +182,12 @@ void _amba_init(struct device_node *dp, struct device_node ***nextp);extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs;extern struct leon3_gptimer_regs_map *leon3_gptimer_regs; -extern struct amba_apb_device leon_percpu_timer_dev[16 ];extern int leondebug_irq_disable;extern int leon_debug_irqout;extern unsigned long leon3_gptimer_irq; +extern unsigned long leon3_gptimer_idx;/*Timer Index (0..6) within Timer Core*/ extern unsigned int sparc_leon_eirq; +extern unsigned long leon3_cpu_idx;#endif /* __ASSEMBLY__ */
arch/sparc/kernel/entry.S +2 -1
@@ -411,8 +411,9 @@ smpleon_ticker: WRITE_PAUSE wr %g2, PSR_ET, %psr WRITE_PAUSE + mov %l7, %o0 ! irq level call leon_percpu_timer_interrupt - add %sp, STACKFRAME_SZ, %o0 + add %sp, STACKFRAME_SZ, %o1 ! pt_regs wr %l0, PSR_ET, %psr WRITE_PAUSE RESTORE_ALL
arch/sparc/kernel/leon_kernel.c +10 -35
106 lines not on this page · raw message
arch/sparc/kernel/leon_smp.c +8 -1
@@ -51,6 +51,7 @@ extern volatile unsigned long cpu_callin_map[NR_CPUS];extern unsigned char boot_cpu_id;extern cpumask_t smp_commenced_mask;void __init leon_configure_cache_smp (void ); +extern void handler_irq (int irq,struct pt_regs *regs);static inline unsigned long do_swap (volatile unsigned long *ptr,unsigned long val)
@@ -384,11 +385,17 @@ void leon_cross_call_irq(void) ccall_info.processors_out[i] =1 ; } -void leon_percpu_timer_interrupt (struct pt_regs *regs) +void leon_percpu_timer_interrupt (int irq,struct pt_regs *regs) {struct pt_regs *old_regs;int cpu =smp_processor_id (); +/* For the boot-CPU call the generic IRQ handler, the "per-cpu" ticker +* timer IRQ is the same as the system clock timer (same timer). +*/ +if (cpu = leon3_cpu_idx) +handler_irq (irq, regs); + old_regs =set_irq_regs (regs);leon_clear_profile_irq (cpu);
Signature · 1 line
1.5.4
Re: [PATCH] SPARC/LEON: Made sysclk and per-cpu ticker use same
Quoted 4 lines · Daniel Hellstrom
This patch makes the per-cpu ticker share the timer with the system clock, it will save HZ interrupts on the boot CPU and free one timer resource.
The LEON SMP port requires only one timer from now on.
Looks good as far as I could review it.
I'm reluctant to give it an "Acked-by" / "Reviewed-by" as I am not confident enough with this code to do so.
One little nit below..
Sam
Quoted 46 lines
Signed-off-by Daniel Hellstrom <[email protected]>--- arch/sparc/include/asm/leon.h | 2 +- arch/sparc/include/asm/leon_amba.h | 3 +- arch/sparc/kernel/entry.S | 3 +- arch/sparc/kernel/leon_kernel.c | 45 ++++++++---------------------------- arch/sparc/kernel/leon_smp.c | 9 ++++++- 5 files changed, 23 insertions(+), 39 deletions(-)arch/sparc/include/asm/leon.h +1
-1@@ -240,7 +240,7 @@ static inline int sparc_leon3_cpuid(void)#ifdef CONFIG_SMP # define LEON3_IRQ_RESCHEDULE 13 -# define LEON3_IRQ_TICKER (leon_percpu_timer_dev[0].irq) +# define LEON3_IRQ_TICKER (leon3_gptimer_irq + leon3_gptimer_idx)# define LEON3_IRQ_CROSS_CALL 15#endif arch/sparc/include/asm/leon_amba.h +2
-1@@ -182,11 +182,12 @@ void _amba_init(struct device_node *dp, struct device_node ***nextp);extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs;extern struct leon3_gptimer_regs_map *leon3_gptimer_regs; -extern struct amba_apb_device leon_percpu_timer_dev[16 ];extern int leondebug_irq_disable;extern int leon_debug_irqout;extern unsigned long leon3_gptimer_irq; +extern unsigned long leon3_gptimer_idx;/*Timer Index (0..6) within Timer Core*/ extern unsigned int sparc_leon_eirq; +extern unsigned long leon3_cpu_idx;#endif /* __ASSEMBLY__ */ arch/sparc/kernel/entry.S +0
-0
arch/sparc/kernel/entry.S smpleon_ticker: · line 414
Quoted 4 lines
arch/sparc/kernel/entry.S +1
-0@@ -411,8 +411,9 @@ smpleon_ticker: WRITE_PAUSE wr %g2, PSR_ET, %psr WRITE_PAUSE + mov %l7, %o0 ! irq level
I am about to rename this argument to pil as this is the content of the PIL of PSR we pass here.
irq will be an more opauge number.
But all other places in SPARC32 name it irq today. So I can also rename it here when I get to it.
(Comment about naming also apply for the C code.
Sam
Re: [PATCH] SPARC/LEON: Made sysclk and per-cpu ticker use
In reply to Daniel HellstromOn Wed, 5 Jan 2011 20:09:07 0100, Sam Ravnborg wrote:
Quoted 1 line · Daniel Hellstrom
Quoted 1 line
This patch makes the per-cpu ticker share the timer with the
system clock,
Quoted 4 lines
Quoted 3 lines
it will save HZ interrupts on the boot CPU and free one timer resource.
The LEON SMP port requires only one timer from now on.
Quoted 17 lines
Looks good as far as I could review it.
I'm reluctant to give it an "Acked-by" / "Reviewed-by" as I am not confident enough with this code to do so.
One little nit below..
Sam
Quoted 7 lines
Signed-off-by Daniel Hellstrom <[email protected]>--- arch/sparc/include/asm/leon.h | 2 - arch/sparc/include/asm/leon_amba.h | 3 - arch/sparc/kernel/entry.S | 3 - arch/sparc/kernel/leon_kernel.c | 45
----------------------------
Quoted 4 lines
Review
Quoted 4 lines
arch/sparc/kernel/leon_smp.c | 9 - 5 files changed, 23 insertions( ), 39 deletions(-)(quoted diff) +0
-0
b/arch/sparc/include/asm/leon.h
Quoted 5 lines
Quoted 5 lines
index 8580d17..b9df4a9 100644
---a/arch/sparc/include/asm/leon.h
b/arch/sparc/include/asm/leon.h
@@ -240,7 240,7 @@ static inline intsparc_leon3_cpuid(void)
Quoted 8 lines
Review
Quoted 8 lines
#ifdef
CONFIG_SMP# define LEON3_IRQ_RESCHEDULE 13arch/sparc/include/asm/leon.h +0
-1-# define LEON3_IRQ_TICKER (leon_percpu_timer_dev[0].irq)# define LEON3_IRQ_TICKER (leon3_gptimer_irq leon3_gptimer_idx)# define LEON3_IRQ_CROSS_CALL 15#endif (quoted diff) +0
-0
b/arch/sparc/include/asm/leon_amba.h
Quoted 4 lines
Quoted 4 lines
index 263c719..db3f408 100644
---a/arch/sparc/include/asm/leon_amba.h
b/arch/sparc/include/asm/leon_amba.h
@@ -182,11 182,12 @@ void _amba_init(structdevice_node*dp,
struct device_node ***nextp);
Quoted 8 lines
Quoted 8 lines
extern struct
leon3_irqctrl_regs_map*leon3_irqctrl_regs; extern structleon3_gptimer_regs_map*leon3_gptimer_regs;
-extern structamba_apb_deviceleon_percpu_timer_dev[16];
extern intleondebug_irq_disable;
extern intleon_debug_irqout;
extern unsigned longleon3_gptimer_irq;
extern unsigned longleon3_gptimer_idx; /*Timer Index (0..6)
within Timer Core*/
Quoted 19 lines
Quoted 9 lines
extern unsigned int
sparc_leon_eirq;
extern unsigned longleon3_cpu_idx;#endif /*
__ASSEMBLY__*/arch/sparc/kernel/entry.S +0
-1--- a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.SQuoted 5 lines
@@ -411,8 411,9 @@
smpleon_ticker:
WRITE_PAUSE
wr %g2,PSR_ET, %psr
WRITE_PAUSE
mov %l7, %o0 ! irq levelI am about to rename this argument to pil as this is the content of the PIL of PSR we pass here.
irq will be an more opauge number.
Quoted 4 lines
But all other places in SPARC32 name it irq today. So I can also rename it here when I get to it.
(Comment about naming also apply for the C code.
Ok, good point, will think of that in the future,
Â
Thanks,
Daniel