Skip to contentSkip to conversation

perf c2c: Fix remote HITM detection for Skylake

PATCH Applied Jiri Olsa 4 participants 4 messages Aug 24, 2017 – Aug 29, 2017 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf c2c: Fix remote HITM detection for Skylake

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/[email protected]

---
 tools/perf/util/mem-events.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tools/perf/util/mem-events.c +9 -2
index ced4f3fff035..28afe5fa84d6 100644
@@ -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))
Signature · 1 line
2.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jiri Olsa

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.

-Andi

maintainer Applied
#2 lore raw

Em Thu, Aug 24, 2017 at 02:45:07PM -0700, Andi Kleen escreveu:

Quoted 9 lines · Jiri Olsa
Quoted 6 lines

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.

Thanks, applied.

- Arnaldo

#3 lore raw
In reply to Jiri Olsa
perf c2c: Fix remote HITM detection for Skylake
Commit-ID:  12c15302dd4b768105d4b7a487ed4858ccab94fc
Gitweb:     http://git.kernel.org/tip/12c15302dd4b768105d4b7a487ed4858ccab94fc
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 24 Aug 2017 10:57:32 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 28 Aug 2017 11:05:10 -0300

perf c2c: Fix remote HITM detection for Skylake

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/[email protected]

---
 tools/perf/util/mem-events.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tools/perf/util/mem-events.c +9 -2
index ced4f3f..28afe5f 100644
@@ -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))