public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: eranian@google.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
	andi@firstfloor.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 3/3] perf tool: Allow wildcard in PMU name
Date: Wed, 12 Sep 2012 09:30:19 +0800	[thread overview]
Message-ID: <504FE5AB.4060406@intel.com> (raw)
In-Reply-To: <20120911140549.GC3800@krava.brq.redhat.com>

On 09/11/2012 10:05 PM, Jiri Olsa wrote:
> On Mon, Sep 10, 2012 at 03:53:51PM +0800, Yan, Zheng wrote:
>> From: "Yan, Zheng" <zheng.z.yan@intel.com>
>>
> 
> SNIP
> 
>> +int parse_events_add_pmu(struct list_head **_list, int *idx,
>>  			 char *name, struct list_head *head_config)
>>  {
>>  	struct perf_event_attr attr;
>> -	struct perf_pmu *pmu;
>> +	struct list_head *list;
>> +	struct perf_pmu *pmu = NULL;
>> +	struct perf_evsel *evsel, *first = NULL;
>> +	int orig_idx = *idx;
>>  
>> -	pmu = perf_pmu__find(name);
>> -	if (!pmu)
>> -		return -EINVAL;
>> +	list = malloc(sizeof(*list));
>> +	if (!list)
>> +		return -ENOMEM;
>> +	INIT_LIST_HEAD(list);
> 
> list should be allocated only if (!*_list)) same as in add_event function
> 
> I haven't test, but I think you'll leak/loose events if there's another pmu
> event defined after ','
> 

I think *_list is always NULL, because the code in parse-event.y is:

---
PE_NAME '/' event_config '/'
{
	struct parse_events_data__events *data = _data;
	struct list_head *list = NULL;

	ABORT_ON(parse_events_add_pmu(&list, &data->idx, $1, $3));
	parse_events__free_terms($3);
	$$ = list;
}

---

Regards
Yan, Zheng

  reply	other threads:[~2012-09-12  1:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10  7:53 [RFC PATCH 1/3] perf: Add cpumask for uncore pmu Yan, Zheng
2012-09-10  7:53 ` [RFC PATCH 1/3] perf/x86: " Yan, Zheng
2012-09-19 15:26   ` [tip:perf/core] " tip-bot for Yan, Zheng
2012-09-10  7:53 ` [RFC PATCH 2/3] perf tool: Make perf-stat check PMU cpumask file Yan, Zheng
2012-09-19 15:26   ` [tip:perf/core] perf stat: Check " tip-bot for Yan, Zheng
2012-09-10  7:53 ` [RFC PATCH 3/3] perf tool: Allow wildcard in PMU name Yan, Zheng
2012-09-11 13:50   ` Jiri Olsa
2012-09-11 14:05   ` Jiri Olsa
2012-09-12  1:30     ` Yan, Zheng [this message]
2012-09-12  9:03       ` Jiri Olsa
2012-09-11 14:27   ` Jiri Olsa
2012-09-17 15:36     ` Arnaldo Carvalho de Melo
2012-09-18  3:11       ` Yan, Zheng
2012-09-10 16:34 ` [RFC PATCH 1/3] perf: Add cpumask for uncore pmu Peter Zijlstra
2012-09-10 23:10   ` Arnaldo Carvalho de Melo

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=504FE5AB.4060406@intel.com \
    --to=zheng.z.yan@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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