From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754751AbdKAOd6 (ORCPT ); Wed, 1 Nov 2017 10:33:58 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47788 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754540AbdKAOd5 (ORCPT ); Wed, 1 Nov 2017 10:33:57 -0400 From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: takahiro.akashi@linaro.org, rostedt@goodmis.org, Julien Thierry , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] perf: Fix ftrace builtin when kernel doesn't have function_graph Date: Wed, 1 Nov 2017 14:33:44 +0000 Message-Id: <1509546824-46165-3-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509546824-46165-1-git-send-email-julien.thierry@arm.com> References: <1509546824-46165-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Will Deacon Cc: Mark Rutland Cc: Peter Zijlstra Cc: Ingo Molnar 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) return -1; reset_tracing_filters(); -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: julien.thierry@arm.com (Julien Thierry) Date: Wed, 1 Nov 2017 14:33:44 +0000 Subject: [PATCH 2/2] perf: Fix ftrace builtin when kernel doesn't have function_graph In-Reply-To: <1509546824-46165-1-git-send-email-julien.thierry@arm.com> References: <1509546824-46165-1-git-send-email-julien.thierry@arm.com> Message-ID: <1509546824-46165-3-git-send-email-julien.thierry@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 Cc: Will Deacon Cc: Mark Rutland Cc: Peter Zijlstra Cc: Ingo Molnar 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) return -1; reset_tracing_filters(); -- 1.9.1