public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf report: Output non-zero offset for decompressed records
@ 2021-09-29  9:14 Alexey Bayduraev
  2021-10-04  6:42 ` Jiri Olsa
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Bayduraev @ 2021-09-29  9:14 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Namhyung Kim, Alexander Shishkin, Peter Zijlstra,
	Ingo Molnar, linux-kernel, Andi Kleen, Adrian Hunter,
	Alexander Antonov, Alexei Budankov, Riccardo Mancini

Print offset of PERF_RECORD_COMPRESSED record instead of zero for
decompressed records in raw trace dump (-D option of perf-report):

0x17cf08 [0x28]: event: 9

instead of:

0 [0x28]: event: 9

The fix is not critical, because currently file_pos for compressed
events is used in perf_session__process_event only to show offsets
in the raw dump.

This patch was separated from patchset:
https://lore.kernel.org/lkml/cover.1629186429.git.alexey.v.bayduraev@linux.intel.com/
and was already rewieved.

Acked-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Riccardo Mancini <rickyman7@gmail.com>
Tested-by: Riccardo Mancini <rickyman7@gmail.com>
Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
---
 tools/perf/util/session.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 069c2cfdd3be..352f16076e01 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2116,7 +2116,7 @@ fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)
 static int __perf_session__process_decomp_events(struct perf_session *session)
 {
 	s64 skip;
-	u64 size, file_pos = 0;
+	u64 size;
 	struct decomp *decomp = session->decomp_last;
 
 	if (!decomp)
@@ -2132,7 +2132,7 @@ static int __perf_session__process_decomp_events(struct perf_session *session)
 		size = event->header.size;
 
 		if (size < sizeof(struct perf_event_header) ||
-		    (skip = perf_session__process_event(session, event, file_pos)) < 0) {
+		    (skip = perf_session__process_event(session, event, decomp->file_pos)) < 0) {
 			pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
 				decomp->file_pos + decomp->head, event->header.size, event->header.type);
 			return -EINVAL;
-- 
2.19.0


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

* Re: [PATCH] perf report: Output non-zero offset for decompressed records
  2021-09-29  9:14 [PATCH] perf report: Output non-zero offset for decompressed records Alexey Bayduraev
@ 2021-10-04  6:42 ` Jiri Olsa
  2021-10-04  7:00   ` Bayduraev, Alexey V
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2021-10-04  6:42 UTC (permalink / raw)
  To: Alexey Bayduraev
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Peter Zijlstra, Ingo Molnar, linux-kernel, Andi Kleen,
	Adrian Hunter, Alexander Antonov, Alexei Budankov,
	Riccardo Mancini

On Wed, Sep 29, 2021 at 12:14:45PM +0300, Alexey Bayduraev wrote:
> Print offset of PERF_RECORD_COMPRESSED record instead of zero for
> decompressed records in raw trace dump (-D option of perf-report):
> 
> 0x17cf08 [0x28]: event: 9
> 
> instead of:
> 
> 0 [0x28]: event: 9
> 
> The fix is not critical, because currently file_pos for compressed
> events is used in perf_session__process_event only to show offsets
> in the raw dump.

hi,
I don't mind the change just curious, because I see also:

  perf_session__process_event
    perf_session__process_user_event
      lseek(fd, file_offset, ...

which is not raw dump as the comment suggests

thanks,
jirka

> 
> This patch was separated from patchset:
> https://lore.kernel.org/lkml/cover.1629186429.git.alexey.v.bayduraev@linux.intel.com/
> and was already rewieved.
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>
> Acked-by: Andi Kleen <ak@linux.intel.com>
> Reviewed-by: Riccardo Mancini <rickyman7@gmail.com>
> Tested-by: Riccardo Mancini <rickyman7@gmail.com>
> Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
> ---
>  tools/perf/util/session.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 069c2cfdd3be..352f16076e01 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -2116,7 +2116,7 @@ fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)
>  static int __perf_session__process_decomp_events(struct perf_session *session)
>  {
>  	s64 skip;
> -	u64 size, file_pos = 0;
> +	u64 size;
>  	struct decomp *decomp = session->decomp_last;
>  
>  	if (!decomp)
> @@ -2132,7 +2132,7 @@ static int __perf_session__process_decomp_events(struct perf_session *session)
>  		size = event->header.size;
>  
>  		if (size < sizeof(struct perf_event_header) ||
> -		    (skip = perf_session__process_event(session, event, file_pos)) < 0) {
> +		    (skip = perf_session__process_event(session, event, decomp->file_pos)) < 0) {
>  			pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
>  				decomp->file_pos + decomp->head, event->header.size, event->header.type);
>  			return -EINVAL;
> -- 
> 2.19.0
> 


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

* Re: [PATCH] perf report: Output non-zero offset for decompressed records
  2021-10-04  6:42 ` Jiri Olsa
@ 2021-10-04  7:00   ` Bayduraev, Alexey V
  2021-10-04  7:06     ` Jiri Olsa
  0 siblings, 1 reply; 5+ messages in thread
From: Bayduraev, Alexey V @ 2021-10-04  7:00 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Peter Zijlstra, Ingo Molnar, linux-kernel, Andi Kleen,
	Adrian Hunter, Alexander Antonov, Alexei Budankov,
	Riccardo Mancini


On 04.10.2021 9:42, Jiri Olsa wrote:
> On Wed, Sep 29, 2021 at 12:14:45PM +0300, Alexey Bayduraev wrote:
>> Print offset of PERF_RECORD_COMPRESSED record instead of zero for
>> decompressed records in raw trace dump (-D option of perf-report):
>>
>> 0x17cf08 [0x28]: event: 9
>>
>> instead of:
>>
>> 0 [0x28]: event: 9
>>
>> The fix is not critical, because currently file_pos for compressed
>> events is used in perf_session__process_event only to show offsets
>> in the raw dump.
> 
> hi,
> I don't mind the change just curious, because I see also:
> 
>   perf_session__process_event
>     perf_session__process_user_event
>       lseek(fd, file_offset, ...
> 
> which is not raw dump as the comment suggests

Hi,

Yes, but this "lseek" only works for user events, whereas the 
PERF_RECORD_COMPRESSED record shouln't contain such events.
Currently, the PERF_RECORD_COMPRESSED container can only pack
kernel events. 

Regards,
Alexey

> 
> thanks,
> jirka
> 
>>
>> This patch was separated from patchset:
>> https://lore.kernel.org/lkml/cover.1629186429.git.alexey.v.bayduraev@linux.intel.com/
>> and was already rewieved.
>>
>> Acked-by: Namhyung Kim <namhyung@kernel.org>
>> Acked-by: Andi Kleen <ak@linux.intel.com>
>> Reviewed-by: Riccardo Mancini <rickyman7@gmail.com>
>> Tested-by: Riccardo Mancini <rickyman7@gmail.com>
>> Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
>> ---
>>  tools/perf/util/session.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
>> index 069c2cfdd3be..352f16076e01 100644
>> --- a/tools/perf/util/session.c
>> +++ b/tools/perf/util/session.c
>> @@ -2116,7 +2116,7 @@ fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)
>>  static int __perf_session__process_decomp_events(struct perf_session *session)
>>  {
>>  	s64 skip;
>> -	u64 size, file_pos = 0;
>> +	u64 size;
>>  	struct decomp *decomp = session->decomp_last;
>>  
>>  	if (!decomp)
>> @@ -2132,7 +2132,7 @@ static int __perf_session__process_decomp_events(struct perf_session *session)
>>  		size = event->header.size;
>>  
>>  		if (size < sizeof(struct perf_event_header) ||
>> -		    (skip = perf_session__process_event(session, event, file_pos)) < 0) {
>> +		    (skip = perf_session__process_event(session, event, decomp->file_pos)) < 0) {
>>  			pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
>>  				decomp->file_pos + decomp->head, event->header.size, event->header.type);
>>  			return -EINVAL;
>> -- 
>> 2.19.0
>>
> 

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

* Re: [PATCH] perf report: Output non-zero offset for decompressed records
  2021-10-04  7:00   ` Bayduraev, Alexey V
@ 2021-10-04  7:06     ` Jiri Olsa
  2021-10-08 18:44       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2021-10-04  7:06 UTC (permalink / raw)
  To: Bayduraev, Alexey V
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Peter Zijlstra, Ingo Molnar, linux-kernel, Andi Kleen,
	Adrian Hunter, Alexander Antonov, Alexei Budankov,
	Riccardo Mancini

On Mon, Oct 04, 2021 at 10:00:52AM +0300, Bayduraev, Alexey V wrote:
> 
> On 04.10.2021 9:42, Jiri Olsa wrote:
> > On Wed, Sep 29, 2021 at 12:14:45PM +0300, Alexey Bayduraev wrote:
> >> Print offset of PERF_RECORD_COMPRESSED record instead of zero for
> >> decompressed records in raw trace dump (-D option of perf-report):
> >>
> >> 0x17cf08 [0x28]: event: 9
> >>
> >> instead of:
> >>
> >> 0 [0x28]: event: 9
> >>
> >> The fix is not critical, because currently file_pos for compressed
> >> events is used in perf_session__process_event only to show offsets
> >> in the raw dump.
> > 
> > hi,
> > I don't mind the change just curious, because I see also:
> > 
> >   perf_session__process_event
> >     perf_session__process_user_event
> >       lseek(fd, file_offset, ...
> > 
> > which is not raw dump as the comment suggests
> 
> Hi,
> 
> Yes, but this "lseek" only works for user events, whereas the 
> PERF_RECORD_COMPRESSED record shouln't contain such events.
> Currently, the PERF_RECORD_COMPRESSED container can only pack
> kernel events. 

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

> 
> Regards,
> Alexey
> 
> > 
> > thanks,
> > jirka
> > 
> >>
> >> This patch was separated from patchset:
> >> https://lore.kernel.org/lkml/cover.1629186429.git.alexey.v.bayduraev@linux.intel.com/
> >> and was already rewieved.
> >>
> >> Acked-by: Namhyung Kim <namhyung@kernel.org>
> >> Acked-by: Andi Kleen <ak@linux.intel.com>
> >> Reviewed-by: Riccardo Mancini <rickyman7@gmail.com>
> >> Tested-by: Riccardo Mancini <rickyman7@gmail.com>
> >> Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
> >> ---
> >>  tools/perf/util/session.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> >> index 069c2cfdd3be..352f16076e01 100644
> >> --- a/tools/perf/util/session.c
> >> +++ b/tools/perf/util/session.c
> >> @@ -2116,7 +2116,7 @@ fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)
> >>  static int __perf_session__process_decomp_events(struct perf_session *session)
> >>  {
> >>  	s64 skip;
> >> -	u64 size, file_pos = 0;
> >> +	u64 size;
> >>  	struct decomp *decomp = session->decomp_last;
> >>  
> >>  	if (!decomp)
> >> @@ -2132,7 +2132,7 @@ static int __perf_session__process_decomp_events(struct perf_session *session)
> >>  		size = event->header.size;
> >>  
> >>  		if (size < sizeof(struct perf_event_header) ||
> >> -		    (skip = perf_session__process_event(session, event, file_pos)) < 0) {
> >> +		    (skip = perf_session__process_event(session, event, decomp->file_pos)) < 0) {
> >>  			pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
> >>  				decomp->file_pos + decomp->head, event->header.size, event->header.type);
> >>  			return -EINVAL;
> >> -- 
> >> 2.19.0
> >>
> > 
> 


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

* Re: [PATCH] perf report: Output non-zero offset for decompressed records
  2021-10-04  7:06     ` Jiri Olsa
@ 2021-10-08 18:44       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-10-08 18:44 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Bayduraev, Alexey V, Namhyung Kim, Alexander Shishkin,
	Peter Zijlstra, Ingo Molnar, linux-kernel, Andi Kleen,
	Adrian Hunter, Alexander Antonov, Alexei Budankov,
	Riccardo Mancini

Em Mon, Oct 04, 2021 at 09:06:36AM +0200, Jiri Olsa escreveu:
> On Mon, Oct 04, 2021 at 10:00:52AM +0300, Bayduraev, Alexey V wrote:
> > On 04.10.2021 9:42, Jiri Olsa wrote:
> > > On Wed, Sep 29, 2021 at 12:14:45PM +0300, Alexey Bayduraev wrote:
> > >> Print offset of PERF_RECORD_COMPRESSED record instead of zero for
> > >> decompressed records in raw trace dump (-D option of perf-report):

> > >> 0x17cf08 [0x28]: event: 9

> > >> instead of:

> > >> 0 [0x28]: event: 9

> > >> The fix is not critical, because currently file_pos for compressed
> > >> events is used in perf_session__process_event only to show offsets
> > >> in the raw dump.

> > > I don't mind the change just curious, because I see also:
> > > 
> > >   perf_session__process_event
> > >     perf_session__process_user_event
> > >       lseek(fd, file_offset, ...

> > > which is not raw dump as the comment suggests

> > Yes, but this "lseek" only works for user events, whereas the 
> > PERF_RECORD_COMPRESSED record shouln't contain such events.
> > Currently, the PERF_RECORD_COMPRESSED container can only pack
> > kernel events. 
 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks, applied.

- Arnaldo


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

end of thread, other threads:[~2021-10-08 18:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-29  9:14 [PATCH] perf report: Output non-zero offset for decompressed records Alexey Bayduraev
2021-10-04  6:42 ` Jiri Olsa
2021-10-04  7:00   ` Bayduraev, Alexey V
2021-10-04  7:06     ` Jiri Olsa
2021-10-08 18:44       ` 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