linux_dsm_epyc7002/tools/perf/pmu-events/arch/x86
Jin Yao 0dfbe4c646 perf vendor events: Fix DRAM_BW_Use 0 issue for CLX/SKX
Ian reports an issue that the metric DRAM_BW_Use often remains 0.

The metric expression for DRAM_BW_Use on CLX/SKX:

"( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time"

The counts of uncore_imc/cas_count_read/ and uncore_imc/cas_count_write/
are scaled up by 64, that is to turn a count of cache lines into bytes,
the count is then divided by 1000000000 to give GB.

However, the counts of uncore_imc/cas_count_read/ and
uncore_imc/cas_count_write/ have been scaled yet.

The scale values are from sysfs, such as
/sys/devices/uncore_imc_0/events/cas_count_read.scale.
It's 6.103515625e-5 (64 / 1024.0 / 1024.0).

So if we use original metric expression, the result is not correct.

But the difficulty is, for SKL client, the counts are not scaled.

The metric expression for DRAM_BW_Use on SKL:

"64 * ( arb@event\\=0x81\\,umask\\=0x1@ + arb@event\\=0x84\\,umask\\=0x1@ ) / 1000000 / duration_time / 1000"

root@kbl-ppc:~# perf stat -M DRAM_BW_Use -a -- sleep 1

 Performance counter stats for 'system wide':

               190      arb/event=0x84,umask=0x1/ #     1.86 DRAM_BW_Use
        29,093,178      arb/event=0x81,umask=0x1/
     1,000,703,287 ns   duration_time

       1.000703287 seconds time elapsed

The result is expected.

So the easy way is just change the metric expression for CLX/SKX.
This patch changes the metric expression to:

"( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time"

1048576 = 1024 * 1024.

Before (tested on CLX):

root@lkp-csl-2sp5 ~# perf stat -M DRAM_BW_Use -a -- sleep 1

 Performance counter stats for 'system wide':

            765.35 MiB  uncore_imc/cas_count_read/ #     0.00 DRAM_BW_Use
              5.42 MiB  uncore_imc/cas_count_write/
        1001515088 ns   duration_time

       1.001515088 seconds time elapsed

After:

root@lkp-csl-2sp5 ~# perf stat -M DRAM_BW_Use -a -- sleep 1

 Performance counter stats for 'system wide':

            767.95 MiB  uncore_imc/cas_count_read/ #     0.80 DRAM_BW_Use
              5.02 MiB  uncore_imc/cas_count_write/
        1001900010 ns   duration_time

       1.001900010 seconds time elapsed

Fixes: 038d3b53c2 ("perf vendor events intel: Update CascadelakeX events to v1.08")
Fixes: b5ff7f2799 ("perf vendor events: Update SkylakeX events to v1.21")
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20201023005334.7869-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-11-03 08:31:31 -03:00
..
amdzen1 Merge remote-tracking branch 'torvalds/master' into perf/core 2020-09-17 15:45:05 -03:00
amdzen2 Merge remote-tracking branch 'torvalds/master' into perf/core 2020-09-17 15:45:05 -03:00
bonnell perf vendor events intel: Update Bonnell to V4 2019-04-01 15:23:42 -03:00
broadwell perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
broadwellde perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
broadwellx perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
cascadelakex perf vendor events: Fix DRAM_BW_Use 0 issue for CLX/SKX 2020-11-03 08:31:31 -03:00
goldmont perf vendor events intel: Update Goldmont to v13 2019-04-01 15:23:44 -03:00
goldmontplus perf vendor events intel: Update GoldmontPlus to v1.01 2019-04-01 15:23:46 -03:00
haswell perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
haswellx perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
icelake perf vendor events intel: Add Icelake V1.00 event file 2019-08-12 16:26:02 -03:00
ivybridge perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
ivytown perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
jaketown perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
knightslanding perf vendor events intel: Update KnightsLanding events to v9 2019-04-01 15:23:40 -03:00
nehalemep perf vendor events: Add NehalemEP V2 event file 2016-10-17 13:39:47 -03:00
nehalemex perf vendor events: Add NehalemEX V2 event file 2016-10-17 13:39:47 -03:00
sandybridge perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
silvermont perf vendor events intel: Update Silvermont to v14 2019-04-01 15:23:48 -03:00
skylake perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric 2020-04-03 09:37:56 -03:00
skylakex perf vendor events: Fix DRAM_BW_Use 0 issue for CLX/SKX 2020-11-03 08:31:31 -03:00
tremontx perf vendor events intel: Add Tremontx event file v1.02 2019-08-15 12:04:04 -03:00
westmereep-dp perf vendor events: Add WestmereEP-DP V2 event file 2016-10-17 13:39:47 -03:00
westmereep-sp perf vendor events: Add WestmereEP-SP V2 event file 2016-10-17 13:39:47 -03:00
westmereex perf vendor events: Add WestmereEX V2 event file 2016-10-17 13:39:47 -03:00
mapfile.csv perf vendor events amd: Enable Family 19h users by matching Zen2 events 2020-09-04 16:32:44 -03:00