From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757490AbbEFDMp (ORCPT ); Tue, 5 May 2015 23:12:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36273 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751995AbbEFDMj (ORCPT ); Tue, 5 May 2015 23:12:39 -0400 Date: Tue, 5 May 2015 20:12:06 -0700 From: tip-bot for Adrian Hunter Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, namhyung@gmail.com, tglx@linutronix.de, acme@redhat.com, jolsa@redhat.com, eranian@google.com, adrian.hunter@intel.com, fweisbec@gmail.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: jolsa@redhat.com, dsahern@gmail.com, adrian.hunter@intel.com, fweisbec@gmail.com, eranian@google.com, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de, namhyung@gmail.com, acme@redhat.com In-Reply-To: <1429903807-20559-3-git-send-email-adrian.hunter@intel.com> References: <1429903807-20559-3-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf script: Always allow fields 'addr' and 'cpu' for auxtrace Git-Commit-ID: 6d5cdd64f314e03c8606c777dc44b09769f8e038 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6d5cdd64f314e03c8606c777dc44b09769f8e038 Gitweb: http://git.kernel.org/tip/6d5cdd64f314e03c8606c777dc44b09769f8e038 Author: Adrian Hunter AuthorDate: Fri, 24 Apr 2015 22:29:44 +0300 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 4 May 2015 12:43:49 -0300 perf script: Always allow fields 'addr' and 'cpu' for auxtrace If a file contains AUX area tracing data then always allow fields 'addr' and 'cpu' to be selected as options for perf script. This is necessary because AUX area decoding may synthesize events with that information. Signed-off-by: Adrian Hunter Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1429903807-20559-3-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index cd2f38b..6805098 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -148,9 +148,10 @@ static const char *output_field2str(enum perf_output_field field) #define PRINT_FIELD(x) (output[attr->type].fields & PERF_OUTPUT_##x) -static int perf_evsel__check_stype(struct perf_evsel *evsel, - u64 sample_type, const char *sample_msg, - enum perf_output_field field) +static int perf_evsel__do_check_stype(struct perf_evsel *evsel, + u64 sample_type, const char *sample_msg, + enum perf_output_field field, + bool allow_user_set) { struct perf_event_attr *attr = &evsel->attr; int type = attr->type; @@ -160,6 +161,8 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel, return 0; if (output[type].user_set) { + if (allow_user_set) + return 0; evname = perf_evsel__name(evsel); pr_err("Samples for '%s' event do not have %s attribute set. " "Cannot print '%s' field.\n", @@ -177,10 +180,22 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel, return 0; } +static int perf_evsel__check_stype(struct perf_evsel *evsel, + u64 sample_type, const char *sample_msg, + enum perf_output_field field) +{ + return perf_evsel__do_check_stype(evsel, sample_type, sample_msg, field, + false); +} + static int perf_evsel__check_attr(struct perf_evsel *evsel, struct perf_session *session) { struct perf_event_attr *attr = &evsel->attr; + bool allow_user_set; + + allow_user_set = perf_header__has_feat(&session->header, + HEADER_AUXTRACE); if (PRINT_FIELD(TRACE) && !perf_session__has_traces(session, "record -R")) @@ -193,8 +208,8 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel, } if (PRINT_FIELD(ADDR) && - perf_evsel__check_stype(evsel, PERF_SAMPLE_ADDR, "ADDR", - PERF_OUTPUT_ADDR)) + perf_evsel__do_check_stype(evsel, PERF_SAMPLE_ADDR, "ADDR", + PERF_OUTPUT_ADDR, allow_user_set)) return -EINVAL; if (PRINT_FIELD(SYM) && !PRINT_FIELD(IP) && !PRINT_FIELD(ADDR)) { @@ -231,8 +246,8 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel, return -EINVAL; if (PRINT_FIELD(CPU) && - perf_evsel__check_stype(evsel, PERF_SAMPLE_CPU, "CPU", - PERF_OUTPUT_CPU)) + perf_evsel__do_check_stype(evsel, PERF_SAMPLE_CPU, "CPU", + PERF_OUTPUT_CPU, allow_user_set)) return -EINVAL; if (PRINT_FIELD(PERIOD) &&