aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Cooper <alcooperx@gmail.com>2012-07-13 16:44:53 -0400
committerRalf Baechle <ralf@linux-mips.org>2012-10-11 05:04:34 -0400
commit399aaa2568ad90e229d73da8e95ae460d322a4f3 (patch)
treeaf20b0314130f873bb733f8b7b195b078118a3bf
parentecb8ee8a8987368491bd0dab34353c724654ec55 (diff)
MIPS: perf: Split the Kconfig option CONFIG_MIPS_MT_SMP
Split the Kconfig option CONFIG_MIPS_MT_SMP into CONFIG_MIPS_MT_SMP and CONFIG_MIPS_PERF_SHARED_TC_COUNTERS so some of the code used for performance counters that are shared between threads can be used for MIPS cores that are not MT_SMP. Signed-off-by: Al Cooper <alcooperx@gmail.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/4108/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c16
2 files changed, 12 insertions, 8 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 35453eaeffb5..2c580cf59397 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1928,6 +1928,7 @@ config MIPS_MT_SMP
1928 select SYS_SUPPORTS_SCHED_SMT if SMP 1928 select SYS_SUPPORTS_SCHED_SMT if SMP
1929 select SYS_SUPPORTS_SMP 1929 select SYS_SUPPORTS_SMP
1930 select SMP_UP 1930 select SMP_UP
1931 select MIPS_PERF_SHARED_TC_COUNTERS
1931 help 1932 help
1932 This is a kernel model which is known a VSMP but lately has been 1933 This is a kernel model which is known a VSMP but lately has been
1933 marketesed into SMVP. 1934 marketesed into SMVP.
@@ -2277,6 +2278,9 @@ config NR_CPUS
2277 performance should round up your number of processors to the next 2278 performance should round up your number of processors to the next
2278 power of two. 2279 power of two.
2279 2280
2281config MIPS_PERF_SHARED_TC_COUNTERS
2282 bool
2283
2280# 2284#
2281# Timer Interrupt Frequency Configuration 2285# Timer Interrupt Frequency Configuration
2282# 2286#
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 19253d7ca730..cb213089ed2b 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -130,7 +130,7 @@ static struct mips_pmu mipspmu;
130#define M_PERFCTL_EVENT_MASK 0xfe0 130#define M_PERFCTL_EVENT_MASK 0xfe0
131 131
132 132
133#ifdef CONFIG_MIPS_MT_SMP 133#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
134static int cpu_has_mipsmt_pertccounters; 134static int cpu_has_mipsmt_pertccounters;
135 135
136static DEFINE_RWLOCK(pmuint_rwlock); 136static DEFINE_RWLOCK(pmuint_rwlock);
@@ -156,10 +156,10 @@ static unsigned int counters_total_to_per_cpu(unsigned int counters)
156 return counters >> vpe_shift(); 156 return counters >> vpe_shift();
157} 157}
158 158
159#else /* !CONFIG_MIPS_MT_SMP */ 159#else /* !CONFIG_MIPS_PERF_SHARED_TC_COUNTERS */
160#define vpe_id() 0 160#define vpe_id() 0
161 161
162#endif /* CONFIG_MIPS_MT_SMP */ 162#endif /* CONFIG_MIPS_PERF_SHARED_TC_COUNTERS */
163 163
164static void resume_local_counters(void); 164static void resume_local_counters(void);
165static void pause_local_counters(void); 165static void pause_local_counters(void);
@@ -503,7 +503,7 @@ static void mipspmu_read(struct perf_event *event)
503 503
504static void mipspmu_enable(struct pmu *pmu) 504static void mipspmu_enable(struct pmu *pmu)
505{ 505{
506#ifdef CONFIG_MIPS_MT_SMP 506#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
507 write_unlock(&pmuint_rwlock); 507 write_unlock(&pmuint_rwlock);
508#endif 508#endif
509 resume_local_counters(); 509 resume_local_counters();
@@ -523,7 +523,7 @@ static void mipspmu_enable(struct pmu *pmu)
523static void mipspmu_disable(struct pmu *pmu) 523static void mipspmu_disable(struct pmu *pmu)
524{ 524{
525 pause_local_counters(); 525 pause_local_counters();
526#ifdef CONFIG_MIPS_MT_SMP 526#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
527 write_lock(&pmuint_rwlock); 527 write_lock(&pmuint_rwlock);
528#endif 528#endif
529} 529}
@@ -1163,7 +1163,7 @@ static int mipsxx_pmu_handle_shared_irq(void)
1163 * See also mipsxx_pmu_start(). 1163 * See also mipsxx_pmu_start().
1164 */ 1164 */
1165 pause_local_counters(); 1165 pause_local_counters();
1166#ifdef CONFIG_MIPS_MT_SMP 1166#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
1167 read_lock(&pmuint_rwlock); 1167 read_lock(&pmuint_rwlock);
1168#endif 1168#endif
1169 1169
@@ -1195,7 +1195,7 @@ static int mipsxx_pmu_handle_shared_irq(void)
1195 if (handled == IRQ_HANDLED) 1195 if (handled == IRQ_HANDLED)
1196 irq_work_run(); 1196 irq_work_run();
1197 1197
1198#ifdef CONFIG_MIPS_MT_SMP 1198#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
1199 read_unlock(&pmuint_rwlock); 1199 read_unlock(&pmuint_rwlock);
1200#endif 1200#endif
1201 resume_local_counters(); 1201 resume_local_counters();
@@ -1362,7 +1362,7 @@ init_hw_perf_events(void)
1362 return -ENODEV; 1362 return -ENODEV;
1363 } 1363 }
1364 1364
1365#ifdef CONFIG_MIPS_MT_SMP 1365#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
1366 cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19); 1366 cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19);
1367 if (!cpu_has_mipsmt_pertccounters) 1367 if (!cpu_has_mipsmt_pertccounters)
1368 counters = counters_total_to_per_cpu(counters); 1368 counters = counters_total_to_per_cpu(counters);