public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] perf inject jit: Fix JIT_CODE_MOVE filename
@ 2019-09-28  1:41 Steve MacLean
  2019-09-29 15:45 ` Jiri Olsa
  2019-09-30 10:47 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 3+ messages in thread
From: Steve MacLean @ 2019-09-28  1:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim
  Cc: Eric Saint-Etienne, John Keeping, Andi Kleen, Song Liu,
	Davidlohr Bueso, Leo Yan, linux-kernel@vger.kernel.org,
	Brian Robbins, Tom McDonald, John Salem, Stephane Eranian

During perf inject --jit, JIT_CODE_MOVE records were injecting MMAP records
with an incorrect filename. Specifically it was missing the ".so" suffix.

Further the JIT_CODE_LOAD record were silently truncating the
jr->load.code_index field to 32 bits before generating the filename.

Make both records emit the same filename based on the full 64 bit
code_index field.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Steve MacLean <Steve.MacLean@Microsoft.com>
---
 tools/perf/util/jitdump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 1bdf4c6..e3ccb0c 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -395,7 +395,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
 	size_t size;
 	u16 idr_size;
 	const char *sym;
-	uint32_t count;
+	uint64_t count;
 	int ret, csize, usize;
 	pid_t pid, tid;
 	struct {
@@ -418,7 +418,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
 		return -1;
 
 	filename = event->mmap2.filename;
-	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%u.so",
+	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so",
 			jd->dir,
 			pid,
 			count);
@@ -529,7 +529,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)
 		return -1;
 
 	filename = event->mmap2.filename;
-	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%"PRIu64,
+	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so",
 	         jd->dir,
 	         pid,
 		 jr->move.code_index);
-- 
2.7.4

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

* Re: [PATCH 2/4] perf inject jit: Fix JIT_CODE_MOVE filename
  2019-09-28  1:41 [PATCH 2/4] perf inject jit: Fix JIT_CODE_MOVE filename Steve MacLean
@ 2019-09-29 15:45 ` Jiri Olsa
  2019-09-30 10:47 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2019-09-29 15:45 UTC (permalink / raw)
  To: Steve MacLean
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Namhyung Kim,
	Eric Saint-Etienne, John Keeping, Andi Kleen, Song Liu,
	Davidlohr Bueso, Leo Yan, linux-kernel@vger.kernel.org,
	Brian Robbins, Tom McDonald, John Salem, Stephane Eranian

On Sat, Sep 28, 2019 at 01:41:18AM +0000, Steve MacLean wrote:
> During perf inject --jit, JIT_CODE_MOVE records were injecting MMAP records
> with an incorrect filename. Specifically it was missing the ".so" suffix.
> 
> Further the JIT_CODE_LOAD record were silently truncating the
> jr->load.code_index field to 32 bits before generating the filename.
> 
> Make both records emit the same filename based on the full 64 bit
> code_index field.
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Steve MacLean <Steve.MacLean@Microsoft.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
>  tools/perf/util/jitdump.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
> index 1bdf4c6..e3ccb0c 100644
> --- a/tools/perf/util/jitdump.c
> +++ b/tools/perf/util/jitdump.c
> @@ -395,7 +395,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
>  	size_t size;
>  	u16 idr_size;
>  	const char *sym;
> -	uint32_t count;
> +	uint64_t count;
>  	int ret, csize, usize;
>  	pid_t pid, tid;
>  	struct {
> @@ -418,7 +418,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
>  		return -1;
>  
>  	filename = event->mmap2.filename;
> -	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%u.so",
> +	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so",
>  			jd->dir,
>  			pid,
>  			count);
> @@ -529,7 +529,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)
>  		return -1;
>  
>  	filename = event->mmap2.filename;
> -	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%"PRIu64,
> +	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so",
>  	         jd->dir,
>  	         pid,
>  		 jr->move.code_index);
> -- 
> 2.7.4

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

* Re: [PATCH 2/4] perf inject jit: Fix JIT_CODE_MOVE filename
  2019-09-28  1:41 [PATCH 2/4] perf inject jit: Fix JIT_CODE_MOVE filename Steve MacLean
  2019-09-29 15:45 ` Jiri Olsa
@ 2019-09-30 10:47 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-09-30 10:47 UTC (permalink / raw)
  To: Steve MacLean
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Eric Saint-Etienne, John Keeping, Andi Kleen, Song Liu,
	Davidlohr Bueso, Leo Yan, linux-kernel@vger.kernel.org,
	Brian Robbins, Tom McDonald, John Salem, Stephane Eranian

Em Sat, Sep 28, 2019 at 01:41:18AM +0000, Steve MacLean escreveu:
> During perf inject --jit, JIT_CODE_MOVE records were injecting MMAP records
> with an incorrect filename. Specifically it was missing the ".so" suffix.
> 
> Further the JIT_CODE_LOAD record were silently truncating the
> jr->load.code_index field to 32 bits before generating the filename.
> 
> Make both records emit the same filename based on the full 64 bit
> code_index field.

Thanks, applied and added:

[acme@quaco perf]$ git tag --contains 9b07e27f88b9 | grep ^v[[:digit:]] | sort --version-sort | head -5
v4.6
v4.6-rc1
v4.6-rc2
v4.6-rc3
v4.6-rc4
[acme@quaco perf]$

Cc: stable@vger.kernel.org # v4.6+
Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")

So that the stable folks get this backported.

- Arnaldo
 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Steve MacLean <Steve.MacLean@Microsoft.com>
> ---
>  tools/perf/util/jitdump.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
> index 1bdf4c6..e3ccb0c 100644
> --- a/tools/perf/util/jitdump.c
> +++ b/tools/perf/util/jitdump.c
> @@ -395,7 +395,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
>  	size_t size;
>  	u16 idr_size;
>  	const char *sym;
> -	uint32_t count;
> +	uint64_t count;
>  	int ret, csize, usize;
>  	pid_t pid, tid;
>  	struct {
> @@ -418,7 +418,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
>  		return -1;
>  
>  	filename = event->mmap2.filename;
> -	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%u.so",
> +	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so",
>  			jd->dir,
>  			pid,
>  			count);
> @@ -529,7 +529,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)
>  		return -1;
>  
>  	filename = event->mmap2.filename;
> -	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%"PRIu64,
> +	size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so",
>  	         jd->dir,
>  	         pid,
>  		 jr->move.code_index);
> -- 
> 2.7.4

-- 

- Arnaldo

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

end of thread, other threads:[~2019-09-30 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-28  1:41 [PATCH 2/4] perf inject jit: Fix JIT_CODE_MOVE filename Steve MacLean
2019-09-29 15:45 ` Jiri Olsa
2019-09-30 10:47 ` Arnaldo Carvalho de Melo

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