Re: [PATCH v2 2/4] perf tools: Fix SMT not detected

From: Arnaldo Carvalho de Melo
Date: Thu Nov 25 2021 - 16:32:59 EST


Em Tue, Nov 23, 2021 at 04:12:29PM -0800, Ian Rogers escreveu:
> sysfs__read_int returns 0 on success, and so the fast read path was
> always failing.
>
> Fixes: bb629484d924 (perf tools: Simplify checking if SMT is active.)
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>

Thanks, applied to perf/urgent.

- Arnaldo

> ---
> tools/perf/util/smt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/smt.c b/tools/perf/util/smt.c
> index 20bacd5972ad..34f1b1b1176c 100644
> --- a/tools/perf/util/smt.c
> +++ b/tools/perf/util/smt.c
> @@ -15,7 +15,7 @@ int smt_on(void)
> if (cached)
> return cached_result;
>
> - if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) > 0)
> + if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) >= 0)
> goto done;
>
> ncpu = sysconf(_SC_NPROCESSORS_CONF);
> --
> 2.34.0.rc2.393.gf8c9666880-goog

--

- Arnaldo