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: <680f2d5d146a38083a28198f1a8a3694654bf8f8.camel@maquefel.me>
Date:   Tue, 16 May 2023 13:28:50 +0300
From:   Nikita Shubin <nikita.shubin@...uefel.me>
To:     Inochi Amaoto <inochiama@...look.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Nikita Shubin <n.shubin@...ro.com>
Cc:     linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH 1/2] perf tools riscv: Allow get_cpuid return empty
 MARCH and MIMP

Hello Inochi Amaoto!

On Tue, 2023-05-16 at 10:37 +0800, Inochi Amaoto wrote:
> The T-HEAD C9xx series CPU only has MVENDOR defined, and left MARCH
> and MIMP unimplemented.

According to the docs you can still read them, but it's hardwired to
64h0.

How it's supposed to distinguish c906 and c910 for example ?

> 
> To make perf support T-HEAD C9xx events. remove the restriction of
> the MARCH and MIMP.
> 
> Signed-off-by: Inochi Amaoto <inochiama@...look.com>
> ---
>  tools/perf/arch/riscv/util/header.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/tools/perf/arch/riscv/util/header.c
> b/tools/perf/arch/riscv/util/header.c
> index 4a41856938a8..031899c627f6 100644
> --- a/tools/perf/arch/riscv/util/header.c
> +++ b/tools/perf/arch/riscv/util/header.c
> @@ -55,18 +55,13 @@ static char *_get_cpuid(void)
>                                 goto free;
>                 } else if (!strncmp(line, CPUINFO_MARCH,
> strlen(CPUINFO_MARCH))) {
>                         marchid = _get_field(line);
> -                       if (!marchid)
> -                               goto free;
>                 } else if (!strncmp(line, CPUINFO_MIMP,
> strlen(CPUINFO_MIMP))) {
>                         mimpid = _get_field(line);
> -                       if (!mimpid)
> -                               goto free;
> -
>                         break;
>                 }
>         }

What does /proc/cpuinfo shows on c9xx ? Why can't we use zeroes ?

>  
> -       if (!mvendorid || !marchid || !mimpid)
> +       if (!mvendorid)
>                 goto free;
>  
>         if (asprintf(&cpuid, "%s-%s-%s", mvendorid, marchid, mimpid)
> < 0)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ