From: Leo Yan <leo.yan@linaro.org>
To: Wei Li <liwei391@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Kim Phillips <kim.phillips@arm.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, James Clark <james.clark@arm.com>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
linux-arm-kernel@lists.infradead.org,
Mike Leach <mike.leach@linaro.org>
Subject: Re: [PATCH 1/2] perf tools: ARM SPE code cleanup
Date: Sun, 5 Jul 2020 13:05:27 +0800 [thread overview]
Message-ID: <20200705050527.GA14142@leoy-ThinkPad-X240s> (raw)
In-Reply-To: <20200623123141.27747-2-liwei391@huawei.com>
Hi Wei,
On Tue, Jun 23, 2020 at 08:31:40PM +0800, Wei Li wrote:
> Remove the useless check code to make it clear.
>
> Signed-off-by: Wei Li <liwei391@huawei.com>
> ---
> tools/perf/arch/arm/util/auxtrace.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c
> index 0a6e75b8777a..62b7b03d691a 100644
> --- a/tools/perf/arch/arm/util/auxtrace.c
> +++ b/tools/perf/arch/arm/util/auxtrace.c
> @@ -57,7 +57,7 @@ struct auxtrace_record
> struct evsel *evsel;
> bool found_etm = false;
> bool found_spe = false;
> - static struct perf_pmu **arm_spe_pmus = NULL;
> + static struct perf_pmu **arm_spe_pmus;
Here the 'static' should be removed as well.
Just for more complete background info, IIUC, at the beginning to
enable SPE's PMU event, since SPE is micro-architecture dependent
(though it's defined in ARMv8-ARM, but it might be different for
different ARM micro-architectures). So this is why here it uses
'static' for varaible "arm_spe_pmus", it wants to initialize the
variable with finding all SPE PMU structure at the first time when
invoke the function auxtrace_record__init(), and afterwards we can
reuse the variable "arm_spe_pmus" and without calling
find_all_arm_spe_pmus() anymore.
So I struggled to figure out what's good thing to do with multiple SPE
PMU events, and your change is good thing to me. The reason is:
- Firstly, the function auxtrace_record__init() will be invoked only
once, the variable "arm_spe_pmus" will not be used afterwards, thus
we don't need to check "arm_spe_pmus" is NULL or not;
- Another reason is, even though SPE is micro-architecture dependent,
but so far it only supports "statistical-profiling-extension-v1" and
we have no chance to use multiple SPE's PMU events in Perf command.
So after removing 'static' for varaible "arm_spe_pmus":
Reviewed-by: Leo Yan <leo.yan@linaro.org>
P.s. Sorry if it's my reason that James Clark's patch [1] has not been
merged in the mainline kernel and introduced duplicate efforts at here.
James's patch used similiar method to resolve this same issue.
[1] https://lkml.org/lkml/2019/12/20/293
> static int nr_spes = 0;
> int i = 0;
>
> @@ -65,9 +65,7 @@ struct auxtrace_record
> return NULL;
>
> cs_etm_pmu = perf_pmu__find(CORESIGHT_ETM_PMU_NAME);
> -
> - if (!arm_spe_pmus)
> - arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err);
> + arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err);
>
> evlist__for_each_entry(evlist, evsel) {
> if (cs_etm_pmu &&
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-07-05 5:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200623123141.27747-1-liwei391@huawei.com>
[not found] ` <20200623123141.27747-3-liwei391@huawei.com>
2020-07-02 23:03 ` [PATCH 2/2] perf tools: Fix record failure when mixed with ARM SPE event Mathieu Poirier
2020-07-03 4:06 ` liwei (GF)
2020-07-05 5:24 ` Leo Yan
[not found] ` <20200623123141.27747-2-liwei391@huawei.com>
2020-07-02 22:39 ` [PATCH 1/2] perf tools: ARM SPE code cleanup Mathieu Poirier
2020-07-05 5:05 ` Leo Yan [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=20200705050527.GA14142@leoy-ThinkPad-X240s \
--to=leo.yan@linaro.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=james.clark@arm.com \
--cc=jolsa@redhat.com \
--cc=kim.phillips@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liwei391@huawei.com \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=suzuki.poulose@arm.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