Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460607

[PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and HW_CACHE_MISSES measure L2

From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and HW_CACHE_MISSES measure L2
Date 2016-08-11 17:30 +0200
Message-ID <s505H-5ym-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


While the Intel PMU monitors the LLC when perf enables the
HW_CACHE_REFERENCES and HW_CACHE_MISSES events, these events monitor
L1 instruction cache fetches (0x0080) and instruction cache misses
(0x0081) on the AMD PMU.

This is extremely confusing when monitoring the same workload across
Intel and AMD machines, since parameters like,

  $ perf stat -e cache-references,cache-misses

measure completely different things.

Instead, make the AMD PMU measure instruction/data cache fill requests
to the L2 and instruction/data cache misses in the L2 when
HW_CACHE_REFERENCES and HW_CACHE_MISSES are enabled, respectively.
That way the events measure unified caches on both platforms.

Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: <stable@vger.kernel.org>
---
 arch/x86/events/amd/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index e07a22bb9308..8fd8bf79f32b 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -119,8 +119,8 @@ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] =
 {
   [PERF_COUNT_HW_CPU_CYCLES]			= 0x0076,
   [PERF_COUNT_HW_INSTRUCTIONS]			= 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]		= 0x0080,
-  [PERF_COUNT_HW_CACHE_MISSES]			= 0x0081,
+  [PERF_COUNT_HW_CACHE_REFERENCES]		= 0x037d,
+  [PERF_COUNT_HW_CACHE_MISSES]			= 0x037e,
   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]		= 0x00c2,
   [PERF_COUNT_HW_BRANCH_MISSES]			= 0x00c3,
   [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND]	= 0x00d0, /* "Decoder empty" event */
-- 
2.7.3

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and HW_CACHE_MISSES measure L2 Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-11 17:30 +0200
  Re: [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and  HW_CACHE_MISSES measure L2 Borislav Petkov <bp@alien8.de> - 2016-08-11 18:50 +0200
    Re: [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and  HW_CACHE_MISSES measure L2 Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-15 17:20 +0200
      Re: [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and  HW_CACHE_MISSES measure L2 Borislav Petkov <bp@alien8.de> - 2016-08-19 04:00 +0200
        Re: [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and  HW_CACHE_MISSES measure L2 Peter Zijlstra <peterz@infradead.org> - 2016-08-19 15:40 +0200
          Re: [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and  HW_CACHE_MISSES measure L2 Borislav Petkov <bp@alien8.de> - 2016-08-19 16:50 +0200
            Re: [PATCH] perf/x86/amd: Make HW_CACHE_REFERENCES and  HW_CACHE_MISSES measure L2 Peter Zijlstra <peterz@infradead.org> - 2016-08-19 17:20 +0200

csiph-web