From: Yicong Yang <yangyicong@huawei.com>
To: Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>
Cc: <yangyicong@hisilicon.com>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
<linux-perf-users@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] perf stat: Fix a segfault with --per-cluster --metric-only
Date: Fri, 28 Jun 2024 10:33:33 +0800 [thread overview]
Message-ID: <83aa958a-5bd6-06eb-06a4-39e51e2eb3b5@huawei.com> (raw)
In-Reply-To: <20240628000604.1296808-1-namhyung@kernel.org>
Hi Namhyung,
On 2024/6/28 8:06, Namhyung Kim wrote:
> The new --per-cluster option was added recently but it forgot to update
> the aggr_header fields which are used for --metric-only option. And it
> resulted in a segfault due to NULL string in fputs().
>
> Fixes: cbc917a1b03b ("perf stat: Support per-cluster aggregation")
> Cc: Yicong Yang <yangyicong@hisilicon.com>
Thanks for fixing this.
Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>
Tested on my cluster machine and this patch fixes the issue:
[root@localhost perf]# ./perf-before stat -M TopDownL1 --per-cluster --metric-only --timeout 100 -x ,
Segmentation fault (core dumped)
[root@localhost perf]# ./perf-after stat -M TopDownL1 --per-cluster --metric-only --timeout 100 -x ,
cluster,cpus,retiring,bad_speculation,backend_bound,frontend_bound,
S56-D0-CLS158,4,0.03,0.00,0.96,0.00,
[...]
So,
Tested-by: Yicong Yang <yangyicong@hisilicon.com>
Thanks.
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/stat-display.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index 91d2f7f65df7..186305fd2d0e 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -38,6 +38,7 @@
> static int aggr_header_lens[] = {
> [AGGR_CORE] = 18,
> [AGGR_CACHE] = 22,
> + [AGGR_CLUSTER] = 20,
> [AGGR_DIE] = 12,
> [AGGR_SOCKET] = 6,
> [AGGR_NODE] = 6,
> @@ -49,6 +50,7 @@ static int aggr_header_lens[] = {
> static const char *aggr_header_csv[] = {
> [AGGR_CORE] = "core,cpus,",
> [AGGR_CACHE] = "cache,cpus,",
> + [AGGR_CLUSTER] = "cluster,cpus,",
> [AGGR_DIE] = "die,cpus,",
> [AGGR_SOCKET] = "socket,cpus,",
> [AGGR_NONE] = "cpu,",
> @@ -60,6 +62,7 @@ static const char *aggr_header_csv[] = {
> static const char *aggr_header_std[] = {
> [AGGR_CORE] = "core",
> [AGGR_CACHE] = "cache",
> + [AGGR_CLUSTER] = "cluster",
> [AGGR_DIE] = "die",
> [AGGR_SOCKET] = "socket",
> [AGGR_NONE] = "cpu",
>
next prev parent reply other threads:[~2024-06-28 2:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 0:06 Namhyung Kim
2024-06-28 0:06 ` [PATCH v2 2/2] perf stat: Use field separator in the metric header Namhyung Kim
2024-06-28 2:33 ` Yicong Yang [this message]
2024-07-02 18:44 ` [PATCH v2 1/2] perf stat: Fix a segfault with --per-cluster --metric-only Namhyung Kim
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=83aa958a-5bd6-06eb-06a4-39e51e2eb3b5@huawei.com \
--to=yangyicong@huawei.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=yangyicong@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
all inboxes | Powered by JetHome®