Commit 4ffbe87e authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf tools: Fix SMT detection fast read path

sysfs__read_int() returns 0 on success, and so the fast read path was
always failing.

Fixes: bb629484 ("perf tools: Simplify checking if SMT is active.")
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20211124001231.3277836-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent cba43fcf
...@@ -15,7 +15,7 @@ int smt_on(void) ...@@ -15,7 +15,7 @@ int smt_on(void)
if (cached) if (cached)
return cached_result; 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; goto done;
ncpu = sysconf(_SC_NPROCESSORS_CONF); ncpu = sysconf(_SC_NPROCESSORS_CONF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment