From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
svens@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com,
hca@linux.ibm.com
Subject: Re: [PATCH] tools/perf: Fix perf test 7 Simple expression parser on s390
Date: Fri, 14 Jan 2022 11:51:38 -0300 [thread overview]
Message-ID: <YeGN+mT1yjJ60php@kernel.org> (raw)
In-Reply-To: <CAP-5=fXdOQUNDTXvt7GHRvu_7jyTPp_53f8_5DzDCXWCpWLtEQ@mail.gmail.com>
Em Wed, Nov 24, 2021 at 07:41:40AM -0800, Ian Rogers escreveu:
> On Wed, Nov 24, 2021 at 1:04 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
> >
> > Commit fdf1e29b6118 ("perf expr: Add metric literals for topology.")
> > fails on s390:
> > # ./perf test -Fv 7
> > ...
> > # FAILED tests/expr.c:173 #num_dies >= #num_packages
> > ---- end ----
> > Simple expression parser: FAILED!
> > #
> >
> > Investigating this issue leads to these functions:
> > build_cpu_topology()
> > +--> has_die_topology(void)
> > {
> > struct utsname uts;
> >
> > if (uname(&uts) < 0)
> > return false;
> > if (strncmp(uts.machine, "x86_64", 6))
> > return false;
> > ....
> > }
> >
> > which always returns false on s390. The caller build_cpu_topology()
> > checks has_die_topology() return value. On false the
> > the struct cpu_topology::die_cpu_list is not contructed and has zero
> > entries. This leads to the failing comparison: #num_dies >= #num_packages.
> > s390 of course has a positive number of packages.
> >
> > Fix this by adding s390 architecture to support CPU die list.
Thanks, applied.
- Arnaldo
> > Output after:
> > # ./perf test -Fv 7
> > 7: Simple expression parser :
> > --- start ---
> > division by zero
> > syntax error
> > ---- end ----
> > Simple expression parser: Ok
> > #
> > Cc: Ian Rogers <irogers@google.com>
> > Fixes: fdf1e29b6118 ("perf expr: Add metric literals for topology.")
> >
> > Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
>
> Reviewed-by: Ian Rogers <irogers@google.com>
>
> Thanks!
> Ian
>
> > ---
> > tools/perf/util/cputopo.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c
> > index 51b429c86f98..aad7a9e6e31b 100644
> > --- a/tools/perf/util/cputopo.c
> > +++ b/tools/perf/util/cputopo.c
> > @@ -165,7 +165,8 @@ static bool has_die_topology(void)
> > if (uname(&uts) < 0)
> > return false;
> >
> > - if (strncmp(uts.machine, "x86_64", 6))
> > + if (strncmp(uts.machine, "x86_64", 6) &&
> > + strncmp(uts.machine, "s390x", 5))
> > return false;
> >
> > scnprintf(filename, MAXPATHLEN, DIE_CPUS_FMT,
> > --
> > 2.31.1
> >
--
- Arnaldo
prev parent reply other threads:[~2022-01-14 14:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 9:03 [PATCH] tools/perf: Fix perf test 7 Simple expression parser on s390 Thomas Richter
2021-11-24 15:41 ` Ian Rogers
2021-11-25 1:06 ` Arnaldo Carvalho de Melo
2022-01-14 14:51 ` Arnaldo Carvalho de Melo [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=YeGN+mT1yjJ60php@kernel.org \
--to=acme@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sumanthk@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=tmricht@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.