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

From: Ian Rogers
Date: Tue Nov 23 2021 - 19:12:40 EST


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>
---
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