public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: "Jin, Yao" <yao.jin@linux.intel.com>
Cc: John Garry <john.garry@huawei.com>, Jiri Olsa <jolsa@redhat.com>,
	jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com,
	"irogers@google.com" <irogers@google.com>
Subject: Re: [PATCH] perf parse-events: Use strcmp to compare the PMU name
Date: Thu, 7 May 2020 13:46:42 -0300	[thread overview]
Message-ID: <20200507164642.GD31109@kernel.org> (raw)
In-Reply-To: <8685d584-1d28-4648-8d85-2ea637f3c695@linux.intel.com>

Em Thu, Apr 30, 2020 at 09:38:34PM +0800, Jin, Yao escreveu:
> Hi John, Jiri,
> 
> On 4/30/2020 7:48 PM, John Garry wrote:
> > On 30/04/2020 12:15, Jiri Olsa wrote:
> > 
> > +
> > 
> > > On Thu, Apr 30, 2020 at 09:54:18AM +0100, John Garry wrote:
> > > > On 30/04/2020 09:45, Jiri Olsa wrote:
> > > > > On Thu, Apr 30, 2020 at 08:36:18AM +0800, Jin Yao wrote:
> > > > > > A big uncore event group is split into multiple small groups which
> > > > > > only include the uncore events from the same PMU. This has been
> > > > > > supported in the commit 3cdc5c2cb924a ("perf parse-events: Handle
> > > > > > uncore event aliases in small groups properly").
> > > > > > 
> > > > > > 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.
> > > > > > But now it only compares the pointer of pmu_name
> > > > > > (leader->pmu_name == evsel->pmu_name).
> > > > > > 
> > > > > > If we use "perf stat -M LLC_MISSES.PCIE_WRITE -a" on cascadelakex,
> > > > > > the event list is:
> > > > > > 
> > > > > > evsel->name                    evsel->pmu_name
> > > > > > ---------------------------------------------------------------
> > > > > > unc_iio_data_req_of_cpu.mem_write.part0        uncore_iio_4 (as leader)
> > > > > > unc_iio_data_req_of_cpu.mem_write.part0        uncore_iio_2
> > > > > > unc_iio_data_req_of_cpu.mem_write.part0        uncore_iio_0
> > > > > > unc_iio_data_req_of_cpu.mem_write.part0        uncore_iio_5
> > > > > > unc_iio_data_req_of_cpu.mem_write.part0        uncore_iio_3
> > > > > > unc_iio_data_req_of_cpu.mem_write.part0        uncore_iio_1
> > > > > > unc_iio_data_req_of_cpu.mem_write.part1        uncore_iio_4
> > > > > > ......
> > > > > > 
> > > > > > For the event "unc_iio_data_req_of_cpu.mem_write.part1" with
> > > > > > "uncore_iio_4", it should be the event from PMU "uncore_iio_4".
> > > > > > It's not a new leader for this PMU.
> > > > > > 
> > > > > > But if we use "(leader->pmu_name == evsel->pmu_name)", the check
> > > > > > would be failed and the event is stored to leaders[] as a new
> > > > > > PMU leader.
> > > > > > 
> > > > > > So this patch uses strcmp to compare the PMU name between events.
> > > > > > 
> > > > > > Fixes: 3cdc5c2cb924a ("perf parse-events: Handle uncore
> > > > > > event aliases in small groups properly")
> > > > > > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> > > > > 
> > > > > looks good, any chance we could have automated test
> > > > > for this uncore leader setup logic? like maybe the way
> > > > > John did the pmu-events tests? like test will trigger
> > > > > only when there's the pmu/events in the system
> > > > > 
> > > > > Acked-by: Jiri Olsa <jolsa@redhat.com>
> > > > > 
> > > > > thanks,
> > > > > jirka
> > > > 
> > > > Hi jirka,
> > > > 
> > > > JFYI, this is effectively the same patch as I mentioned to you, which was a
> > > > fix for the same WARN:
> > > > 
> > > > https://lore.kernel.org/linux-arm-kernel/1587120084-18990-2-git-send-email-john.garry@huawei.com/
> > > > 
> > > > 
> > > > but I found that it "fixed" d4953f7ef1a2 ("perf parse-events: Fix 3 use
> > > > after frees found with clang ASANutil/parse-events.c"), based on bisect
> > > > breakage
> > > 
> > > hum right.. sorry I did not recalled that, there's
> > > also the warn removal in here, could you guys also
> > > plz sync on the fixes clauses?
> > 
> > I just thought that it fixes d4953f7ef1a2, as I found that the pointer
> > equality fails from that commit. I assume the parse-events code was
> > sound before then (in that regard). That's all I know :)
> > 
> > Thanks!
> > 
> 
> For 3cdc5c2cb924a, I just think it should use strcmp for pmu_name comparison
> rather than using pointer. But I'm OK to add d4953f7ef1a2 in fixes clauses.
> :)

So, I'm keeping Ian's patch, as I just applied it, and replaced the
fixes clause to:

Fixes: d4953f7ef1a2 ("perf parse-events: Fix 3 use after frees found with clang ASAN")


Would this be ok? Or does John's fix has something else in it (I haven't
checked).

- Arnaldo

  reply	other threads:[~2020-05-07 16:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  0:36 [PATCH] perf parse-events: Use strcmp to compare the PMU name Jin Yao
2020-04-30  8:45 ` Jiri Olsa
2020-04-30  8:54   ` John Garry
2020-04-30 11:15     ` Jiri Olsa
2020-04-30 11:48       ` John Garry
2020-04-30 13:38         ` Jin, Yao
2020-05-07 16:46           ` Arnaldo Carvalho de Melo [this message]
2020-05-07 17:24             ` Ian Rogers
2020-04-30 13:45   ` Jin, Yao
2020-04-30 15:32     ` Jiri Olsa
2020-05-06 22:45       ` Ian Rogers
2020-05-06 23:46         ` Arnaldo Carvalho de Melo
2020-05-07 16:44   ` 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=20200507164642.GD31109@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.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