public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf c2c: Fix remote HITM detection for Skylake
@ 2017-08-24  8:57 Jiri Olsa
  2017-08-24 21:45 ` Andi Kleen
  2017-08-29 21:19 ` [tip:perf/core] " tip-bot for Jiri Olsa
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Olsa @ 2017-08-24  8:57 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Joe Mario, lkml, Ingo Molnar, Peter Zijlstra, Alexander Shishkin,
	Namhyung Kim, David Ahern, Andi Kleen

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.19953-4-andi@firstfloor.org

Cc: Joe Mario <jmario@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/mem-events.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index ced4f3fff035..28afe5fa84d6 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -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))
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf c2c: Fix remote HITM detection for Skylake
  2017-08-24  8:57 [PATCH] perf c2c: Fix remote HITM detection for Skylake Jiri Olsa
@ 2017-08-24 21:45 ` Andi Kleen
  2017-08-25 18:49   ` Arnaldo Carvalho de Melo
  2017-08-29 21:19 ` [tip:perf/core] " tip-bot for Jiri Olsa
  1 sibling, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2017-08-24 21:45 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Joe Mario, lkml, Ingo Molnar,
	Peter Zijlstra, Alexander Shishkin, Namhyung Kim, David Ahern,
	Andi Kleen

On Thu, Aug 24, 2017 at 10:57:32AM +0200, Jiri Olsa wrote:
> 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.

Acked-by: Andi Kleen <ak@linux.intel.com>

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf c2c: Fix remote HITM detection for Skylake
  2017-08-24 21:45 ` Andi Kleen
@ 2017-08-25 18:49   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-08-25 18:49 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Jiri Olsa, Joe Mario, lkml, Ingo Molnar, Peter Zijlstra,
	Alexander Shishkin, Namhyung Kim, David Ahern

Em Thu, Aug 24, 2017 at 02:45:07PM -0700, Andi Kleen escreveu:
> On Thu, Aug 24, 2017 at 10:57:32AM +0200, Jiri Olsa wrote:
> > 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.
> 
> Acked-by: Andi Kleen <ak@linux.intel.com>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/core] perf c2c: Fix remote HITM detection for Skylake
  2017-08-24  8:57 [PATCH] perf c2c: Fix remote HITM detection for Skylake Jiri Olsa
  2017-08-24 21:45 ` Andi Kleen
@ 2017-08-29 21:19 ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-08-29 21:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, dsahern, namhyung, a.p.zijlstra, ak, jolsa,
	mingo, acme, alexander.shishkin, tglx, jmario

Commit-ID:  12c15302dd4b768105d4b7a487ed4858ccab94fc
Gitweb:     http://git.kernel.org/tip/12c15302dd4b768105d4b7a487ed4858ccab94fc
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Thu, 24 Aug 2017 10:57:32 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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/20170816222156.19953-4-andi@firstfloor.org

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170824085732.28481-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/mem-events.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index ced4f3f..28afe5f 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -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))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-29 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24  8:57 [PATCH] perf c2c: Fix remote HITM detection for Skylake Jiri Olsa
2017-08-24 21:45 ` Andi Kleen
2017-08-25 18:49   ` Arnaldo Carvalho de Melo
2017-08-29 21:19 ` [tip:perf/core] " tip-bot for Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox