perf test: Test pmu-events aliases
authorJohn Garry <john.garry@huawei.com>
Tue, 17 Mar 2020 11:02:19 +0000 (19:02 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 24 Mar 2020 13:36:00 +0000 (10:36 -0300)
commit956a78356c24c1ac3becf854135dc065b6b74265
treeed34b21d84d2e2337a9d813c00c9b16d7d43ae96
parent5b9a50001b2c23f90f2a21db4763f3a9599588c4
perf test: Test pmu-events aliases

Add creating event aliases to the pmu-events test.

So currently we verify that the generated pmu-events.c is as expected for
some test events. Now test that we generate aliases as expected for those
events during normal operation.

For that, we cycle through each HW PMU in the system, and use the test
events to create aliases, and verify those against known, expected values.

For core PMUs, we should create an alias for every event in
test_cpu_events[].

However, for uncore PMUs, they need to be matched by the pmu_event.pmu
member, so use test_uncore_events[]; so check the match beforehand with
pmu_uncore_alias_match().

A sample run is as follows for my x86 machine:

  john@linux-3c19:~/linux> tools/perf/perf test -vv 10
  10: PMU events                                            :
  --- start ---

  ...

  testing PMU uncore_arb aliases: no events to match
  testing PMU cstate_pkg aliases: no events to match
  skipping testing PMU breakpoint
  testing aliases PMU uncore_cbox_1: matched event unc_cbo_xsnp_response.miss_eviction
  testing PMU uncore_cbox_1 aliases: pass
  testing PMU power aliases: no events to match
  testing aliases PMU cpu: matched event bp_l1_btb_correct
  testing aliases PMU cpu: matched event bp_l2_btb_correct
  testing aliases PMU cpu: matched event segment_reg_loads.any
  testing aliases PMU cpu: matched event dispatch_blocked.any
  testing aliases PMU cpu: matched event eist_trans
  testing PMU cpu aliases: pass
  testing PMU intel_pt aliases: no events to match
  skipping testing PMU software
  skipping testing PMU intel_bts
  testing PMU uncore_imc aliases: no events to match
  testing aliases PMU uncore_cbox_0: matched event unc_cbo_xsnp_response.miss_eviction
  testing PMU uncore_cbox_0 aliases: pass
  testing PMU cstate_core aliases: no events to match
  skipping testing PMU tracepoint
  testing PMU msr aliases: no events to match
  test child finished with 0

Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: James Clark <james.clark@arm.com>
Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: linuxarm@huawei.com
Link: http://lore.kernel.org/lkml/1584442939-8911-8-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/pmu-events.c