public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Robert Richter <robert.richter@amd.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
	eranian@google.com, paulus@samba.org, hpa@zytor.com,
	mingo@kernel.org, a.p.zijlstra@chello.nl, robert.richter@amd.com,
	fweisbec@gmail.com, tglx@linutronix.de,
	cjashfor@linux.vnet.ibm.com, mingo@elte.hu
Subject: [tip:perf/core] perf tools: Fix generation of pmu list
Date: Fri, 6 Jul 2012 03:58:57 -0700	[thread overview]
Message-ID: <tip-9bc8f9fe2c6e3778202c76ef85ef291567c00cb8@git.kernel.org> (raw)
In-Reply-To: <1339706321-8802-3-git-send-email-jolsa@redhat.com>

Commit-ID:  9bc8f9fe2c6e3778202c76ef85ef291567c00cb8
Gitweb:     http://git.kernel.org/tip/9bc8f9fe2c6e3778202c76ef85ef291567c00cb8
Author:     Robert Richter <robert.richter@amd.com>
AuthorDate: Thu, 14 Jun 2012 22:38:37 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 29 Jun 2012 13:31:27 -0300

perf tools: Fix generation of pmu list

The internal pmu list was never used. With each perf_pmu__find() call
the pmu structure was created new by parsing sysfs. Beside this it
caused memory leaks. We now keep all pmus by adding them to the list.

Also, pmu_lookup() should return pmus that do not expose the format
specifier in sysfs.

We need a valid internal pmu list in a later patch to iterate over all
pmus that exist in the system.

Signed-off-by: Robert Richter <robert.richter@amd.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1339706321-8802-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/pmu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 74d0948e..67715a4 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -72,7 +72,7 @@ static int pmu_format(char *name, struct list_head *format)
 		 "%s/bus/event_source/devices/%s/format", sysfs, name);
 
 	if (stat(path, &st) < 0)
-		return -1;
+		return 0;	/* no error if format does not exist */
 
 	if (pmu_format_parse(path, format))
 		return -1;
@@ -252,6 +252,7 @@ static struct perf_pmu *pmu_lookup(char *name)
 	list_splice(&aliases, &pmu->aliases);
 	pmu->name = strdup(name);
 	pmu->type = type;
+	list_add_tail(&pmu->list, &pmus);
 	return pmu;
 }
 

  reply	other threads:[~2012-07-06 10:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 20:38 [RFC 0/6] perf, tool: Allow to use hw events in PMU syntax Jiri Olsa
2012-06-14 20:38 ` [PATCH 1/6] perf, x86: Making hardware events tranlations sysfs available Jiri Olsa
2012-06-14 21:09   ` Peter Zijlstra
2012-06-14 21:36     ` Stephane Eranian
2012-06-15  7:29       ` Jiri Olsa
2012-06-15  7:32         ` Stephane Eranian
2012-06-15  7:43           ` Jiri Olsa
2012-06-15  7:46             ` Stephane Eranian
2012-06-15  9:26               ` Peter Zijlstra
2012-06-14 20:38 ` [PATCH 2/6] perf tools: Fix generation of pmu list Jiri Olsa
2012-07-06 10:58   ` tip-bot for Robert Richter [this message]
2012-06-14 20:38 ` [PATCH 3/6] perf, tool: Properly free format data Jiri Olsa
2012-06-14 20:38 ` [PATCH 4/6] perf, tool: Add events support for pmu Jiri Olsa
2012-06-29 16:36   ` Arnaldo Carvalho de Melo
2012-06-29 16:43     ` Jiri Olsa
2012-06-14 20:38 ` [PATCH 5/6] perf, tool: event parsing - split PE_VALUE_SYM to SW and HW tokens Jiri Olsa
2012-06-14 20:38 ` [PATCH 6/6] perf, tool: Support translate terms for hw events Jiri Olsa

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=tip-9bc8f9fe2c6e3778202c76ef85ef291567c00cb8@git.kernel.org \
    --to=robert.richter@amd.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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