]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.181/perf-bench-numa-add-define-for-rusage_thread-if-not-.patch
Linux 4.9.181
[thirdparty/kernel/stable-queue.git] / releases / 4.4.181 / perf-bench-numa-add-define-for-rusage_thread-if-not-.patch
1 From 7589a886eef9b660d7bc35d58597ffb0972223f6 Mon Sep 17 00:00:00 2001
2 From: Arnaldo Carvalho de Melo <acme@redhat.com>
3 Date: Thu, 25 Apr 2019 18:36:51 -0300
4 Subject: perf bench numa: Add define for RUSAGE_THREAD if not present
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 [ Upstream commit bf561d3c13423fc54daa19b5d49dc15fafdb7acc ]
10
11 While cross building perf to the ARC architecture on a fedora 30 host,
12 we were failing with:
13
14 CC /tmp/build/perf/bench/numa.o
15 bench/numa.c: In function ‘worker_thread’:
16 bench/numa.c:1261:12: error: ‘RUSAGE_THREAD’ undeclared (first use in this function); did you mean ‘SIGEV_THREAD’?
17 getrusage(RUSAGE_THREAD, &rusage);
18 ^~~~~~~~~~~~~
19 SIGEV_THREAD
20 bench/numa.c:1261:12: note: each undeclared identifier is reported only once for each function it appears in
21
22 [perfbuilder@60d5802468f6 perf]$ /arc_gnu_2019.03-rc1_prebuilt_uclibc_le_archs_linux_install/bin/arc-linux-gcc --version | head -1
23 arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
24 [perfbuilder@60d5802468f6 perf]$
25
26 Trying to reproduce a report by Vineet, I noticed that, with just
27 cross-built zlib and numactl libraries, I ended up with the above
28 failure.
29
30 So, since RUSAGE_THREAD is available as a define, check for that and
31 numactl libraries, I ended up with the above failure.
32
33 So, since RUSAGE_THREAD is available as a define in the system headers,
34 check if it is defined in the 'perf bench numa' sources and define it if
35 not.
36
37 Now it builds and I have to figure out if the problem reported by Vineet
38 only takes place if we have libelf or some other library available.
39
40 Cc: Arnd Bergmann <arnd@arndb.de>
41 Cc: Jiri Olsa <jolsa@kernel.org>
42 Cc: linux-snps-arc@lists.infradead.org
43 Cc: Namhyung Kim <namhyung@kernel.org>
44 Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
45 Link: https://lkml.kernel.org/n/tip-2wb4r1gir9xrevbpq7qp0amk@git.kernel.org
46 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
47 Signed-off-by: Sasha Levin <sashal@kernel.org>
48 ---
49 tools/perf/bench/numa.c | 4 ++++
50 1 file changed, 4 insertions(+)
51
52 diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
53 index 73d192f57dc34..df41deed0320e 100644
54 --- a/tools/perf/bench/numa.c
55 +++ b/tools/perf/bench/numa.c
56 @@ -32,6 +32,10 @@
57 #include <numa.h>
58 #include <numaif.h>
59
60 +#ifndef RUSAGE_THREAD
61 +# define RUSAGE_THREAD 1
62 +#endif
63 +
64 /*
65 * Regular printout to the terminal, supressed if -q is specified:
66 */
67 --
68 2.20.1
69