All of lore.kernel.org
 help / color / mirror / Atom feed
From: julien.thierry@arm.com (Julien Thierry)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] perf: Fix ftrace builtin when kernel doesn't have function_graph
Date: Wed, 1 Nov 2017 16:58:20 +0000	[thread overview]
Message-ID: <047da0c7-6552-e6bb-d044-7cb5e05c431d@arm.com> (raw)
In-Reply-To: <20171101124433.1a6ed9c6@gandalf.local.home>



On 01/11/17 16:44, Steven Rostedt wrote:
> On Wed,  1 Nov 2017 14:33:44 +0000
> Julien Thierry <julien.thierry@arm.com> wrote:
> 
>> When linux is built without support for function graph tracer, the ftrace
>> builtin of perf will fail when trying to reset max_graph_depth because the
>> file does not exist. This prevents the use of function tracer from perf.
>>
>> Do not attempt to write this file when the tracer in use is not
>> function_graph.
>>
>> Signed-off-by: Julien Thierry <julien.thierry@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: linux-kernel at vger.kernel.org
>> ---
>>   tools/perf/builtin-ftrace.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
>> index 25a42ac..48120f2 100644
>> --- a/tools/perf/builtin-ftrace.c
>> +++ b/tools/perf/builtin-ftrace.c
>> @@ -130,7 +130,8 @@ static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
>>   	if (reset_tracing_cpu() < 0)
>>   		return -1;
>>
>> -	if (write_tracing_file("max_graph_depth", "0") < 0)
>> +	if (!strcmp(ftrace->tracer, "function_graph") &&
>> +	    write_tracing_file("max_graph_depth", "0") < 0)
> 
> Hmm, instead of doing this, could we just do a stat on the file first.
> As with trace-cmd, I like to reset files like this even when not
> enabling function_graph tracer.
> 

Sounds reasonable.

I'll include that change in the next version of the patches.

Thanks,

-- 
Julien Thierry

WARNING: multiple messages have this Message-ID (diff)
From: Julien Thierry <julien.thierry@arm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-arm-kernel@lists.infradead.org, takahiro.akashi@linaro.org,
	Will Deacon <will.deacon@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf: Fix ftrace builtin when kernel doesn't have function_graph
Date: Wed, 1 Nov 2017 16:58:20 +0000	[thread overview]
Message-ID: <047da0c7-6552-e6bb-d044-7cb5e05c431d@arm.com> (raw)
In-Reply-To: <20171101124433.1a6ed9c6@gandalf.local.home>



On 01/11/17 16:44, Steven Rostedt wrote:
> On Wed,  1 Nov 2017 14:33:44 +0000
> Julien Thierry <julien.thierry@arm.com> wrote:
> 
>> When linux is built without support for function graph tracer, the ftrace
>> builtin of perf will fail when trying to reset max_graph_depth because the
>> file does not exist. This prevents the use of function tracer from perf.
>>
>> Do not attempt to write this file when the tracer in use is not
>> function_graph.
>>
>> Signed-off-by: Julien Thierry <julien.thierry@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: linux-kernel@vger.kernel.org
>> ---
>>   tools/perf/builtin-ftrace.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
>> index 25a42ac..48120f2 100644
>> --- a/tools/perf/builtin-ftrace.c
>> +++ b/tools/perf/builtin-ftrace.c
>> @@ -130,7 +130,8 @@ static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
>>   	if (reset_tracing_cpu() < 0)
>>   		return -1;
>>
>> -	if (write_tracing_file("max_graph_depth", "0") < 0)
>> +	if (!strcmp(ftrace->tracer, "function_graph") &&
>> +	    write_tracing_file("max_graph_depth", "0") < 0)
> 
> Hmm, instead of doing this, could we just do a stat on the file first.
> As with trace-cmd, I like to reset files like this even when not
> enabling function_graph tracer.
> 

Sounds reasonable.

I'll include that change in the next version of the patches.

Thanks,

-- 
Julien Thierry

  reply	other threads:[~2017-11-01 16:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 14:33 [PATCH 0/2] Ftrace fixes Julien Thierry
2017-11-01 14:33 ` [PATCH 1/2] arm64: Fix static use of function graph Julien Thierry
2017-11-01 16:43   ` Steven Rostedt
2017-11-02  4:43   ` AKASHI Takahiro
2017-11-02 10:18     ` Russell King - ARM Linux
2017-11-03  9:25       ` Julien Thierry
2017-11-06  1:36         ` AKASHI Takahiro
2017-11-01 14:33 ` [PATCH 2/2] perf: Fix ftrace builtin when kernel doesn't have function_graph Julien Thierry
2017-11-01 14:33   ` Julien Thierry
2017-11-01 16:44   ` Steven Rostedt
2017-11-01 16:44     ` Steven Rostedt
2017-11-01 16:58     ` Julien Thierry [this message]
2017-11-01 16:58       ` Julien Thierry

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=047da0c7-6552-e6bb-d044-7cb5e05c431d@arm.com \
    --to=julien.thierry@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.