]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
MIPS: perf: More robustly probe for the presence of per-tc counters
authorMatt Redfearn <matt.redfearn@mips.com>
Fri, 20 Apr 2018 10:23:04 +0000 (11:23 +0100)
committerJames Hogan <jhogan@kernel.org>
Tue, 15 May 2018 14:16:16 +0000 (15:16 +0100)
The presence of per TC performance counters is now detected by
cpu-probe.c and indicated by MIPS_CPU_MT_PER_TC_PERF_COUNTERS in
cpu_data. Switch detection of the feature to use this new flag rather
than blindly testing the implementation specific config7 register with a
magic number.

Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Maciej W. Rozycki <macro@mips.com>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Robert Richter <rric@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: oprofile-list@lists.sf.net
Patchwork: https://patchwork.linux-mips.org/patch/19142/
Signed-off-by: James Hogan <jhogan@kernel.org>
arch/mips/include/asm/cpu-features.h
arch/mips/kernel/perf_event_mipsxx.c
arch/mips/oprofile/op_model_mipsxx.c

index 5f74590e0bea45f526b778efd46d002c113417f1..9cdb4e4ce258390d75325ea0dba6562f13332924 100644 (file)
 # define cpu_has_shared_ftlb_entries 0
 #endif
 
+#ifdef CONFIG_MIPS_MT_SMP
+# define cpu_has_mipsmt_pertccounters \
+       (cpu_data[0].options & MIPS_CPU_MT_PER_TC_PERF_COUNTERS)
+#else
+# define cpu_has_mipsmt_pertccounters 0
+#endif /* CONFIG_MIPS_MT_SMP */
+
 /*
  * Guest capabilities
  */
index ee73550f0b9a422c05d527287bb95aa4dd738180..458015da714966662184f7df8dd51256f917132f 100644 (file)
@@ -129,8 +129,6 @@ static struct mips_pmu mipspmu;
 
 
 #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
-static int cpu_has_mipsmt_pertccounters;
-
 static DEFINE_RWLOCK(pmuint_rwlock);
 
 #if defined(CONFIG_CPU_BMIPS5000)
@@ -1723,7 +1721,6 @@ init_hw_perf_events(void)
        }
 
 #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
-       cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19);
        if (!cpu_has_mipsmt_pertccounters)
                counters = counters_total_to_per_cpu(counters);
 #endif
index c3e4c18ef8d4d1ca5e4dc74ffd990b800ca0fd1b..7c04b17f4a488aa8e50186be84dd0fcc50125ba2 100644 (file)
@@ -36,7 +36,6 @@ static int perfcount_irq;
 #endif
 
 #ifdef CONFIG_MIPS_MT_SMP
-static int cpu_has_mipsmt_pertccounters;
 #define WHAT           (MIPS_PERFCTRL_MT_EN_VPE | \
                         M_PERFCTL_VPEID(cpu_vpe_id(&current_cpu_data)))
 #define vpe_id()       (cpu_has_mipsmt_pertccounters ? \
@@ -326,7 +325,6 @@ static int __init mipsxx_init(void)
        }
 
 #ifdef CONFIG_MIPS_MT_SMP
-       cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19);
        if (!cpu_has_mipsmt_pertccounters)
                counters = counters_total_to_per_cpu(counters);
 #endif