Port MT and SMTC changes from linux-mti
cover Port MT and SMTC changes from linux-mti
The following series of patches port MT and SMTC changes in linux-mti.git repository to the head of tree.
---
Chris Dearman (1):
Add debug prints during CPU intialization.
Jaidev Patwardhan (1):
Avoid queing multiple reschedule IPI's in SMTC
arch/mips/include/asm/gcmpregs.h | 18 ++-- arch/mips/include/asm/gic.h | 188 ++++--------------------------------- arch/mips/include/asm/smtc_ipi.h | 5 + arch/mips/kernel/irq-gic.c | 116 +++++++++-------------- arch/mips/kernel/smp-mt.c | 10 ++ arch/mips/kernel/smtc.c | 33 ++++++ arch/mips/mti-malta/malta-amon.c | 7 + arch/mips/mti-malta/malta-int.c | 117 ++++++++++++++--------- arch/mips/mti-malta/malta-pci.c | 14 ++- arch/mips/mti-malta/malta-setup.c | 100 ++++++++++++++++++++ 10 files changed, 301 insertions(+), 307 deletions(-)
PATCH 1/2 Add debug prints during CPU intialization.
From: Chris Dearman <[email protected]>
Signed-off-by Chris Dearman <[email protected]>
---
arch/mips/kernel/smp-mt.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
arch/mips/kernel/smp-mt.c +9 -1
@@ -152,7 +152,7 @@ static void vsmp_send_ipi_mask(cpumask_t mask, unsigned int action)static void __cpuinit vsmp_init_secondary (void ) {extern int gic_present; - +pr_debug ("SMPMT: CPU%d: vsmp_init_secondary\n" ,smp_processor_id ());/* This is Malta specific: IPI,performance and timer inetrrupts */ if (gic_present) change_c0_status(ST0_IM, STATUSF_IP3 | STATUSF_IP4 |
@@ -164,6 +164,8 @@ static void __cpuinit vsmp_init_secondary(void)static void __cpuinit vsmp_smp_finish (void ) { +pr_debug ("SMPMT: CPU%d: vsmp_smp_finish\n" ,smp_processor_id ()); +/* CDFIXME: remove this? */ write_c0_compare (read_c0_count () + (8 * mips_hpt_frequency/HZ ));
@@ -178,6 +180,7 @@ static void __cpuinit vsmp_smp_finish(void)static void vsmp_cpus_done (void ) { +pr_debug ("SMPMT: CPU%d: vsmp_cpus_done\n" ,smp_processor_id ()); }/*
@@ -191,6 +194,8 @@ static void vsmp_cpus_done(void)static void __cpuinit vsmp_boot_secondary (int cpu,struct task_struct *idle) {struct thread_info *gp =task_thread_info (idle); +pr_debug ("SMPMT: CPU%d: vsmp_boot_secondary cpu %d\n" , +smp_processor_id (), cpu);dvpe ();set_c0_mvpcontrol (MVPCONTROL_VPC );
@@ -232,6 +237,7 @@ static void __init vsmp_smp_setup(void)unsigned int mvpconf0, ntc, tc, ncpu =0 ;unsigned int nvpe; +pr_debug ("SMPMT: CPU%d: vsmp_smp_setup\n" ,smp_processor_id ());#ifdef CONFIG_MIPS_MT_FPAFF /* If we have an FPU, enroll ourselves in the FPU-full mask */ if (cpu_has_fpu)
@@ -272,6 +278,8 @@ static void __init vsmp_smp_setup(void)static void __init vsmp_prepare_cpus (unsigned int max_cpus) { +pr_debug ("SMPMT: CPU%d: vsmp_prepare_cpus %d\n" , +smp_processor_id (), max_cpus);mips_mt_set_cpuoptions (); }
PATCH 2/2 Avoid queing multiple reschedule IPI's in SMTC
In reply to Raghu GandhamFrom: Jaidev Patwardhan <[email protected]>
Signed-off-by Chris Dearman <[email protected]>
---
arch/mips/include/asm/smtc_ipi.h | 5 +++-- arch/mips/kernel/smtc.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-)
arch/mips/include/asm/smtc_ipi.h +3 -2
@@ -23,8 +23,8 @@ struct smtc_ipi {void *arg;int dest;#ifdef SMTC_IPI_DEBUG -int sender; -long stamp; +unsigned sender; +unsigned long long stamp;#endif /* SMTC_IPI_DEBUG */ };
@@ -45,6 +45,7 @@ struct smtc_ipi_q {spinlock_t lock;struct smtc_ipi *tail;int depth; +int resched_flag;/* reschedule already queued */ };static inline void smtc_ipi_nq (struct smtc_ipi_q *q,struct smtc_ipi *p)
arch/mips/kernel/smtc.c +29 -4
@@ -75,7 +75,6 @@ unsigned long irq_hwmask[NR_IRQS];asiduse smtc_live_asid[MAX_SMTC_TLBS ][MAX_SMTC_ASIDS ]; -/* * Number of InterProcessor Interrupt (IPI) message buffers to allocate */
@@ -388,6 +387,7 @@ void smtc_prepare_cpus(int cpus)IPIQ [i].head =IPIQ [i].tail =NULL ;spin_lock_init (&IPIQ [i].lock);IPIQ [i].depth =0 ; +IPIQ [i].resched_flag =0 ;/* No reschedules queued initially */ }/* cpu_data index starts at zero */
@@ -741,11 +741,24 @@ void smtc_forward_irq(unsigned int irq)static void smtc_ipi_qdump (void ) {int i; +struct smtc_ipi *temp;for (i =0 ; i <NR_CPUS ;i++) { -printk ("IPIQ[%d]: head = 0x%x, tail = 0x%x, depth = %d\n" , +pr_info ("IPIQ[%d]: head = 0x%x, tail = 0x%x, depth = %d\n" , i, (unsigned )IPIQ [i].head, (unsigned )IPIQ [i].tail,IPIQ [i].depth); + temp =IPIQ [i].head; + +while (temp !=IPIQ [i].tail) { +pr_debug ("%d %d %d: " , temp->type, temp->dest, + (int )temp->arg); +#ifdef SMTC_IPI_DEBUG +pr_debug ("%u %lu\n" , temp->sender, temp->stamp); +#else +pr_debug ("\n" ); +#endif + temp = temp->flink; + } } }
@@ -784,11 +797,15 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)int mtflags;unsigned long tcrestart;extern void r4k_wait_irqoff (void ),__pastwait (void ); +int set_resched_flag = (type ==LINUX_SMP_IPI && + action ==SMP_RESCHEDULE_YOURSELF );if (cpu ==smp_processor_id ()) {printk ("Cannot Send IPI to self!\n" );return ; } +if (set_resched_flag &&IPIQ [cpu].resched_flag !=0 ) +return ;/* There is a reschedule queued already */ /* Set up a descriptor, to be delivered either promptly or queued */ pipi =smtc_ipi_dq (&freeIPIq);if (pipi ==NULL ) {
@@ -801,6 +818,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action) pipi->dest = cpu;if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id ()].vpe_id) {/* If not on same VPE, enqueue and send cross-VPE interrupt */ +IPIQ [cpu].resched_flag |= set_resched_flag;smtc_ipi_nq (&IPIQ [cpu], pipi);LOCK_CORE_PRA ();settc (cpu_data[cpu].tc_id);
@@ -847,6 +865,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)*/ write_tc_c0_tchalt (0 );UNLOCK_CORE_PRA (); +IPIQ [cpu].resched_flag |= set_resched_flag;smtc_ipi_nq (&IPIQ [cpu], pipi); }else { postdirect:
@@ -996,12 +1015,15 @@ void deferred_smtc_ipi(void)* already enabled. */ local_irq_save (flags); -spin_lock (&q->lock); pipi =__smtc_ipi_dq (q);spin_unlock (&q->lock); -if (pipi !=NULL ) +if (pipi !=NULL ) { +if (pipi->type ==LINUX_SMP_IPI && + (int )pipi->arg ==SMP_RESCHEDULE_YOURSELF ) +IPIQ [cpu].resched_flag =0 ;ipi_decode (pipi); + }/* * The use of the __raw_local restore isn't * as obviously necessary here as in smtc_ipi_replay(),
@@ -1082,6 +1104,9 @@ static irqreturn_t ipi_interrupt(int irq, void *dev_idm)* with interrupts off */ local_irq_save (flags); +if (pipi->type ==LINUX_SMP_IPI && + (int )pipi->arg ==SMP_RESCHEDULE_YOURSELF ) +IPIQ [cpu].resched_flag =0 ;ipi_decode (pipi);local_irq_restore (flags); }