More SMP cleanup
Subsystems (7)
cover More SMP cleanup
This patch series incorporates patches from the previously posted "Clean up SMP IPI support" series of 9 patches. Patch 5, and 11 onwards are new.
This aims to reduce the amount of code in platform specific files to the barest minimum, while maintaining the flexibility of the API to allow platforms to decide which CPU numbers are populated.
PATCH 1/22 ARM: remove obsolete smp_cross_call_done()
smp_cross_call_done() was removed long ago (see 78d236c - remove useless smp_cross_call_done()). Remove those which have been subsequently merged.
--- arch/arm/mach-tegra/include/mach/smp.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
arch/arm/mach-tegra/include/mach/smp.h +0 -7
@@ -12,11 +12,4 @@ static inline void smp_cross_call(const struct cpumask *mask) gic_raise_softirq(mask, 1); } -/* -* Do nothing on MPcore. -*/ -static inline void smp_cross_call_done (cpumask_t callmap) -{ -} -#endif
Signature · 1 line
1.6.2.5
PATCH 2/22 ARM: SMP: pass an ipi number to smp_cross_call()
In reply to Russell King - ARM LinuxThis allows us to use smp_cross_call() to trigger a number of different software generated interrupts, rather than combining them all on one SGI. Recover the SGI number via do_IPI.
--- arch/arm/include/asm/smp.h | 4 ++-- arch/arm/kernel/entry-armv.S | 2 +- arch/arm/kernel/smp.c | 10 ++-------- arch/arm/mach-msm/include/mach/smp.h | 4 ++-- arch/arm/mach-omap2/omap-smp.c | 2 +- arch/arm/mach-realview/include/mach/smp.h | 4 ++-- arch/arm/mach-realview/platsmp.c | 2 +- arch/arm/mach-s5pv310/include/mach/smp.h | 4 ++-- arch/arm/mach-s5pv310/platsmp.c | 2 +- arch/arm/mach-tegra/include/mach/smp.h | 4 ++-- arch/arm/mach-ux500/include/mach/smp.h | 4 ++-- arch/arm/mach-ux500/platsmp.c | 2 +- arch/arm/mach-vexpress/include/mach/smp.h | 4 ++-- arch/arm/mach-vexpress/platsmp.c | 2 +- arch/arm/plat-omap/include/plat/smp.h | 4 ++-- 15 files changed, 24 insertions(+), 30 deletions(-)
arch/arm/include/asm/smp.h +2 -2
@@ -38,7 +38,7 @@ extern void show_ipi_list(struct seq_file *p);/* * Called from assembly code, this handles an IPI. */ -asmlinkage void do_IPI(struct pt_regs *regs); +asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);/* * Setup the set of possible CPUs (via set_cpu_possible)
@@ -53,7 +53,7 @@ extern void smp_store_cpu_info(unsigned int cpuid);/* * Raise an IPI cross call on CPUs in callmap. */ -extern void smp_cross_call (const struct cpumask *mask); +extern void smp_cross_call (const struct cpumask *mask,int ipi);/* * Boot a secondary CPU, and assign it the specified idle task.
arch/arm/kernel/entry-armv.S +1 -1
@@ -48,7 +48,7 @@ */ ALT_SMP(test_for_ipi r0, r6, r5, lr) ALT_UP_B(9997f) - movne r0, sp + movne r1, sp adrne lr, BSYM(1b) bne do_IPI
arch/arm/kernel/smp.c +2 -8
@@ -404,7 +404,7 @@ static void send_ipi_message(const struct cpumask *mask, enum ipi_msg_type msg)/* * Call the platform specific cross-CPU call function. */ -smp_cross_call (mask); +smp_cross_call (mask,1 );local_irq_restore (flags); }
@@ -537,14 +537,8 @@ static void ipi_cpu_stop(unsigned int cpu)/* * Main handler for inter-processor interrupts -* -* For ARM, the ipimask now only identifies a single -* category of IPI (Bit 1 IPIs have been replaced by a -* different mechanism): -* -* Bit 0 - Inter-processor function call */ -asmlinkage void __exception do_IPI(struct pt_regs *regs) +asmlinkage void __exception do_IPI(int ipinr, struct pt_regs *regs) {unsigned int cpu =smp_processor_id ();struct ipi_data *ipi = &per_cpu (ipi_data, cpu);
arch/arm/mach-msm/include/mach/smp.h +2 -2
@@ -31,9 +31,9 @@#include <asm/hardware/gic.h> -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
arch/arm/mach-omap2/omap-smp.c +1 -1
@@ -76,7 +76,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)omap_modify_auxcoreboot0 (0x200 ,0xfffffdff );flush_cache_all ();smp_wmb (); -smp_cross_call (cpumask_of (cpu)); +smp_cross_call (cpumask_of (cpu),1 );/* * Now the secondary core is starting up let it run its
arch/arm/mach-realview/include/mach/smp.h +2 -2
@@ -7,9 +7,9 @@/* * We use IRQ1 as the IPI */ -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
arch/arm/mach-realview/platsmp.c +1 -1
@@ -116,7 +116,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)* Use smp_cross_call() for this, since there's little * point duplicating the code here */ -smp_cross_call (cpumask_of (cpu)); +smp_cross_call (cpumask_of (cpu),1 ); timeout = jiffies + (1 *HZ );while (time_before (jiffies, timeout)) {
arch/arm/mach-s5pv310/include/mach/smp.h +2 -2
@@ -14,9 +14,9 @@ extern void __iomem *gic_cpu_base_addr;/* * We use IRQ1 as the IPI */ -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
arch/arm/mach-s5pv310/platsmp.c +1 -1
@@ -97,7 +97,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)* the boot monitor to read the system wide flags register, * and branch to the address found there. */ -smp_cross_call (cpumask_of (cpu)); +smp_cross_call (cpumask_of (cpu),1 ); timeout = jiffies + (1 *HZ );while (time_before (jiffies, timeout)) {
arch/arm/mach-tegra/include/mach/smp.h +2 -2
@@ -7,9 +7,9 @@/* * We use IRQ1 as the IPI */ -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
arch/arm/mach-ux500/include/mach/smp.h +2 -2
@@ -18,8 +18,8 @@ extern void u8500_secondary_startup(void);/* * We use IRQ1 as the IPI */ -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
arch/arm/mach-ux500/platsmp.c +1 -1
@@ -78,7 +78,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)__cpuc_flush_dcache_area ((void *)&pen_release,sizeof (pen_release));outer_clean_range (__pa (&pen_release),__pa (&pen_release) +1 ); -smp_cross_call (cpumask_of (cpu)); +smp_cross_call (cpumask_of (cpu),1 ); timeout = jiffies + (1 *HZ );while (time_before (jiffies, timeout)) {
arch/arm/mach-vexpress/include/mach/smp.h +2 -2
@@ -7,8 +7,8 @@/* * We use IRQ1 as the IPI */ -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
arch/arm/mach-vexpress/platsmp.c +1 -1
@@ -92,7 +92,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)* the boot monitor to read the system wide flags register, * and branch to the address found there. */ -smp_cross_call (cpumask_of (cpu)); +smp_cross_call (cpumask_of (cpu),1 ); timeout = jiffies + (1 *HZ );while (time_before (jiffies, timeout)) {
arch/arm/plat-omap/include/plat/smp.h +2 -2
@@ -29,9 +29,9 @@ extern u32 omap_read_auxcoreboot0(void);/* * We use Soft IRQ1 as the IPI */ -static inline void smp_cross_call (const struct cpumask *mask) +static inline void smp_cross_call (const struct cpumask *mask,int ipi) { -gic_raise_softirq (mask,1 ); +gic_raise_softirq (mask, ipi); }#endif
Signature · 1 line
1.6.2.5
PATCH 3/22 ARM: SMP: avoid using bitmasks and locks for IPIs, use hardware instead
In reply to Russell King - ARM LinuxAvoid using bitmasks and locks in the percpu area for IPIs, and instead use individual software generated interrupts to identify the reason for the IPI. This avoids the problems of having spinlocks in the percpu area.
--- arch/arm/kernel/smp.c | 87 ++++++++++++++---------------------------------- 1 files changed, 26 insertions(+), 61 deletions(-)
arch/arm/kernel/smp.c +26 -61
@@ -48,20 +48,15 @@ struct secondary_data secondary_data;/* * structures for inter-processor calls -* - A collection of single bit ipi messages. */ struct ipi_data { -spinlock_t lock;unsigned long ipi_count; -unsigned long bits; }; -static DEFINE_PER_CPU(struct ipi_data, ipi_data) = { - .lock =SPIN_LOCK_UNLOCKED , -}; +static DEFINE_PER_CPU(struct ipi_data, ipi_data);enum ipi_msg_type { -IPI_TIMER , +IPI_TIMER =2 ,IPI_RESCHEDULE ,IPI_CALL_FUNC ,IPI_CALL_FUNC_SINGLE ,
@@ -389,22 +384,13 @@ void __init smp_prepare_boot_cpu(void)static void send_ipi_message (const struct cpumask *mask,enum ipi_msg_type msg) {unsigned long flags; -unsigned int cpu;local_irq_save (flags); -for_each_cpu (cpu, mask) { -struct ipi_data *ipi = &per_cpu (ipi_data, cpu); - -spin_lock (&ipi->lock); - ipi->bits |=1 << msg; -spin_unlock (&ipi->lock); - } -/* * Call the platform specific cross-CPU call function. */ -smp_cross_call (mask,1 ); +smp_cross_call (mask, msg);local_irq_restore (flags); }
@@ -546,56 +532,35 @@ asmlinkage void __exception do_IPI(int ipinr, struct pt_regs *regs) ipi->ipi_count++; -for (;;) { -unsigned long msgs; - -spin_lock (&ipi->lock); - msgs = ipi->bits; - ipi->bits =0 ; -spin_unlock (&ipi->lock); - -if (!msgs) -break ; - -do { -unsigned nextmsg; - - nextmsg = msgs & -msgs; - msgs &= ~nextmsg; - nextmsg =ffz (~nextmsg); - -switch (nextmsg) { -case IPI_TIMER : -ipi_timer (); -break ; +switch (ipinr) { +case IPI_TIMER : +ipi_timer (); +break ; -case IPI_RESCHEDULE : -/* -* nothing more to do - eveything is -* done on the interrupt return path -*/ -break ; +case IPI_RESCHEDULE : +/* +* nothing more to do - eveything is +* done on the interrupt return path +*/ +break ; -case IPI_CALL_FUNC : -generic_smp_call_function_interrupt (); -break ; +case IPI_CALL_FUNC : +generic_smp_call_function_interrupt (); +break ; -case IPI_CALL_FUNC_SINGLE : -generic_smp_call_function_single_interrupt (); -break ; +case IPI_CALL_FUNC_SINGLE : +generic_smp_call_function_single_interrupt (); +break ; -case IPI_CPU_STOP : -ipi_cpu_stop (cpu); -break ; +case IPI_CPU_STOP : +ipi_cpu_stop (cpu); +break ; -default : -printk (KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n" , - cpu, nextmsg); -break ; - } - }while (msgs); +default : +printk (KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n" , + cpu, ipinr); +break ; } -set_irq_regs (old_regs); }
Signature · 1 line
1.6.2.5
PATCH 4/22 ARM: SMP: remove IRQ-disabling for smp_cross_call()
In reply to Russell King - ARM LinuxAs we've now removed the spinlock and bitmask, we have nothing left which requires interrupts to be disabled when sending an IPI. All current IPI-sending implementations use the GIC, which also does not require interrupts disabled when calling gic_raise_softirq().
Remove the now unnecessary IRQ disable.
--- arch/arm/kernel/smp.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
arch/arm/kernel/smp.c +0 -6
@@ -383,16 +383,10 @@ void __init smp_prepare_boot_cpu(void)static void send_ipi_message (const struct cpumask *mask,enum ipi_msg_type msg) { -unsigned long flags; - -local_irq_save (flags); -/* * Call the platform specific cross-CPU call function. */ smp_cross_call (mask, msg); - -local_irq_restore (flags); }void arch_send_call_function_ipi_mask (const struct cpumask *mask)
Signature · 1 line
1.6.2.5
PATCH 5/22 ARM: include local timer irq stats only when local timers configured
In reply to Russell King - ARM Linux--- arch/arm/include/asm/hardirq.h | 2 ++ arch/arm/kernel/irq.c | 2 ++ arch/arm/kernel/smp.c | 24 ++++++++++++------------ 3 files changed, 16 insertions(+), 12 deletions(-)
arch/arm/include/asm/hardirq.h +2 -0
@@ -7,7 +7,9 @@typedef struct {unsigned int __softirq_pending; +#ifdef CONFIG_LOCAL_TIMERS unsigned int local_timer_irqs; +#endif }____cacheline_aligned irq_cpustat_t ;#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
arch/arm/kernel/irq.c +2 -0
@@ -93,6 +93,8 @@ unlock:#endif #ifdef CONFIG_SMP show_ipi_list (p); +#endif +#ifdef CONFIG_LOCAL_TIMERS show_local_irqs (p);#endif seq_printf (p,"Err: %10lu\n" , irq_err_count);
arch/arm/kernel/smp.c +12 -12
@@ -411,18 +411,6 @@ void show_ipi_list(struct seq_file *p)seq_putc (p,'\n' ); } -void show_local_irqs (struct seq_file *p) -{ -unsigned int cpu; - -seq_printf (p,"LOC: " ); - -for_each_present_cpu (cpu) -seq_printf (p,"%10u " , irq_stat[cpu].local_timer_irqs); - -seq_putc (p,'\n' ); -} -/* * Timer (local or broadcast) support */
@@ -449,6 +437,18 @@ asmlinkage void __exception do_local_timer(struct pt_regs *regs) set_irq_regs(old_regs); } + +void show_local_irqs (struct seq_file *p) +{ +unsigned int cpu; + +seq_printf (p,"LOC: " ); + +for_each_present_cpu (cpu) +seq_printf (p,"%10u " , irq_stat[cpu].local_timer_irqs); + +seq_putc (p,'\n' ); +}#endif #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
Signature · 1 line
1.6.2.5
PATCH 6/22 ARM: SMP: provide accessors for irq_stat data
In reply to Russell King - ARM LinuxProvide __inc_irq_stat() and __get_irq_stat() to increment and read the irq stat counters.
--- arch/arm/include/asm/hardirq.h | 3 +++ arch/arm/kernel/smp.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/include/asm/hardirq.h +3 -0
@@ -14,6 +14,9 @@ typedef struct {#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ +#define __inc_irq_stat (cpu, member) __IRQ_STAT(cpu, member)++ +#define __get_irq_stat (cpu, member) __IRQ_STAT(cpu, member) +#if NR_IRQS >512 #define HARDIRQ_BITS 10#elif NR_IRQS >256
arch/arm/kernel/smp.c +2 -2
@@ -431,7 +431,7 @@ asmlinkage void __exception do_local_timer(struct pt_regs *regs)int cpu =smp_processor_id ();if (local_timer_ack ()) { - irq_stat[cpu].local_timer_irqs++; +__inc_irq_stat (cpu, local_timer_irqs);ipi_timer (); }
@@ -445,7 +445,7 @@ void show_local_irqs(struct seq_file *p)seq_printf (p,"LOC: " );for_each_present_cpu (cpu) -seq_printf (p,"%10u " , irq_stat[cpu].local_timer_irqs); +seq_printf (p,"%10u " ,__get_irq_stat (cpu, local_timer_irqs));seq_putc (p,'\n' ); }
Signature · 1 line
1.6.2.5
PATCH 7/22 ARM: SMP: move ipi_count into irq_stat structure
In reply to Russell King - ARM LinuxMove the ipi_count into irq_stat, which allows the ipi_data structure to be entirely removed.
--- arch/arm/include/asm/hardirq.h | 3 +++ arch/arm/kernel/smp.c | 14 ++------------ 2 files changed, 5 insertions(+), 12 deletions(-)
arch/arm/include/asm/hardirq.h +3 -0
@@ -10,6 +10,9 @@ typedef struct {#ifdef CONFIG_LOCAL_TIMERS unsigned int local_timer_irqs;#endif +#ifdef CONFIG_SMP +unsigned int ipi_irqs; +#endif }____cacheline_aligned irq_cpustat_t;#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
arch/arm/kernel/smp.c +2 -12
@@ -46,15 +46,6 @@*/ struct secondary_data secondary_data; -/* -* structures for inter-processor calls -*/ -struct ipi_data { -unsigned long ipi_count; -}; - -static DEFINE_PER_CPU(struct ipi_data, ipi_data); -enum ipi_msg_type {IPI_TIMER =2 ,IPI_RESCHEDULE ,
@@ -406,7 +397,7 @@ void show_ipi_list(struct seq_file *p)seq_puts (p,"IPI:" );for_each_present_cpu (cpu) -seq_printf (p," %10lu" ,per_cpu (ipi_data, cpu).ipi_count); +seq_printf (p," %10u" ,__get_irq_stat (cpu, ipi_irqs));seq_putc (p,'\n' ); }
@@ -521,10 +512,9 @@ static void ipi_cpu_stop(unsigned int cpu) asmlinkage void __exception do_IPI(int ipinr, struct pt_regs *regs) {unsigned int cpu =smp_processor_id (); -struct ipi_data *ipi = &per_cpu (ipi_data, cpu);struct pt_regs *old_regs =set_irq_regs (regs); - ipi->ipi_count++; +__inc_irq_stat (cpu, ipi_irqs);switch (ipinr) {case IPI_TIMER :
Signature · 1 line
1.6.2.5
PATCH 8/22 ARM: fix /proc/interrupts formatting
In reply to Russell King - ARM LinuxAs per x86, align the initial column according to how many IRQs we have. Also, provide an english explaination for the 'LOC:' and 'IPI:' lines.
--- arch/arm/include/asm/mach/irq.h | 2 +- arch/arm/include/asm/smp.h | 4 ++-- arch/arm/kernel/fiq.c | 5 +++-- arch/arm/kernel/irq.c | 16 ++++++++++------ arch/arm/kernel/smp.c | 14 +++++++------- 5 files changed, 23 insertions(+), 18 deletions(-)
arch/arm/include/asm/mach/irq.h +1 -1
@@ -20,7 +20,7 @@ struct seq_file;extern unsigned int arch_nr_irqs;extern void (*init_arch_irq)(void );extern void init_FIQ (void ); -extern int show_fiq_list (struct seq_file *,void *); +extern int show_fiq_list (struct seq_file *,int );/* * This is for easy migration, but should be changed in the source
arch/arm/include/asm/smp.h +2 -2
@@ -33,7 +33,7 @@ struct seq_file;/* * generate IPI list text */ -extern void show_ipi_list (struct seq_file *p); +extern void show_ipi_list (struct seq_file *,int );/* * Called from assembly code, this handles an IPI.
@@ -97,6 +97,6 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);/* * show local interrupt info */ -extern void show_local_irqs (struct seq_file *); +extern void show_local_irqs (struct seq_file *,int );#endif /* ifndef __ASM_ARM_SMP_H */
arch/arm/kernel/fiq.c +3 -2
@@ -67,10 +67,11 @@ static struct fiq_handler default_owner = {static struct fiq_handler *current_fiq = &default_owner; -int show_fiq_list (struct seq_file *p,void *v) +int show_fiq_list (struct seq_file *p,int prec) {if (current_fiq != &default_owner) -seq_printf (p,"FIQ: %s\n" , current_fiq->name); +seq_printf (p,"%*s: %s\n" , prec,"FIQ" , + current_fiq->name);return 0 ; }
arch/arm/kernel/irq.c +10 -6
@@ -57,11 +57,15 @@ int show_interrupts(struct seq_file *p, void *v)struct irq_desc *desc;struct irqaction * action;unsigned long flags; +int prec, n; + +for (prec =3 , n =1000 ; prec <10 && n <= nr_irqs; prec++) + n *=10 ;if (i ==0 ) {char cpuname[12 ]; -seq_printf (p," " ); +seq_printf (p,"%*s " , prec,"" );for_each_present_cpu (cpu) {sprintf (cpuname,"CPU%d" , cpu);seq_printf (p," %10s" , cpuname);
@@ -76,7 +80,7 @@ int show_interrupts(struct seq_file *p, void *v)if (!action) goto unlock; -seq_printf (p,"%3d: " , i); +seq_printf (p,"%*d: " , prec, i);for_each_present_cpu (cpu)seq_printf (p,"%10u " ,kstat_irqs_cpu (i, cpu));seq_printf (p," %10s" , desc->chip->name ? :"-" );
@@ -89,15 +93,15 @@ unlock:raw_spin_unlock_irqrestore (&desc->lock, flags); }else if (i == nr_irqs) {#ifdef CONFIG_FIQ -show_fiq_list (p, v); +show_fiq_list (p, prec);#endif #ifdef CONFIG_SMP -show_ipi_list (p); +show_ipi_list (p, prec);#endif #ifdef CONFIG_LOCAL_TIMERS -show_local_irqs (p); +show_local_irqs (p, prec);#endif -seq_printf (p,"Err: %10lu\n" , irq_err_count); +seq_printf (p,"%*s: %10lu\n" , prec,"Err" , irq_err_count); }return 0 ; }
arch/arm/kernel/smp.c +7 -7
@@ -390,16 +390,16 @@ void arch_send_call_function_single_ipi(int cpu)send_ipi_message (cpumask_of (cpu),IPI_CALL_FUNC_SINGLE ); } -void show_ipi_list (struct seq_file *p) +void show_ipi_list (struct seq_file *p,int prec) {unsigned int cpu; -seq_puts (p,"IPI:" ); +seq_printf (p,"%*s: " , prec,"IPI" );for_each_present_cpu (cpu) -seq_printf (p," %10u" ,__get_irq_stat (cpu, ipi_irqs)); +seq_printf (p,"%10u " ,__get_irq_stat (cpu, ipi_irqs)); -seq_putc (p,'\n' ); +seq_printf (p," Inter-processor interrupts\n" ); }/*
@@ -429,16 +429,16 @@ asmlinkage void __exception do_local_timer(struct pt_regs *regs) set_irq_regs(old_regs); } -void show_local_irqs (struct seq_file *p) +void show_local_irqs (struct seq_file *p,int prec) {unsigned int cpu; -seq_printf (p,"LOC: " ); +seq_printf (p,"%*s: " , prec,"LOC" );for_each_present_cpu (cpu)seq_printf (p,"%10u " ,__get_irq_stat (cpu, local_timer_irqs)); -seq_putc (p,'\n' ); +seq_printf (p," Local timer interrupts\n" ); }#endif
Signature · 1 line
1.6.2.5
PATCH 9/22 ARM: SMP: provide individual IPI interrupt statistics
In reply to Russell King - ARM LinuxThis separates out the individual IPI interrupt counts from the total IPI count, which allows better visibility of what IPIs are being used for.
--- arch/arm/include/asm/hardirq.h | 4 +++- arch/arm/kernel/irq.c | 5 +++++ arch/arm/kernel/smp.c | 25 +++++++++++++++++++------ 3 files changed, 27 insertions(+), 7 deletions(-)
arch/arm/include/asm/hardirq.h +3 -1
@@ -5,13 +5,15 @@#include <linux/threads.h> #include <asm/irq.h> +#define NR_IPI 5 +typedef struct {unsigned int __softirq_pending;#ifdef CONFIG_LOCAL_TIMERS unsigned int local_timer_irqs;#endif #ifdef CONFIG_SMP -unsigned int ipi_irqs; +unsigned int ipi_irqs[NR_IPI ];#endif }____cacheline_aligned irq_cpustat_t ;
arch/arm/kernel/irq.c +5 -0
@@ -62,6 +62,11 @@ int show_interrupts(struct seq_file *p, void *v)for (prec =3 , n =1000 ; prec <10 && n <= nr_irqs; prec++) n *=10 ; +#ifdef CONFIG_SMP +if (prec <4 ) + prec =4 ; +#endif +if (i ==0 ) {char cpuname[12 ];
arch/arm/kernel/smp.c +19 -6
@@ -390,16 +390,28 @@ void arch_send_call_function_single_ipi(int cpu)send_ipi_message (cpumask_of (cpu),IPI_CALL_FUNC_SINGLE ); } +static const char *ipi_types[NR_IPI ] = { +#define S(x,s) [x - IPI_TIMER] = s +S (IPI_TIMER ,"Timer broadcast interrupts" ), +S (IPI_RESCHEDULE ,"Rescheduling interrupts" ), +S (IPI_CALL_FUNC ,"Function call interrupts" ), +S (IPI_CALL_FUNC_SINGLE ,"Single function call interrupts" ), +S (IPI_CPU_STOP ,"CPU stop interrupts" ), +}; +void show_ipi_list (struct seq_file *p,int prec) { -unsigned int cpu; +unsigned int cpu, i; -seq_printf (p,"%*s: " , prec,"IPI" ); +for (i =0 ; i <NR_IPI ; i++) { +seq_printf (p,"%*s%u: " , prec -1 ,"IPI" , i); -for_each_present_cpu (cpu) -seq_printf (p,"%10u " ,__get_irq_stat (cpu, ipi_irqs)); +for_each_present_cpu (cpu) +seq_printf (p,"%10u " , +__get_irq_stat (cpu, ipi_irqs[i])); -seq_printf (p," Inter-processor interrupts\n" ); +seq_printf (p," %s\n" , ipi_types[i]); + } }/*
@@ -514,7 +526,8 @@ asmlinkage void __exception do_IPI(int ipinr, struct pt_regs *regs)unsigned int cpu =smp_processor_id ();struct pt_regs *old_regs =set_irq_regs (regs); -__inc_irq_stat (cpu, ipi_irqs); +if (ipinr >=IPI_TIMER && ipinr <IPI_TIMER +NR_IPI ) +__inc_irq_stat (cpu, ipi_irqs[ipinr -IPI_TIMER ]);switch (ipinr) {case IPI_TIMER :
Signature · 1 line
1.6.2.5
PATCH 10/22 ARM: SMP: collect IPI and local timer IRQs for /proc/stat
In reply to Russell King - ARM LinuxThe IPI and local timer interrupts weren't being properly accounted for in /proc/stat. Collect them from the irq_stat structure, and return their sum.
--- arch/arm/include/asm/hardirq.h | 8 ++++++++ arch/arm/kernel/smp.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/include/asm/hardirq.h +8 -0
@@ -22,6 +22,14 @@ typedef struct {#define __inc_irq_stat (cpu, member) __IRQ_STAT(cpu, member)++#define __get_irq_stat (cpu, member) __IRQ_STAT(cpu, member) +#ifdef CONFIG_SMP +u64 smp_irq_stat_cpu (unsigned int cpu); +#else +#define smp_irq_stat_cpu (cpu) 0 +#endif + +#define arch_irq_stat_cpu smp_irq_stat_cpu +#if NR_IRQS >512 #define HARDIRQ_BITS 10#elif NR_IRQS >256
arch/arm/kernel/smp.c +15 -0
@@ -414,6 +414,21 @@ void show_ipi_list(struct seq_file *p, int prec) } } +u64 smp_irq_stat_cpu (unsigned int cpu) +{ +u64 sum =0 ; +int i; + +for (i =0 ; i <NR_IPI ; i++) + sum +=__get_irq_stat (cpu, ipi_irqs[i]); + +#ifdef CONFIG_LOCAL_TIMERS + sum +=__get_irq_stat (cpu, local_timer_irqs); +#endif + +return sum; +} +/* * Timer (local or broadcast) support */
Signature · 1 line
1.6.2.5
PATCH 11/22 ARM: SMP: use more sane register allocation for __fixup_smp_on_up
In reply to Russell King - ARM LinuxUse r0,r3-r6 rather than r0,r3,r4,r6,r7, which makes it easier to understand which registers can be modified. Also document which registers hold values which must be preserved.
--- arch/arm/kernel/head.S | 39 ++++++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 17 deletions(-)
arch/arm/kernel/head.S +22 -17
@@ -89,6 +89,11 @@ ENTRY(stext) bl __lookup_machine_type @ r5=machinfo movs r8, r5 @ invalid machine (r5=0)? beq __error_a @ yes, error 'a' + + /* + * r1 = machine no, r2 = atags, + * r8 = machinfo, r9 = cpuid, r10 = procinfo + */ bl __vet_atags #ifdef CONFIG_SMP_ON_UP bl __fixup_smp
@@ -381,19 +386,19 @@ ENDPROC(__turn_mmu_on) #ifdef CONFIG_SMP_ON_UP __fixup_smp: - mov r7, #0x00070000 - orr r6, r7, #0xff000000 @ mask 0xff070000 - orr r7, r7, #0x41000000 @ val 0x41070000 - and r0, r9, r6 - teq r0, r7 @ ARM CPU and ARMv6/v7? + mov r4, #0x00070000 + orr r3, r4, #0xff000000 @ mask 0xff070000 + orr r4, r4, #0x41000000 @ val 0x41070000 + and r0, r9, r3 + teq r0, r4 @ ARM CPU and ARMv6/v7? bne __fixup_smp_on_up @ no, assume UP - orr r6, r6, #0x0000ff00 - orr r6, r6, #0x000000f0 @ mask 0xff07fff0 - orr r7, r7, #0x0000b000 - orr r7, r7, #0x00000020 @ val 0x4107b020 - and r0, r9, r6 - teq r0, r7 @ ARM 11MPCore? + orr r3, r3, #0x0000ff00 + orr r3, r3, #0x000000f0 @ mask 0xff07fff0 + orr r4, r4, #0x0000b000 + orr r4, r4, #0x00000020 @ val 0x4107b020 + and r0, r9, r3 + teq r0, r4 @ ARM 11MPCore? moveq pc, lr @ yes, assume SMP mrc p15, 0, r0, c0, c0, 5 @ read MPIDR
@@ -402,13 +407,13 @@ __fixup_smp: __fixup_smp_on_up: adr r0, 1f - ldmia r0, {r3, r6, r7} + ldmia r0, {r3 - r5} sub r3, r0, r3 - add r6, r6, r3 - add r7, r7, r3 -2: cmp r6, r7 - ldmia r6!, {r0, r4} - strlo r4, [r0, r3] + add r4, r4, r3 + add r5, r5, r3 +2: cmp r4, r5 + ldmia r4!, {r0, r6} + strlo r6, [r0, r3] blo 2b mov pc, lr ENDPROC(__fixup_smp)
Signature · 1 line
1.6.2.5
PATCH 12/22 ARM: SMP: ensure smp_send_stop() waits for CPUs to stop
In reply to Russell King - ARM LinuxWait for CPUs to indicate that they've stopped, after sending the stop IPI, rather than blindly continuing on and hoping that they've stopped in time. Print a warning if we fail to stop the other CPUs.
--- arch/arm/kernel/smp.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
arch/arm/kernel/smp.c +15 -3
@@ -583,10 +583,22 @@ void smp_send_reschedule(int cpu)void smp_send_stop (void ) { -cpumask_t mask = cpu_online_map; -cpu_clear (smp_processor_id (), mask); -if (!cpus_empty (mask)) +unsigned long timeout; + +if (num_online_cpus () >1 ) { +cpumask_t mask = cpu_online_map; +cpu_clear (smp_processor_id (), mask); +send_ipi_message (&mask,IPI_CPU_STOP ); + } + +/* Wait up to one second for other CPUs to stop */ + timeout =USEC_PER_SEC ; +while (num_online_cpus () >1 && timeout--) +udelay (1 ); + +if (num_online_cpus () >1 ) +pr_warning ("SMP: failed to stop secondary CPUs\n" ); }/*
Signature · 1 line
1.6.2.5
PATCH 13/22 ARM: SMP: move CPU number sanity checks to smp_init_cpus()
In reply to Russell King - ARM LinuxEnsure that the number of CPUs is sanity checked before setting the number of possible CPUs. This avoids any chance of overflowing the cpu_possible bitmap.
--- arch/arm/mach-omap2/omap-smp.c | 21 +++++++++++---------- arch/arm/mach-realview/platsmp.c | 20 ++++++++++---------- arch/arm/mach-ux500/platsmp.c | 26 +++++++++++++------------- 3 files changed, 34 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/omap-smp.c +11 -10
@@ -120,16 +120,6 @@ void __init smp_init_cpus(void) ncores =get_core_count (); -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); -} - -void __init smp_prepare_cpus (unsigned int max_cpus) -{ -unsigned int ncores =get_core_count (); -unsigned int cpu =smp_processor_id (); -int i; -/* sanity check */ if (ncores ==0 ) { printk(KERN_ERR
@@ -144,6 +134,17 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ncores, NR_CPUS); ncores =NR_CPUS ; } + +for (i =0 ; i < ncores; i++) +set_cpu_possible (i, true); +} + +void __init smp_prepare_cpus (unsigned int max_cpus) +{ +unsigned int ncores =num_possible_cpus (); +unsigned int cpu =smp_processor_id (); +int i; +smp_store_cpu_info (cpu);/*
arch/arm/mach-realview/platsmp.c +10 -10
@@ -160,16 +160,6 @@ void __init smp_init_cpus(void) {unsigned int i, ncores =get_core_count (); -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); -} - -void __init smp_prepare_cpus (unsigned int max_cpus) -{ -unsigned int ncores =get_core_count (); -unsigned int cpu =smp_processor_id (); -int i; -/* sanity check */ if (ncores ==0 ) { printk(KERN_ERR
@@ -186,6 +176,16 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ncores =NR_CPUS ; } +for (i =0 ; i < ncores; i++) +set_cpu_possible (i, true); +} + +void __init smp_prepare_cpus (unsigned int max_cpus) +{ +unsigned int ncores =num_possible_cpus (); +unsigned int cpu =smp_processor_id (); +int i; +smp_store_cpu_info (cpu);/*
arch/arm/mach-ux500/platsmp.c +13 -13
@@ -128,16 +128,6 @@ void __init smp_init_cpus(void) {unsigned int i, ncores =get_core_count (); -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); -} - -void __init smp_prepare_cpus (unsigned int max_cpus) -{ -unsigned int ncores =get_core_count (); -unsigned int cpu =smp_processor_id (); -int i; -/* sanity check */ if (ncores ==0 ) { printk(KERN_ERR
@@ -145,14 +135,24 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ncores =1 ; } -if (ncores >num_possible_cpus ()) { +if (ncores >NR_CPUS ) {printk (KERN_WARNING "U8500: no. of cores (%d) greater than configured " "maximum of %d - clipping\n" , - ncores,num_possible_cpus ()); - ncores =num_possible_cpus (); + ncores,NR_CPUS ); + ncores =NR_CPUS ; } +for (i =0 ; i < ncores; i++) +set_cpu_possible (i, true); +} + +void __init smp_prepare_cpus (unsigned int max_cpus) +{ +unsigned int ncores =num_possible_cpus (); +unsigned int cpu =smp_processor_id (); +int i; +smp_store_cpu_info (cpu);/*
Signature · 1 line
1.6.2.5
PATCH 14/22 ARM: SMP: Clean up ncores sanity checks
In reply to Russell King - ARM Linuxscu_get_core_count() never returns zero cores, so we don't need to check and correct if ncores is zero.
Tegra was missing the check against NR_CPUS, leading to a potential bitfield overflow if this becomes the case.
--- arch/arm/mach-omap2/omap-smp.c | 6 ------ arch/arm/mach-realview/platsmp.c | 7 ------- arch/arm/mach-s5pv310/platsmp.c | 7 ------- arch/arm/mach-tegra/platsmp.c | 6 ++++++ arch/arm/mach-ux500/platsmp.c | 6 ------ arch/arm/mach-vexpress/platsmp.c | 7 ------- 6 files changed, 6 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/omap-smp.c +0 -6
@@ -121,12 +121,6 @@ void __init smp_init_cpus(void) ncores =get_core_count ();/* sanity check */ -if (ncores ==0 ) { -printk (KERN_ERR -"OMAP4: strange core count of 0? Default to 1\n" ); - ncores =1 ; - } -if (ncores >NR_CPUS ) {printk (KERN_WARNING "OMAP4: no. of cores (%d) greater than configured "
arch/arm/mach-realview/platsmp.c +0 -7
@@ -161,13 +161,6 @@ void __init smp_init_cpus(void)unsigned int i, ncores =get_core_count ();/* sanity check */ -if (ncores ==0 ) { -printk (KERN_ERR -"Realview: strange CM count of 0? Default to 1\n" ); - - ncores =1 ; - } -if (ncores >NR_CPUS ) {printk (KERN_WARNING "Realview: no. of cores (%d) greater than configured "
arch/arm/mach-s5pv310/platsmp.c +0 -7
@@ -130,13 +130,6 @@ void __init smp_init_cpus(void) ncores = scu_base ?scu_get_core_count (scu_base) :1 ;/* sanity check */ -if (ncores ==0 ) { -printk (KERN_ERR -"S5PV310: strange CM count of 0? Default to 1\n" ); - - ncores =1 ; - } -if (ncores >NR_CPUS ) {printk (KERN_WARNING "S5PV310: no. of cores (%d) greater than configured "
arch/arm/mach-tegra/platsmp.c +6 -0
@@ -117,6 +117,12 @@ void __init smp_init_cpus(void) {unsigned int i, ncores =scu_get_core_count (scu_base); +if (ncores >NR_CPUS ) { +printk (KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n" , + ncores,NR_CPUS ); + ncores =NR_CPUS ; + } +for (i =0 ; i < ncores; i++)cpu_set (i, cpu_possible_map); }
arch/arm/mach-ux500/platsmp.c +0 -6
@@ -129,12 +129,6 @@ void __init smp_init_cpus(void)unsigned int i, ncores =get_core_count ();/* sanity check */ -if (ncores ==0 ) { -printk (KERN_ERR -"U8500: strange CM count of 0? Default to 1\n" ); - ncores =1 ; - } -if (ncores >NR_CPUS ) {printk (KERN_WARNING "U8500: no. of cores (%d) greater than configured "
arch/arm/mach-vexpress/platsmp.c +0 -7
@@ -124,13 +124,6 @@ void __init smp_init_cpus(void) ncores = scu_base ?scu_get_core_count (scu_base) :1 ;/* sanity check */ -if (ncores ==0 ) { -printk (KERN_ERR -"vexpress: strange CM count of 0? Default to 1\n" ); - - ncores =1 ; - } -if (ncores >NR_CPUS ) {printk (KERN_WARNING "vexpress: no. of cores (%d) greater than configured "
Signature · 1 line
1.6.2.5
PATCH 15/22 ARM: SMP: get rid of get_core_count()
In reply to Russell King - ARM LinuxWe don't need this small function as well as scu_get_core_count()
--- arch/arm/mach-omap2/omap-smp.c | 12 +----------- arch/arm/mach-realview/platsmp.c | 13 ++++--------- arch/arm/mach-ux500/platsmp.c | 9 +++------ 3 files changed, 8 insertions(+), 26 deletions(-)
arch/arm/mach-omap2/omap-smp.c +1 -11
@@ -29,16 +29,6 @@/* SCU base address */ static void __iomem *scu_base; -/* -* Use SCU config register to count number of cores -*/ -static inline unsigned int get_core_count (void ) -{ -if (scu_base) -return scu_get_core_count (scu_base); -return 1 ; -} -static DEFINE_SPINLOCK (boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu)
@@ -118,7 +108,7 @@ void __init smp_init_cpus(void) scu_base =ioremap (OMAP44XX_SCU_BASE ,SZ_256 );BUG_ON (!scu_base); - ncores =get_core_count (); + ncores =scu_get_core_count (scu_base);/* sanity check */ if (ncores >NR_CPUS ) {
arch/arm/mach-realview/platsmp.c +4 -9
@@ -50,14 +50,6 @@ static void __iomem *scu_base_addr(void)return (void __iomem *)0 ; } -static inline unsigned int get_core_count (void ) -{ -void __iomem *scu_base =scu_base_addr (); -if (scu_base) -return scu_get_core_count (scu_base); -return 1 ; -} -static DEFINE_SPINLOCK (boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu)
@@ -158,7 +150,10 @@ static void __init poke_milo(void)*/ void __init smp_init_cpus (void ) { -unsigned int i, ncores =get_core_count (); +void __iomem *scu_base =scu_base_addr (); +unsigned int i, ncores; + + ncores = scu_base ?scu_get_core_count (scu_base) :1 ;/* sanity check */ if (ncores >NR_CPUS ) {
arch/arm/mach-ux500/platsmp.c +3 -6
@@ -28,11 +28,6 @@*/ volatile int __cpuinitdata pen_release =-1 ; -static unsigned int __init get_core_count (void ) -{ -return scu_get_core_count (__io_address (UX500_SCU_BASE )); -} -static DEFINE_SPINLOCK (boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu)
@@ -126,7 +121,9 @@ static void __init wakeup_secondary(void)*/ void __init smp_init_cpus (void ) { -unsigned int i, ncores =get_core_count (); +unsigned int i, ncores; + + ncores =scu_get_core_count (__io_address (UX500_SCU_BASE ));/* sanity check */ if (ncores >NR_CPUS ) {
Signature · 1 line
1.6.2.5
PATCH 16/22 ARM: SMP: get rid of references to poke_milo and Milo
In reply to Russell King - ARM LinuxMilo is an old boot loader, which is no longer relevant for these platforms. References to it are misleading. Move the code out of poke_milo(), and remove references to milo in comments.
--- arch/arm/mach-realview/platsmp.c | 44 ++++++++++--------------------------- arch/arm/mach-tegra/platsmp.c | 7 ------ 2 files changed, 12 insertions(+), 39 deletions(-)
arch/arm/mach-realview/platsmp.c +12 -32
@@ -99,14 +99,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)flush_cache_all ();/* -* XXX -* -* This is a later addition to the booting protocol: the -* bootMonitor now puts secondary cores into WFI, so -* poke_milo() no longer gets the cores moving; we need -* to send a soft interrupt to wake the secondary core. -* Use smp_cross_call() for this, since there's little -* point duplicating the code here +* Send the secondary CPU a soft interrupt, thereby causing +* the boot monitor to read the system wide flags register, +* and branch to the address found there. */ smp_cross_call (cpumask_of (cpu),1 );
@@ -128,22 +123,6 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)return pen_release !=-1 ? -ENOSYS :0 ; } -static void __init poke_milo (void ) -{ -/* nobody is to be released from the pen yet */ - pen_release =-1 ; - -/* -* Write the address of secondary startup into the system-wide flags -* register. The BootMonitor waits for this register to become -* non-zero. -*/ -__raw_writel (BSYM (virt_to_phys (realview_secondary_startup)), -__io_address (REALVIEW_SYS_FLAGSSET )); - -mb (); -} -/* * Initialise the CPU possible map early - this describes the CPUs * which may be present or become present in the system.
@@ -189,13 +168,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true); -/* -* Initialise the SCU if there are more than one CPU and let -* them know where to start. Note that, on modern versions of -* MILO, the "poke" doesn't actually do anything until each -* individual core is sent a soft interrupt to get it out of -* WFI -*/ if (max_cpus >1 ) {/* * Enable the local timer or broadcast device for the
@@ -204,6 +176,14 @@ void __init smp_prepare_cpus(unsigned int max_cpus)percpu_timer_setup ();scu_enable (scu_base_addr ()); -poke_milo (); + +/* +* Write the address of secondary startup into the +* system-wide flags register. The BootMonitor waits +* until it receives a soft interrupt, and then the +* secondary CPU branches to this address. +*/ +__raw_writel (BSYM (virt_to_phys (realview_secondary_startup)), +__io_address (REALVIEW_SYS_FLAGSSET )); } }
arch/arm/mach-tegra/platsmp.c +0 -7
@@ -148,13 +148,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true); -/* -* Initialise the SCU if there are more than one CPU and let -* them know where to start. Note that, on modern versions of -* MILO, the "poke" doesn't actually do anything until each -* individual core is sent a soft interrupt to get it out of -* WFI -*/ if (max_cpus >1 ) {percpu_timer_setup ();scu_enable (scu_base);
Signature · 1 line
1.6.2.5
PATCH 17/22 ARM: SMP: consolidate the common parts of smp_prepare_cpus()
In reply to Russell King - ARM LinuxThere is a certain amount of smp_prepare_cpus() which doesn't belong in the platform support code - that is, code which is invariant to the SMP implementation. Move this code into arch/arm/kernel/smp.c, and add a platform_ prefix to the original function.
--- arch/arm/include/asm/smp.h | 9 ++++--- arch/arm/kernel/smp.c | 49 +++++++++++++++++++++++++++++-------- arch/arm/mach-omap2/omap-smp.c | 33 +++++-------------------- arch/arm/mach-realview/platsmp.c | 41 ++++++++----------------------- arch/arm/mach-s5pv310/platsmp.c | 35 +++++--------------------- arch/arm/mach-tegra/platsmp.c | 18 +------------ arch/arm/mach-ux500/platsmp.c | 24 ++---------------- arch/arm/mach-vexpress/platsmp.c | 43 +++++++------------------------- 8 files changed, 83 insertions(+), 169 deletions(-)
arch/arm/include/asm/smp.h +5 -4
@@ -45,10 +45,6 @@ asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);*/ extern void smp_init_cpus (void ); -/* -* Move global data into per-processor storage. -*/ -extern void smp_store_cpu_info (unsigned int cpuid);/* * Raise an IPI cross call on CPUs in callmap.
@@ -73,6 +69,11 @@ asmlinkage void secondary_start_kernel(void);extern void platform_secondary_init (unsigned int cpu);/* +* Initialize cpu_possible map, and enable coherency +*/ +extern void platform_smp_prepare_cpus (unsigned int ); + +/* * Initial data for bringing up a secondary CPU. */ struct secondary_data {
arch/arm/kernel/smp.c +38 -11
67 lines not on this page · raw message
arch/arm/mach-omap2/omap-smp.c +7 -26
@@ -21,7 +21,6 @@#include <linux/io.h> #include <asm/cacheflush.h> -#include <asm/localtimer.h> #include <asm/smp_scu.h> #include <mach/hardware.h> #include <mach/omap4-common.h>
@@ -123,20 +122,10 @@ void __init smp_init_cpus(void)set_cpu_possible (i, true); } -void __init smp_prepare_cpus (unsigned int max_cpus) +void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -unsigned int ncores =num_possible_cpus (); -unsigned int cpu =smp_processor_id ();int i; -smp_store_cpu_info (cpu); - -/* -* are we trying to boot more cores than exist? -*/ -if (max_cpus > ncores) - max_cpus = ncores; -/* * Initialise the present map, which describes the set of CPUs * actually populated at the present time.
@@ -144,18 +133,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true); -if (max_cpus >1 ) { -/* -* Enable the local timer or broadcast device for the -* boot CPU, but only if we have more than one CPU. -*/ -percpu_timer_setup (); - -/* -* Initialise the SCU and wake up the secondary core using -* wakeup_secondary(). -*/ -scu_enable (scu_base); -wakeup_secondary (); - } +/* +* Initialise the SCU and wake up the secondary core using +* wakeup_secondary(). +*/ +scu_enable (scu_base); +wakeup_secondary (); }
arch/arm/mach-realview/platsmp.c +11 -30
60 lines not on this page · raw message
arch/arm/mach-s5pv310/platsmp.c +7 -28
@@ -22,7 +22,6 @@#include <linux/io.h> #include <asm/cacheflush.h> -#include <asm/localtimer.h> #include <asm/smp_scu.h> #include <asm/unified.h>
@@ -142,18 +141,10 @@ void __init smp_init_cpus(void)set_cpu_possible (i, true); } -void __init smp_prepare_cpus (unsigned int max_cpus) +void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -unsigned int ncores =num_possible_cpus (); -unsigned int cpu =smp_processor_id ();int i; -smp_store_cpu_info (cpu); - -/* are we trying to boot more cores than exist? */ -if (max_cpus > ncores) - max_cpus = ncores; -/* * Initialise the present map, which describes the set of CPUs * actually populated at the present time.
@@ -161,25 +152,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true); +scu_enable (scu_base_addr ()); +/* -* Initialise the SCU if there are more than one CPU and let -* them know where to start. +* Write the address of secondary startup into the +* system-wide flags register. The boot monitor waits +* until it receives a soft interrupt, and then the +* secondary CPU branches to this address. */ -if (max_cpus >1 ) { -/* -* Enable the local timer or broadcast device for the -* boot CPU, but only if we have more than one CPU. -*/ -percpu_timer_setup (); - -scu_enable (scu_base_addr ()); - -/* -* Write the address of secondary startup into the -* system-wide flags register. The boot monitor waits -* until it receives a soft interrupt, and then the -* secondary CPU branches to this address. -*/ __raw_writel (BSYM (virt_to_phys (s5pv310_secondary_startup)),S5P_VA_SYSRAM ); - } }
arch/arm/mach-tegra/platsmp.c +2 -16
@@ -22,7 +22,6 @@#include <asm/cacheflush.h> #include <mach/hardware.h> #include <asm/mach-types.h> -#include <asm/localtimer.h> #include <asm/smp_scu.h> #include <mach/iomap.h>
@@ -127,20 +126,10 @@ void __init smp_init_cpus(void)cpu_set (i, cpu_possible_map); } -void __init smp_prepare_cpus (unsigned int max_cpus) +void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -unsigned int ncores =scu_get_core_count (scu_base); -unsigned int cpu =smp_processor_id ();int i; -smp_store_cpu_info (cpu); - -/* -* are we trying to boot more cores than exist? -*/ -if (max_cpus > ncores) - max_cpus = ncores; -/* * Initialise the present map, which describes the set of CPUs * actually populated at the present time.
@@ -148,8 +137,5 @@ void __init smp_prepare_cpus(unsigned int max_cpus)for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true); -if (max_cpus >1 ) { -percpu_timer_setup (); -scu_enable (scu_base); - } +scu_enable (scu_base); }
arch/arm/mach-ux500/platsmp.c +3 -21
@@ -18,7 +18,6 @@#include <linux/io.h> #include <asm/cacheflush.h> -#include <asm/localtimer.h> #include <asm/smp_scu.h> #include <mach/hardware.h>
@@ -138,20 +137,10 @@ void __init smp_init_cpus(void)set_cpu_possible (i, true); } -void __init smp_prepare_cpus (unsigned int max_cpus) +void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -unsigned int ncores =num_possible_cpus (); -unsigned int cpu =smp_processor_id ();int i; -smp_store_cpu_info (cpu); - -/* -* are we trying to boot more cores than exist? -*/ -if (max_cpus > ncores) - max_cpus = ncores; -/* * Initialise the present map, which describes the set of CPUs * actually populated at the present time.
@@ -159,13 +148,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true); -if (max_cpus >1 ) { -/* -* Enable the local timer or broadcast device for the -* boot CPU, but only if we have more than one CPU. -*/ -percpu_timer_setup (); -scu_enable (__io_address (UX500_SCU_BASE )); -wakeup_secondary (); - } +scu_enable (__io_address (UX500_SCU_BASE )); +wakeup_secondary (); }
arch/arm/mach-vexpress/platsmp.c +10 -33
64 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 18/22 ARM: SMP: consolidate trace_hardirqs_off() into common SMP code
In reply to Russell King - ARM LinuxAll platforms call trace_hardirqs_off() in their secondary startup code, so move this into the core SMP code - it doesn't need to be in the per-platform code.
--- arch/arm/kernel/smp.c | 1 + arch/arm/mach-omap2/omap-smp.c | 2 -- arch/arm/mach-realview/platsmp.c | 2 -- arch/arm/mach-s5pv310/platsmp.c | 2 -- arch/arm/mach-tegra/platsmp.c | 2 -- arch/arm/mach-ux500/platsmp.c | 2 -- arch/arm/mach-vexpress/platsmp.c | 2 -- 7 files changed, 1 insertions(+), 12 deletions(-)
arch/arm/kernel/smp.c +1 -0
@@ -317,6 +317,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)cpu_init ();preempt_disable (); +trace_hardirqs_off ();/* * Give the platform a chance to do its own initialisation.
arch/arm/mach-omap2/omap-smp.c +0 -2
@@ -32,8 +32,6 @@ static DEFINE_SPINLOCK(boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu) { -trace_hardirqs_off (); -/* * If any interrupts are already enabled for the primary * core (e.g. timer irq), then they will not have been enabled
arch/arm/mach-realview/platsmp.c +0 -2
@@ -53,8 +53,6 @@ static DEFINE_SPINLOCK(boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu) { -trace_hardirqs_off (); -/* * if any interrupts are already enabled for the primary * core (e.g. timer irq), then they will not have been enabled
arch/arm/mach-s5pv310/platsmp.c +0 -2
@@ -46,8 +46,6 @@ static DEFINE_SPINLOCK(boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu) { -trace_hardirqs_off (); -/* * if any interrupts are already enabled for the primary * core (e.g. timer irq), then they will not have been enabled
arch/arm/mach-tegra/platsmp.c +0 -2
@@ -40,8 +40,6 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);void __cpuinit platform_secondary_init (unsigned int cpu) { -trace_hardirqs_off (); -/* * if any interrupts are already enabled for the primary * core (e.g. timer irq), then they will not have been enabled
arch/arm/mach-ux500/platsmp.c +0 -2
@@ -31,8 +31,6 @@ static DEFINE_SPINLOCK(boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu) { -trace_hardirqs_off (); -/* * if any interrupts are already enabled for the primary * core (e.g. timer irq), then they will not have been enabled
arch/arm/mach-vexpress/platsmp.c +0 -2
@@ -43,8 +43,6 @@ static DEFINE_SPINLOCK(boot_lock);void __cpuinit platform_secondary_init (unsigned int cpu) { -trace_hardirqs_off (); -/* * if any interrupts are already enabled for the primary * core (e.g. timer irq), then they will not have been enabled
Signature · 1 line
1.6.2.5
PATCH 19/22 ARM: CPU hotplug: move cpu_killed completion to core code
In reply to Russell King - ARM LinuxWe always need to wait for the dying CPU to reach a safe state before taking it down, irrespective of the requirements of the platform. Move the completion code into the ARM SMP hotplug code rather than having each platform re-implement this.
--- arch/arm/kernel/smp.c | 14 +++++++++++++- arch/arm/mach-omap2/omap-hotplug.c | 8 ++------ arch/arm/mach-realview/hotplug.c | 8 +------- arch/arm/mach-s5pv310/hotplug.c | 8 +------- arch/arm/mach-tegra/hotplug.c | 8 +------- arch/arm/mach-ux500/hotplug.c | 8 +------- 6 files changed, 19 insertions(+), 35 deletions(-)
arch/arm/kernel/smp.c +13 -1
@@ -24,6 +24,7 @@#include <linux/irq.h> #include <linux/percpu.h> #include <linux/clockchips.h> +#include <linux/completion.h> #include <asm/atomic.h> #include <asm/cacheflush.h>
@@ -238,12 +239,20 @@ int __cpu_disable(void)return 0 ; } +static DECLARE_COMPLETION (cpu_died); +/* * called on the thread which is asking for a CPU to be shutdown - * waits until shutdown has completed, or it is timed out. */ void __cpu_die (unsigned int cpu) { +if (wait_for_completion_timeout (&cpu_died,5000 )) { +printk (KERN_ERR "CPU%u: cpu didn't die\n" , cpu); +return ; + } +printk (KERN_NOTICE "CPU%u: shutdown\n" , cpu); +if (!platform_cpu_kill (cpu))printk ("CPU%u: unable to kill\n" , cpu); }
@@ -263,9 +272,12 @@ void __ref cpu_die(void)local_irq_disable ();idle_task_exit (); +/* Tell __cpu_die() that this CPU is now safe to dispose of */ +complete (&cpu_died); +/* * actual CPU shutdown procedure is at least platform (if not -* CPU) specific +* CPU) specific. */ platform_cpu_die (cpu);
arch/arm/mach-omap2/omap-hotplug.c +2 -6
@@ -17,16 +17,13 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/smp.h> -#include <linux/completion.h> #include <asm/cacheflush.h> #include <mach/omap4-common.h> -static DECLARE_COMPLETION (cpu_killed); -int platform_cpu_kill (unsigned int cpu) { -return wait_for_completion_timeout (&cpu_killed,5000 ); +return 1 ; }/*
@@ -42,8 +39,7 @@ void platform_cpu_die(unsigned int cpu) this_cpu, cpu);BUG (); } -pr_notice ("CPU%u: shutdown\n" , cpu); -complete (&cpu_killed); +flush_cache_all ();dsb ();
arch/arm/mach-realview/hotplug.c +1 -7
@@ -11,14 +11,11 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/smp.h> -#include <linux/completion.h> #include <asm/cacheflush.h> extern volatile int pen_release; -static DECLARE_COMPLETION (cpu_killed); -static inline void cpu_enter_lowpower (void ) {unsigned int v;
@@ -95,7 +92,7 @@ static inline void platform_do_lowpower(unsigned int cpu)int platform_cpu_kill (unsigned int cpu) { -return wait_for_completion_timeout (&cpu_killed,5000 ); +return 1 ; }/*
@@ -115,9 +112,6 @@ void platform_cpu_die(unsigned int cpu) }#endif -printk (KERN_NOTICE "CPU%u: shutdown\n" , cpu); -complete (&cpu_killed); -/* * we're ready for shutdown now, so do it */
arch/arm/mach-s5pv310/hotplug.c +1 -7
@@ -13,14 +13,11 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/smp.h> -#include <linux/completion.h> #include <asm/cacheflush.h> extern volatile int pen_release; -static DECLARE_COMPLETION (cpu_killed); -static inline void cpu_enter_lowpower (void ) {unsigned int v;
@@ -98,7 +95,7 @@ static inline void platform_do_lowpower(unsigned int cpu)int platform_cpu_kill (unsigned int cpu) { -return wait_for_completion_timeout (&cpu_killed,5000 ); +return 1 ; }/*
@@ -118,9 +115,6 @@ void platform_cpu_die(unsigned int cpu) }#endif -printk (KERN_NOTICE "CPU%u: shutdown\n" , cpu); -complete (&cpu_killed); -/* * we're ready for shutdown now, so do it */
arch/arm/mach-tegra/hotplug.c +1 -7
@@ -11,12 +11,9 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/smp.h> -#include <linux/completion.h> #include <asm/cacheflush.h> -static DECLARE_COMPLETION (cpu_killed); -static inline void cpu_enter_lowpower (void ) {unsigned int v;
@@ -94,7 +91,7 @@ static inline void platform_do_lowpower(unsigned int cpu)int platform_cpu_kill (unsigned int cpu) { -return wait_for_completion_timeout (&cpu_killed,5000 ); +return 1 ; }/*
@@ -114,9 +111,6 @@ void platform_cpu_die(unsigned int cpu) }#endif -printk (KERN_NOTICE "CPU%u: shutdown\n" , cpu); -complete (&cpu_killed); -/* * we're ready for shutdown now, so do it */
arch/arm/mach-ux500/hotplug.c +1 -7
@@ -11,14 +11,11 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/smp.h> -#include <linux/completion.h> #include <asm/cacheflush.h> extern volatile int pen_release; -static DECLARE_COMPLETION (cpu_killed); -static inline void platform_do_lowpower (unsigned int cpu) {flush_cache_all ();
@@ -38,7 +35,7 @@ static inline void platform_do_lowpower(unsigned int cpu)int platform_cpu_kill (unsigned int cpu) { -return wait_for_completion_timeout (&cpu_killed,5000 ); +return 1 ; }/*
@@ -58,9 +55,6 @@ void platform_cpu_die(unsigned int cpu) }#endif -printk (KERN_NOTICE "CPU%u: shutdown\n" , cpu); -complete (&cpu_killed); -/* directly enter low power state, skipping secure registers */ platform_do_lowpower (cpu); }
Signature · 1 line
1.6.2.5
PATCH 20/22 ARM: CPU hotplug: remove bug checks in platform_cpu_die()
In reply to Russell King - ARM Linuxplatform_cpu_die() is entered from the CPU's own idle thread, which can not be migrated to other CPUs. Moreover, the 'cpu' argument comes from the thread info, which will always be the 'current' CPU. So remove this useless bug check.
--- arch/arm/mach-omap2/omap-hotplug.c | 8 -------- arch/arm/mach-realview/hotplug.c | 10 ---------- arch/arm/mach-s5pv310/hotplug.c | 10 ---------- arch/arm/mach-tegra/hotplug.c | 10 ---------- arch/arm/mach-ux500/hotplug.c | 10 ---------- 5 files changed, 0 insertions(+), 48 deletions(-)
arch/arm/mach-omap2/omap-hotplug.c +0 -8
@@ -32,14 +32,6 @@ int platform_cpu_kill(unsigned int cpu)*/ void platform_cpu_die (unsigned int cpu) { -unsigned int this_cpu =hard_smp_processor_id (); - -if (cpu != this_cpu) { -pr_crit ("platform_cpu_die running on %u, should be %u\n" , - this_cpu, cpu); -BUG (); - } -flush_cache_all ();dsb ();
arch/arm/mach-realview/hotplug.c +0 -10
@@ -102,16 +102,6 @@ int platform_cpu_kill(unsigned int cpu)*/ void platform_cpu_die (unsigned int cpu) { -#ifdef DEBUG -unsigned int this_cpu =hard_smp_processor_id (); - -if (cpu != this_cpu) { -printk (KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n" , - this_cpu, cpu); -BUG (); - } -#endif -/* * we're ready for shutdown now, so do it */
arch/arm/mach-s5pv310/hotplug.c +0 -10
@@ -105,16 +105,6 @@ int platform_cpu_kill(unsigned int cpu)*/ void platform_cpu_die (unsigned int cpu) { -#ifdef DEBUG -unsigned int this_cpu =hard_smp_processor_id (); - -if (cpu != this_cpu) { -printk (KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n" , - this_cpu, cpu); -BUG (); - } -#endif -/* * we're ready for shutdown now, so do it */
arch/arm/mach-tegra/hotplug.c +0 -10
@@ -101,16 +101,6 @@ int platform_cpu_kill(unsigned int cpu)*/ void platform_cpu_die (unsigned int cpu) { -#ifdef DEBUG -unsigned int this_cpu =hard_smp_processor_id (); - -if (cpu != this_cpu) { -printk (KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n" , - this_cpu, cpu); -BUG (); - } -#endif -/* * we're ready for shutdown now, so do it */
arch/arm/mach-ux500/hotplug.c +0 -10
@@ -45,16 +45,6 @@ int platform_cpu_kill(unsigned int cpu)*/ void platform_cpu_die (unsigned int cpu) { -#ifdef DEBUG -unsigned int this_cpu =hard_smp_processor_id (); - -if (cpu != this_cpu) { -printk (KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n" , - this_cpu, cpu); -BUG (); - } -#endif -/* directly enter low power state, skipping secure registers */ platform_do_lowpower (cpu); }
Signature · 1 line
1.6.2.5
PATCH 21/22 ARM: CPU hotplug: ensure correct ordering of unplug
In reply to Russell King - ARM LinuxDon't call idle_task_exit() with interrupts disabled, and ensure that we have a memory barrier after interrupts are disabled but before signalling that this CPU has shut down.
--- arch/arm/kernel/smp.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/kernel/smp.c +3 -1
@@ -269,9 +269,11 @@ void __ref cpu_die(void) {unsigned int cpu =smp_processor_id (); -local_irq_disable ();idle_task_exit (); +local_irq_disable (); +mb (); +/* Tell __cpu_die() that this CPU is now safe to dispose of */ complete (&cpu_died);
Signature · 1 line
1.6.2.5
PATCH 21/22 ARM: CPU hotplug: ensure correct ordering of unplug
Quoted 23 lines · Russell King - ARM Linux
Don't call
idle_task_exit()with interrupts disabled, and ensure that we have a memory barrier after interrupts are disabled but before signalling that this CPU has shut down.Signed-off-by Russell King <[email protected]>---
?arch/arm/kernel/smp.c | ? ?4 +++-
?1 files changed, 3 insertions(+), 1 deletions(-)arch/arm/kernel/smp.c +3
-1@@ -269,9 +269,11 @@ void __ref cpu_die(void) ?{ ? ? ? ?unsigned int cpu = smp_processor_id(); - ? ? ? local_irq_disable(); ? ? ? ?idle_task_exit(); + ? ? ? local_irq_disable(); + ? ? ? mb(); +
Quoted 2 lines
? ? ? ?/* Tell
__cpu_die()that this CPU is now safe to dispose of */ ? ? ? ?complete(&cpu_died);
I don't fully understand the point of the mb() here. If you want to drain the write buffer that would be a dsb().
Signature · 1 line
Catalin
PATCH 21/22 ARM: CPU hotplug: ensure correct ordering of unplug
Quoted 22 lines · Catalin Marinas
Quoted 20 lines · Russell King - ARM Linux
Don't call
idle_task_exit()with interrupts disabled, and ensure that we have a memory barrier after interrupts are disabled but before signalling that this CPU has shut down.Signed-off-by Russell King <[email protected]>---
?arch/arm/kernel/smp.c | ? ?4 +++-
?1 files changed, 3 insertions(+), 1 deletions(-)arch/arm/kernel/smp.c +0
-1@@ -269,9 +269,11 @@ void __ref cpu_die(void) ?{ ? ? ? ?unsigned int cpu = smp_processor_id(); - ? ? ? local_irq_disable(); ? ? ? ?idle_task_exit();
Quoted 8 lines
Quoted 5 lines
arch/arm/kernel/smp.c +3
-0+ ? ? ? local_irq_disable(); + ? ? ? mb(); +? ? ? ?/* Tell
__cpu_die()that this CPU is now safe to dispose of */ ? ? ? ?complete(&cpu_died);I don't fully understand the point of the
mb()here. If you want to drain the write buffer that would be adsb().
It's there to ensure that writes prior to the IRQ disable do not cross the complete() call, that is all. local_irq_disable() does not have any built-in barrier semantics.
PATCH 21/22 ARM: CPU hotplug: ensure correct ordering of unplug
Quoted 32 lines · Russell King - ARM Linux
Quoted 22 lines · Catalin Marinas
Quoted 20 lines · Russell King - ARM Linux
Don't call
idle_task_exit()with interrupts disabled, and ensure that we have a memory barrier after interrupts are disabled but before signalling that this CPU has shut down.Signed-off-by Russell King <[email protected]>--- arch/arm/kernel/smp.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)arch/arm/kernel/smp.c +0
-1@@ -269,9 +269,11 @@ void __ref cpu_die(void) {unsigned int cpu =smp_processor_id (); -local_irq_disable ();idle_task_exit ();Quoted 8 lines
arch/arm/kernel/smp.c void __ref cpu_die(void) · line 278
Quoted 5 lines
arch/arm/kernel/smp.c +3
-0+local_irq_disable (); +mb (); +/* Tell __cpu_die() that this CPU is now safe to dispose of */ complete (&cpu_died);I don't fully understand the point of the
mb()here. If you want to drain the write buffer that would be adsb().
Quoted 3 lines
It's there to ensure that writes prior to the IRQ disable do not cross the
complete()call, that is all.local_irq_disable()does not have any built-in barrier semantics.
The DMB only ensures relative ordering between memory accesses and not function calls. What other memory access you try to prevent getting reordered? The complete() function takes a spinlock anyway so it has a memory barrier.
Signature · 1 line
Catalin
PATCH 22/22 ARM: SMP: remove smp_mpidr.h
In reply to Russell King - ARM LinuxWith "ARM: CPU hotplug: remove bug checks in platform_cpu_die()", we now do not use hard_smp_processor_id(), we no longer need to read the hardware processor ID. Remove the include providing this function.
--- arch/arm/include/asm/smp_mpidr.h | 17 ----------------- arch/arm/mach-realview/include/mach/smp.h | 1 - arch/arm/mach-s5pv310/include/mach/smp.h | 1 - arch/arm/mach-tegra/include/mach/smp.h | 1 - arch/arm/mach-ux500/include/mach/smp.h | 1 - arch/arm/mach-vexpress/include/mach/smp.h | 1 - arch/arm/plat-omap/include/plat/smp.h | 1 - 7 files changed, 0 insertions(+), 23 deletions(-) delete mode 100644 arch/arm/include/asm/smp_mpidr.h
arch/arm/include/asm/smp_mpidr.h deleted +0 -17
@@ -1,17 +0,0 @@ -#ifndef ASMARM_SMP_MIDR_H -#define ASMARM_SMP_MIDR_H - -#define hard_smp_processor_id () \ - ({ \ - unsigned int cpunum; \ - __asm__("\n" \ - "1: mrc p15, 0, %0, c0, c0, 5\n" \ - " .pushsection \".alt.smp.init\", \"a\"\n"\ - " .long 1b\n" \ - " mov %0, #0\n" \ - " .popsection" \ - : "=r" (cpunum)); \ - cpunum &= 0x0F; \ - }) - -#endif
arch/arm/mach-realview/include/mach/smp.h +0 -1
@@ -2,7 +2,6 @@#define ASMARM_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* * We use IRQ1 as the IPI
arch/arm/mach-s5pv310/include/mach/smp.h +0 -1
@@ -7,7 +7,6 @@#define ASM_ARCH_SMP_H __FILE__#include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> extern void __iomem *gic_cpu_base_addr;
arch/arm/mach-tegra/include/mach/smp.h +0 -1
@@ -2,7 +2,6 @@#define ASMARM_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* * We use IRQ1 as the IPI
arch/arm/mach-ux500/include/mach/smp.h +0 -1
@@ -10,7 +10,6 @@#define ASMARM_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* This is required to wakeup the secondary core */ extern void u8500_secondary_startup (void );
arch/arm/mach-vexpress/include/mach/smp.h +0 -1
@@ -2,7 +2,6 @@#define __MACH_SMP_H#include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* * We use IRQ1 as the IPI
arch/arm/plat-omap/include/plat/smp.h +0 -1
@@ -18,7 +18,6 @@#define OMAP_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* Needed for secondary core boot */ extern void omap_secondary_startup (void );
Signature · 1 line
1.6.2.5
PATCH 22/22 ARM: SMP: remove smp_mpidr.h
Russell,
Quoted 3 lines
-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King - ARM
Linux
Quoted 8 lines
Sent: Saturday, December 04, 2010 1:56 AM
To: linux-arm-kernel at lists.infradead.org; Catalin Marinas
Subject: [PATCH 22/22] ARM: SMP: removesmp_mpidr.hWith "ARM: CPU hotplug: remove bug checks in
platform_cpu_die()", we now do not usehard_smp_processor_id(), we no longer need to read the hardware processor ID. Remove the include providing this function.
hard_smp_processor_id() is also useful when wakeup from low power modes and wants to run specific restore code on specific CPUs. Ofcourse platform have it's own custome macro, but having ARM generic is better.
Quoted 19 lines
Signed-off-by Russell King <[email protected]>--- arch/arm/include/asm/smp_mpidr.h | 17 ----------------- arch/arm/mach-realview/include/mach/smp.h | 1 - arch/arm/mach-s5pv310/include/mach/smp.h | 1 - arch/arm/mach-tegra/include/mach/smp.h | 1 - arch/arm/mach-ux500/include/mach/smp.h | 1 - arch/arm/mach-vexpress/include/mach/smp.h | 1 - arch/arm/plat-omap/include/plat/smp.h | 1 - 7 files changed, 0 insertions(+), 23 deletions(-) delete mode 100644 arch/arm/include/asm/smp_mpidr.harch/arm/include/asm/smp_mpidr.h deleted +0
-0
arch/arm/include/asm/smp_mpidr.h line 4
Quoted 4 lines
arch/arm/include/asm/smp_mpidr.h deleted +0
-4@@ -1,17 +0,0 @@ -#ifndef ASMARM_SMP_MIDR_H -#define ASMARM_SMP_MIDR_H - -#define hard_smp_processor_id ()
\
Quoted 99 lines
arch/arm/include/asm/smp_mpidr.h deleted +0
-13- ({ \ -unsigned int cpunum; \ - __asm__("\n" \ -"1: mrc p15, 0, %0, c0, c0, 5\n" \ -" .pushsection \".alt.smp.init\", \"a\"\n" \ -" .long 1b\n" \ -" mov %0, #0\n" \ -" .popsection" \ - :"=r" (cpunum)); \ - cpunum &=0x0F ; \ - }) - -#endif arch/arm/mach- renamed from arch/arm/mach-realview/include/mach/smp.h +0
-0
realview/include/mach/smp.h
index d1aa704..c8221b3 100644arch/arm/mach-realview/include/mach/smp.h +0
-1@@ -2,7 +2,6 @@#define ASMARM_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* * We use IRQ1 as the IPI arch/arm/mach- renamed from arch/arm/mach-s5pv310/include/mach/smp.h +0
-0
s5pv310/include/mach/smp.h
index 2897747..77e5a84 100644arch/arm/mach-s5pv310/include/mach/smp.h +0
-1@@ -7,7 +7,6 @@#define ASM_ARCH_SMP_H __FILE__#include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> extern void __iomem *gic_cpu_base_addr;arch/arm/mach- renamed from arch/arm/mach-tegra/include/mach/smp.h +0
-0
tegra/include/mach/smp.h
index d1aa704..c8221b3 100644arch/arm/mach-tegra/include/mach/smp.h +0
-1@@ -2,7 +2,6 @@#define ASMARM_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* * We use IRQ1 as the IPI arch/arm/mach- renamed from arch/arm/mach-ux500/include/mach/smp.h +0
-0
ux500/include/mach/smp.h
index bd57c50..ca2b15b 100644arch/arm/mach-ux500/include/mach/smp.h +0
-1@@ -10,7 +10,6 @@#define ASMARM_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* This is required to wakeup the secondary core */ extern void u8500_secondary_startup (void );arch/arm/mach- renamed from arch/arm/mach-vexpress/include/mach/smp.h +0
-0
vexpress/include/mach/smp.h
index 721be0f..4c05e4a 100644arch/arm/mach-vexpress/include/mach/smp.h +0
-1@@ -2,7 +2,6 @@#define __MACH_SMP_H#include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* * We use IRQ1 as the IPI arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/smp.h +0
-0
omap/include/plat/smp.h
index e5541e5..7a10257 100644arch/arm/plat-omap/include/plat/smp.h +0
-2@@ -18,7 +18,6 @@#define OMAP_ARCH_SMP_H #include <asm/hardware/gic.h> -#include <asm/smp_mpidr.h> /* Needed for secondary core boot */ extern void omap_secondary_startup (void ); --1.6.2.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 22/22 ARM: SMP: remove smp_mpidr.h
Quoted 9 lines · Santosh Shilimkar
Russell,
Quoted 3 lines
-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King - ARMLinux
Quoted 4 lines
Sent: Saturday, December 04, 2010 1:56 AM
To: linux-arm-kernel at lists.infradead.org; Catalin Marinas
Subject: [PATCH 22/22] ARM: SMP: removesmp_mpidr.h
Quoted 8 lines
Quoted 4 lines
With "ARM: CPU hotplug: remove bug checks in
platform_cpu_die()", we now do not usehard_smp_processor_id(), we no longer need to read the hardware processor ID. Remove the include providing this function.
hard_smp_processor_id()is also useful when wakeup from low power modes and wants to run specific restore code on specific CPUs. Ofcourse platform have it's own custome macro, but having ARM generic is better.
Maybe, but there's no code in the kernel making use of it. Also note that there is a tendency to compare the kernel's CPU numbers (which are the logical numbers) with hard_smp_processor_id() (the physical number) which may not always be the same thing.
PATCH 22/22 ARM: SMP: remove smp_mpidr.h
Quoted 11 lines
-----Original Message-----
From: Russell King - ARM Linux [mailto:linux at arm.linux.org.uk]
Sent: Monday, December 06, 2010 4:02 PM
To: Santosh Shilimkar
Cc: linux-arm-kernel at lists.infradead.org; Catalin Marinas
Subject: Re: [PATCH 22/22] ARM: SMP: removesmp_mpidr.hQuoted 3 lines · Santosh Shilimkar
Russell,
Quoted 2 lines
-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org
[mailto:linux-arm-
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
kernel-bounces at lists.infradead.org] On Behalf Of Russell King - ARM
Linux
Quoted 6 lines
Sent: Saturday, December 04, 2010 1:56 AM
To: linux-arm-kernel at lists.infradead.org; Catalin Marinas
Subject: [PATCH 22/22] ARM: SMP: removesmp_mpidr.hWith "ARM: CPU hotplug: remove bug checks in
platform_cpu_die()", we now do not usehard_smp_processor_id(), we no longer need to read
the
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
hardware processor ID. Remove the include providing this function.
hard_smp_processor_id()is also useful when wakeup from low power modes and wants to run specific restore code on specific CPUs. Ofcourse platform have it's own custome macro, but having ARM generic is better.Maybe, but there's no code in the kernel making use of it. Also note that there is a tendency to compare the kernel's CPU numbers (which are the logical numbers) with
hard_smp_processor_id()(the physical number) which may not always be the same thing.
Agree. May be we can add it when the need arises.
cover More SMP cleanup
In reply to Russell King - ARM LinuxQuoted 3 lines · Russell King - ARM Linux
This patch series incorporates patches from the previously posted "Clean up SMP IPI support" series of 9 patches. Patch 5, and 11 onwards are new.
Sorry, patch 4 is the new one, not patch 5.
cover More SMP cleanup
In reply to Russell King - ARM LinuxQuoted 7 lines · Russell King - ARM Linux
This patch series incorporates patches from the previously posted "Clean up SMP IPI support" series of 9 patches. Patch 5, and 11 onwards are new.
This aims to reduce the amount of code in platform specific files to the barest minimum, while maintaining the flexibility of the API to allow platforms to decide which CPU numbers are populated.
Are you going to queue this for 2.6.38 or a later merge window?
Daniel
Signature · 3 lines
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
cover More SMP cleanup
Quoted 10 lines · Daniel Walker
Quoted 7 lines · Russell King - ARM Linux
This patch series incorporates patches from the previously posted "Clean up SMP IPI support" series of 9 patches. Patch 5, and 11 onwards are new.
This aims to reduce the amount of code in platform specific files to the barest minimum, while maintaining the flexibility of the API to allow platforms to decide which CPU numbers are populated.
Are you going to queue this for 2.6.38 or a later merge window?
The next merge window. Many of the patches have already been in linux-next for the odd occasion and not revealed any clashes.
Many of these patches are the result of larger patches I've posted on these lists over the last week or so, broken up into smaller chunks, massaged a bit more, and with other parts of the large patches dropped.