lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fXdOQUNDTXvt7GHRvu_7jyTPp_53f8_5DzDCXWCpWLtEQ@mail.gmail.com>
Date:   Wed, 24 Nov 2021 07:41:40 -0800
From:   Ian Rogers <irogers@...gle.com>
To:     Thomas Richter <tmricht@...ux.ibm.com>
Cc:     linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        acme@...nel.org, svens@...ux.ibm.com, gor@...ux.ibm.com,
        sumanthk@...ux.ibm.com, hca@...ux.ibm.com
Subject: Re: [PATCH] tools/perf: Fix perf test 7 Simple expression parser on s390

On Wed, Nov 24, 2021 at 1:04 AM Thomas Richter <tmricht@...ux.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.
>
> 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@...gle.com>
> Fixes: fdf1e29b6118 ("perf expr: Add metric literals for topology.")
>
> Signed-off-by: Thomas Richter <tmricht@...ux.ibm.com>

Reviewed-by: Ian Rogers <irogers@...gle.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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ