public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: David Carrillo-Cisneros <davidcc@google.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>, Simon Que <sque@chromium.org>,
	Wang Nan <wangnan0@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
	He Kuang <hekuang@huawei.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Paul Turner <pjt@google.com>
Subject: Re: [PATCH 5/7] perf session: don't rely on evlist in pipe mode
Date: Tue, 11 Apr 2017 15:44:35 -0300	[thread overview]
Message-ID: <20170411184435.GH3275@kernel.org> (raw)
In-Reply-To: <20170411184050.GG3275@kernel.org>

Em Tue, Apr 11, 2017 at 03:40:50PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Apr 11, 2017 at 03:40:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Apr 10, 2017 at 01:14:30PM -0700, David Carrillo-Cisneros escreveu:
> > > Session sets a number parameters that rely on evlist. These parameters
> > > are not used in pipe-mode and should not be set, since evlist is
> > > unavailable. Fix that.
> > 
> > Ditching this one as well, until further investigation, well, file must
> > be null in this case...

This should be enough, right?

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index db554b7461b8..37cf4e6abf9f 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -144,7 +144,7 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
 			 * set session attributes that are present in perf.data
 			 * but not in pipe-mode.
 			 */
-			if (!file->is_pipe) {
+			if (!file || !file->is_pipe) {
 				perf_session__set_id_hdr_size(session);
 				perf_session__set_comm_exec(session);
 			}
@@ -166,7 +166,7 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
 	 * In pipe-mode, evlist is empty until PERF_RECORD_HEADER_ATTR is
 	 * processed, so perf_evlist__sample_id_all is not meaningful here.
 	 */
-	if (!file->is_pipe && tool && tool->ordering_requires_timestamps &&
+	if ((!file || !file->is_pipe) && tool && tool->ordering_requires_timestamps &&
 	    tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) {
 		dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
 		tool->ordered_events = false;
 
> Ah, this is the problem:
> 
> [root@jouet ~]# perf top
> perf: Segmentation fault
> -------- backtrace --------
> perf[0x57eddb]
> /lib64/libc.so.6(+0x35990)[0x7fb435d06990]
> perf(perf_session__new+0xb7)[0x4eb547]
> perf(cmd_top+0xde9)[0x44ce89]
> perf[0x49953f]
> perf[0x499831]
> perf(main+0x252)[0x428dd2]
> /lib64/libc.so.6(__libc_start_main+0xf1)[0x7fb435cf1401]
> perf(_start+0x2a)[0x4292da]
> [0x0]
> [root@jouet ~]#
>  
> > [acme@jouet linux]$ git bisect bad
> > 5d71c27204d51492abe9fc69064fd36a0bda410b is the first bad commit
> > commit 5d71c27204d51492abe9fc69064fd36a0bda410b
> > Author: David Carrillo-Cisneros <davidcc@google.com>
> > Date:   Mon Apr 10 13:14:30 2017 -0700
> > 
> >     perf session: Don't rely on evlist in pipe mode
> >     
> >     Session sets a number parameters that rely on evlist. These parameters
> >     are not used in pipe-mode and should not be set, since evlist is
> >     unavailable. Fix that.
> >     
> >     Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> >     Acked-by: Jiri Olsa <jolsa@kernel.org>
> >     Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> >     Cc: Andi Kleen <ak@linux.intel.com>
> >     Cc: He Kuang <hekuang@huawei.com>
> >     Cc: Masami Hiramatsu <mhiramat@kernel.org>
> >     Cc: Paul Turner <pjt@google.com>
> >     Cc: Peter Zijlstra <peterz@infradead.org>
> >     Cc: Simon Que <sque@chromium.org>
> >     Cc: Stephane Eranian <eranian@google.com>
> >     Cc: Wang Nan <wangnan0@huawei.com>
> >     Link: http://lkml.kernel.org/r/20170410201432.24807-6-davidcc@google.com
> >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > 
> > :040000 040000 7df28fe9d7c9d962b78c0532f4961caea2737b59 34e4fed0042b1401c1a1a247d8ae40df17f9d272 M	tools
> > [acme@jouet linux]$
> >  
> > > Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> > > ---
> > >  tools/perf/util/session.c | 16 +++++++++++++---
> > >  1 file changed, 13 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> > > index a25302bc55a8..db554b7461b8 100644
> > > --- a/tools/perf/util/session.c
> > > +++ b/tools/perf/util/session.c
> > > @@ -140,8 +140,14 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
> > >  			if (perf_session__open(session) < 0)
> > >  				goto out_close;
> > >  
> > > -			perf_session__set_id_hdr_size(session);
> > > -			perf_session__set_comm_exec(session);
> > > +			/*
> > > +			 * set session attributes that are present in perf.data
> > > +			 * but not in pipe-mode.
> > > +			 */
> > > +			if (!file->is_pipe) {
> > > +				perf_session__set_id_hdr_size(session);
> > > +				perf_session__set_comm_exec(session);
> > > +			}
> > >  		}
> > >  	} else  {
> > >  		session->machines.host.env = &perf_env;
> > > @@ -156,7 +162,11 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
> > >  			pr_warning("Cannot read kernel map\n");
> > >  	}
> > >  
> > > -	if (tool && tool->ordering_requires_timestamps &&
> > > +	/*
> > > +	 * In pipe-mode, evlist is empty until PERF_RECORD_HEADER_ATTR is
> > > +	 * processed, so perf_evlist__sample_id_all is not meaningful here.
> > > +	 */
> > > +	if (!file->is_pipe && tool && tool->ordering_requires_timestamps &&
> > >  	    tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) {
> > >  		dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
> > >  		tool->ordered_events = false;
> > > -- 
> > > 2.12.2.715.g7642488e1d-goog

  reply	other threads:[~2017-04-11 18:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 20:14 [PATCH 0/7] perf tool: pipe-mode fixes David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 1/7] perf inject: don't proceed if perf_session__process_event fails David Carrillo-Cisneros
2017-04-12  5:39   ` [tip:perf/core] perf inject: Don't proceed if perf_session__process_event() fails tip-bot for David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 2/7] perf inject: copy events when reordering events in pipe mode David Carrillo-Cisneros
2017-04-11  9:40   ` Jiri Olsa
2017-04-11 18:56     ` David Carrillo-Cisneros
2017-04-12  5:39   ` [tip:perf/core] perf inject: Copy " tip-bot for David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 3/7] perf tool: describe pipe mode in perf.data-file-fomat.txt David Carrillo-Cisneros
2017-04-12  5:40   ` [tip:perf/core] perf tools: Describe " tip-bot for David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 4/7] perf annotate: process attr and build_id records David Carrillo-Cisneros
2017-04-12  5:40   ` [tip:perf/core] perf annotate: Process " tip-bot for David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 5/7] perf session: don't rely on evlist in pipe mode David Carrillo-Cisneros
2017-04-11 18:40   ` Arnaldo Carvalho de Melo
2017-04-11 18:40     ` Arnaldo Carvalho de Melo
2017-04-11 18:44       ` Arnaldo Carvalho de Melo [this message]
2017-04-11 18:59         ` David Carrillo-Cisneros
2017-04-11 19:44           ` Arnaldo Carvalho de Melo
2017-04-12  5:41   ` [tip:perf/core] perf session: Don't " tip-bot for David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 6/7] perf tool: protect empty evlists David Carrillo-Cisneros
2017-04-11 18:12   ` Arnaldo Carvalho de Melo
2017-04-11 18:34     ` David Carrillo-Cisneros
2017-04-10 20:14 ` [PATCH 7/7] perf tool: do not print missing features in pipe-mode David Carrillo-Cisneros
2017-04-12  5:41   ` [tip:perf/core] perf tools: Do " tip-bot for David Carrillo-Cisneros
2017-04-11  9:49 ` [PATCH 0/7] perf tool: pipe-mode fixes Jiri Olsa
2017-04-11 18:17   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170411184435.GH3275@kernel.org \
    --to=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=davidcc@google.com \
    --cc=eranian@google.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=sque@chromium.org \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox