From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, mingo@redhat.com, peterz@infradead.org,
linux-kernel@vger.kernel.org, namhyung@kernel.org,
ganapatrao.kulkarni@cavium.com, zhangshaokun@hisilicon.com,
yao.jin@linux.intel.com, will.deacon@arm.com, ak@linux.intel.com,
agustinv@codeaurora.org
Subject: Re: [V4 PATCH] perf parse-events: Specially handle uncore event alias in small groups
Date: Tue, 1 May 2018 08:31:02 -0400 [thread overview]
Message-ID: <d2b94d2c-1bbb-bf7c-2aa6-102660bf4a7d@linux.intel.com> (raw)
In-Reply-To: <20180501091512.GA4813@krava>
>> +static int
>> +parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,
>> + struct parse_events_state *parse_state)
>> +{
>> + struct perf_evsel *evsel, *leader;
>> + uintptr_t *leaders;
>> + bool is_leader = true;
>> + int i, nr_pmu = 0, total_members, ret = 0;
>> +
>> + leader = list_first_entry(list, struct perf_evsel, node);
>> + evsel = list_last_entry(list, struct perf_evsel, node);
>> + total_members = evsel->idx - leader->idx + 1;
>> +
>> + leaders = calloc(total_members, sizeof(uintptr_t));
>> + if (!leaders)
>> + return 0;
>
> I see.. I meant we should return -ENOMEM in here, but
> we don't check it in the called anyway.. so perhaps
>
> if (WARN_ON(!leaders))
> return 0;
>
Sure. I will change it in V5.
>
>> +
>> + __evlist__for_each_entry(list, evsel) {
>> +
>> + /* Only split the uncore group which members use alias */
>> + if (!evsel->use_uncore_alias)
>> + goto out;
>> +
>> + /* The events must be from the same uncore block */
>> + if (!is_same_uncore_block(leader->pmu_name, evsel->pmu_name))
>> + goto out;
>> +
>> + if (!is_leader)
>> + continue;
>> + /*
>> + * If the event's PMU name starts to repeat, it must be a new
>> + * event. That can be used to distinguish the leader from
>> + * other members, even they have the same event name.
>> + */
>> + if ((leader != evsel) && (leader->pmu_name == evsel->pmu_name)) {
>> + is_leader = false;
>> + continue;
>> + }
>
> I still don't get why you don't 'break' in here.. you set is_leader to false,
> then the loop will never get pass the !is_leader condition above
>
All the members must use alias, and be from the same uncore block.
We have to go through the whole group to check the events.
Thanks,
Kan
prev parent reply other threads:[~2018-05-01 12:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 18:46 [V4 PATCH] perf parse-events: Specially handle uncore event alias in small groups kan.liang
2018-05-01 9:15 ` Jiri Olsa
2018-05-01 12:31 ` Liang, Kan [this message]
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=d2b94d2c-1bbb-bf7c-2aa6-102660bf4a7d@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=agustinv@codeaurora.org \
--cc=ak@linux.intel.com \
--cc=ganapatrao.kulkarni@cavium.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
--cc=yao.jin@linux.intel.com \
--cc=zhangshaokun@hisilicon.com \
/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