]> asedeno.scripts.mit.edu Git - linux.git/commit
MIPS: perf: Use correct VPE ID when setting up VPE tracing
authorMatt Redfearn <matt.redfearn@mips.com>
Fri, 20 Apr 2018 10:23:05 +0000 (11:23 +0100)
committerJames Hogan <jhogan@kernel.org>
Tue, 15 May 2018 14:30:16 +0000 (15:30 +0100)
commit840a8b55effdc9a98b115f84b8bbb6a2f5d05226
tree264025fd384db146ee27166286d578dfb45d15d4
parent800fb71281ca2ed5c8a7299e10ebc0de2f61cdda
MIPS: perf: Use correct VPE ID when setting up VPE tracing

There are a couple of FIXME's in the perf code which state that
cpu_data[event->cpu].vpe_id reports 0 for both CPUs. This is no longer
the case, since the vpe_id is used extensively by SMP CPS.

VPE local counting gets around this by using smp_processor_id() instead.
As it happens this does work correctly to count events on the right VPE,
but relies on 2 assumptions:
a) Always having 2 VPEs / core.
b) The hardware only paying attention to the least significant bit of
the PERFCTL.VPEID field.
If either of these assumptions change then the incorrect VPEs events
will be counted.

Fix this by replacing smp_processor_id() with
cpu_vpe_id(&current_cpu_data), in the vpe_id() macro, and pass vpe_id()
to M_PERFCTL_VPEID() when setting up PERFCTL.VPEID. The FIXME's can also
be removed since they no longer apply.

Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
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: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/19137/
Signed-off-by: James Hogan <jhogan@kernel.org>
arch/mips/kernel/perf_event_mipsxx.c