File perf-tools-Fix-SMT-detection-fast-read-path.patch of Package perf
46
1
From: Ian Rogers <irogers@google.com>
2
Date: Tue, 23 Nov 2021 16:12:29 -0800
3
Subject: perf tools: Fix SMT detection fast read path
4
Git-commit: 4ffbe87e2d5b53bcb0213d8650bbe70bf942de6a
5
Patch-mainline: v5.16-rc5
6
References: git-fixes
7
8
sysfs__read_int() returns 0 on success, and so the fast read path was
9
always failing.
10
11
Fixes: bb629484d924118e ("perf tools: Simplify checking if SMT is active.")
12
Signed-off-by: Ian Rogers <irogers@google.com>
13
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
14
Cc: Andi Kleen <ak@linux.intel.com>
15
Cc: Jiri Olsa <jolsa@redhat.com>
16
Cc: John Garry <john.garry@huawei.com>
17
Cc: Kajol Jain <kjain@linux.ibm.com>
18
Cc: Kan Liang <kan.liang@linux.intel.com>
19
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
20
Cc: Mark Rutland <mark.rutland@arm.com>
21
Cc: Namhyung Kim <namhyung@kernel.org>
22
Cc: Paul Clarke <pc@us.ibm.com>
23
Cc: Peter Zijlstra <peterz@infradead.org>
24
Cc: Stephane Eranian <eranian@google.com>
25
Link: http://lore.kernel.org/lkml/20211124001231.3277836-2-irogers@google.com
26
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
27
Signed-off-by: Tony Jones <tonyj@suse.de>
28
---
29
tools/perf/util/smt.c | 2 +-
30
1 file changed, 1 insertion(+), 1 deletion(-)
31
32
diff --git a/tools/perf/util/smt.c b/tools/perf/util/smt.c
33
index 20bacd5972ad..34f1b1b1176c 100644
34
--- a/tools/perf/util/smt.c
35
+++ b/tools/perf/util/smt.c
36
37
if (cached)
38
return cached_result;
39
40
- if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) > 0)
41
+ if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) >= 0)
42
goto done;
43
44
ncpu = sysconf(_SC_NPROCESSORS_CONF);
45
46