All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 08/13] perf tools: Let a user specify a PMU event without any config terms
Date: Mon,  8 Sep 2014 18:18:04 -0300	[thread overview]
Message-ID: <1410211089-28668-9-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1410211089-28668-1-git-send-email-acme@kernel.org>

From: Adrian Hunter <adrian.hunter@intel.com>

This enables a PMU event to be specified in the form:

	pmu//

which is effectively the same as:

	pmu/config=0/

This patch is a precursor to defining default config for a PMU.

Further explanation extracted from lkml thread:

Imagine that the 'tsc' term did not exist.

Intel PT trace data would not contain TSC packets, and the decoder would
not know how to decode them.

Then imagine that a new version of the hardware adds 'tsc'.

It is such a useful feature that we want it by default, but older
versions of the tools don't know how to decode it, so the kernel cannot
turn it on by default.

It is similar to why the kernel does not select perf_event_attr.mmap2 by
default.

The kernel doesn't know whether the tool supports it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1408129739-17368-6-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c |  6 ++++++
 tools/perf/util/parse-events.y | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e34c81a0bcf3..e75628813968 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -645,6 +645,12 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
 
 	memset(&attr, 0, sizeof(attr));
 
+	if (!head_config) {
+		attr.type = pmu->type;
+		evsel = __add_event(list, idx, &attr, NULL, pmu->cpus);
+		return evsel ? 0 : -ENOMEM;
+	}
+
 	if (perf_pmu__check_alias(pmu, head_config, &unit, &scale))
 		return -EINVAL;
 
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 0bc87ba46bf3..55fab6ad609a 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -210,6 +210,16 @@ PE_NAME '/' event_config '/'
 	parse_events__free_terms($3);
 	$$ = list;
 }
+|
+PE_NAME '/' '/'
+{
+	struct parse_events_evlist *data = _data;
+	struct list_head *list;
+
+	ALLOC_LIST(list);
+	ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL));
+	$$ = list;
+}
 
 value_sym:
 PE_VALUE_SYM_HW
-- 
1.9.3


  parent reply	other threads:[~2014-09-08 21:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 21:17 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-09-08 21:17 ` [PATCH 01/13] perf tools: Add +field argument support for --sort option Arnaldo Carvalho de Melo
2014-09-08 21:17 ` [PATCH 02/13] perf tools powerpc: Fix build issue when DWARF support is disabled Arnaldo Carvalho de Melo
2014-09-08 21:17 ` [PATCH 03/13] perf kvm stat report: Save pid string in opts.target.pid Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 04/13] perf kvm stat report: Enable the target.system_wide flag Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 05/13] perf kvm stat report: Unify the title bar output Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 06/13] perf tools: Allow to specify lib compile variable for spec usage Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 07/13] perf tools: Add feature checks to .gitignore Arnaldo Carvalho de Melo
2014-09-08 21:18 ` Arnaldo Carvalho de Melo [this message]
2014-09-08 21:18 ` [PATCH 09/13] perf tools: Add perf-with-kcore script Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 10/13] perf tools: Build programs to copy 32-bit compatibility VDSOs Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 11/13] perf tools: Add support for " Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 12/13] perf tools: Let default config be defined for a PMU Arnaldo Carvalho de Melo
2014-09-08 21:18 ` [PATCH 13/13] perf tools: Add perf_pmu__scan_file() Arnaldo Carvalho de Melo
2014-09-09  4:59 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar
2014-09-09  7:14   ` Adrian Hunter
2014-09-09  7:45     ` Stephane Eranian
2014-09-09  7:55       ` Adrian Hunter
2014-09-09 14:53     ` Ingo Molnar
2014-09-09  8:48 ` Adrian Hunter
2014-09-09 13:12   ` Arnaldo Carvalho de Melo
2014-09-09 14:54     ` Ingo Molnar
2014-09-09 15:59       ` Arnaldo Carvalho de Melo
2014-09-09 19:08   ` Arnaldo Carvalho de Melo
2014-09-10 13:19     ` Adrian Hunter

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=1410211089-28668-9-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=peterz@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.