From: David Ahern <dsahern@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] perf lock: fix segfault with info subcommand following move to libtraceevent
Date: Fri, 06 Jul 2012 11:17:41 -0600 [thread overview]
Message-ID: <4FF71DB5.5050104@gmail.com> (raw)
In-Reply-To: <20120706171431.GF7533@infradead.org>
On 7/6/12 11:14 AM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jul 06, 2012 at 10:02:18AM -0600, David Ahern escreveu:
>> +++ b/tools/perf/builtin-lock.c
>> @@ -877,6 +877,9 @@ static int read_events(void)
>> if (!session)
>> die("Initializing perf session failed\n");
>>
>> + if (!perf_session__has_traces(session, "lock record"))
>> + exit(1);
>> +
>> return perf_session__process_events(session, &eops);
>> }
>
> This is getting out of hand, first a die(), then an exit(1) and finally
> this function returns a value, ouch.
>
> I'd rather use return to signal that something went wrong and as well
> print some helpful warning to the user.
>
> Eventually we should fix all the other offenders, but lets try not to
> add even more.
Agree. But....
>
> Can you please resend with a pr_warning + return failure?
This command needs some love. The rc is not checked and requires some
rework. e.g., the report path:
setup_pager();
select_key();
read_events(); <---- the function I changed
sort_result();
print_result();
and the info path:
setup_pager();
read_events();
dump_info();
I figured for 3.5 at least not segfault; clean up for 3.6 or later.
David
next prev parent reply other threads:[~2012-07-06 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 16:02 [PATCH] perf lock: fix segfault with info subcommand following move to libtraceevent David Ahern
2012-07-06 17:14 ` Arnaldo Carvalho de Melo
2012-07-06 17:17 ` David Ahern [this message]
2012-07-06 17:46 ` 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=4FF71DB5.5050104@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
/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