perf c2c: Fix remote HITM detection for Skylake
authorJiri Olsa <[email protected]>
Thu, 24 Aug 2017 08:57:32 +0000 (10:57 +0200)
committerArnaldo Carvalho de Melo <[email protected]>
Mon, 28 Aug 2017 14:05:10 +0000 (11:05 -0300)
Skylake introduced new mem_remote bit in union perf_mem_data_src [1].
It applies to any other memory level to express Remote unknown level, as
is reported by Skylake.

Adding this extra check to c2c_decode_stats to properly decode remote
HITMs on Skylake.

[1] http://lkml.kernel.org/r/20170816222156[email protected]

Signed-off-by: Jiri Olsa <[email protected]>
Acked-by: Andi Kleen <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Joe Mario <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/mem-events.c

index ced4f3fff0357cc997820aa4796e3d4da8be5c72..28afe5fa84d613641954515ef89ed29441ec0cd4 100644 (file)
@@ -316,6 +316,11 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
        u64 lvl    = data_src->mem_lvl;
        u64 snoop  = data_src->mem_snoop;
        u64 lock   = data_src->mem_lock;
+       /*
+        * Skylake might report unknown remote level via this
+        * bit, consider it when evaluating remote HITMs.
+        */
+       bool mrem  = data_src->mem_remote;
        int err = 0;
 
 #define HITM_INC(__f)          \
@@ -361,7 +366,8 @@ do {                                \
                        }
 
                        if ((lvl & P(LVL, REM_RAM1)) ||
-                           (lvl & P(LVL, REM_RAM2))) {
+                           (lvl & P(LVL, REM_RAM2)) ||
+                            mrem) {
                                stats->rmt_dram++;
                                if (snoop & P(SNOOP, HIT))
                                        stats->ld_shared++;
@@ -371,7 +377,8 @@ do {                                \
                }
 
                if ((lvl & P(LVL, REM_CCE1)) ||
-                   (lvl & P(LVL, REM_CCE2))) {
+                   (lvl & P(LVL, REM_CCE2)) ||
+                    mrem) {
                        if (snoop & P(SNOOP, HIT))
                                stats->rmt_hit++;
                        else if (snoop & P(SNOOP, HITM))