summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-qoriq/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-qoriq/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch')
-rw-r--r--recipes-kernel/linux/linux-qoriq/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch239
1 files changed, 239 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-qoriq/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch b/recipes-kernel/linux/linux-qoriq/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch
new file mode 100644
index 00000000..b18ae803
--- /dev/null
+++ b/recipes-kernel/linux/linux-qoriq/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch
@@ -0,0 +1,239 @@
1From e4d9b04b973b2dbce7b42af95ea70d07da1c936d Mon Sep 17 00:00:00 2001
2From: Arnaldo Carvalho de Melo <acme@redhat.com>
3Date: Mon, 2 Mar 2020 12:09:38 -0300
4Subject: [PATCH] perf bench: Share some global variables to fix build with gcc
5 10
6
7Noticed with gcc 10 (fedora rawhide) that those variables were not being
8declared as static, so end up with:
9
10 ld: /tmp/build/perf/bench/epoll-wait.o:/git/perf/tools/perf/bench/epoll-wait.c:93: multiple definition of `end'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
11 ld: /tmp/build/perf/bench/epoll-wait.o:/git/perf/tools/perf/bench/epoll-wait.c:93: multiple definition of `start'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
12 ld: /tmp/build/perf/bench/epoll-wait.o:/git/perf/tools/perf/bench/epoll-wait.c:93: multiple definition of `runtime'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
13 ld: /tmp/build/perf/bench/epoll-ctl.o:/git/perf/tools/perf/bench/epoll-ctl.c:38: multiple definition of `end'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
14 ld: /tmp/build/perf/bench/epoll-ctl.o:/git/perf/tools/perf/bench/epoll-ctl.c:38: multiple definition of `start'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
15 ld: /tmp/build/perf/bench/epoll-ctl.o:/git/perf/tools/perf/bench/epoll-ctl.c:38: multiple definition of `runtime'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
16 make[4]: *** [/git/perf/tools/build/Makefile.build:145: /tmp/build/perf/bench/perf-in.o] Error 1
17
18Prefix those with bench__ and add them to bench/bench.h, so that we can
19share those on the tools needing to access those variables from signal
20handlers.
21
22Upstream-Status: Backport
23
24Acked-by: Thomas Gleixner <tglx@linutronix.de>
25Cc: Adrian Hunter <adrian.hunter@intel.com>
26Cc: Davidlohr Bueso <dave@stgolabs.net>
27Cc: Jiri Olsa <jolsa@kernel.org>
28Cc: Namhyung Kim <namhyung@kernel.org>
29Link: http://lore.kernel.org/lkml/20200303155811.GD13702@kernel.org
30Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
31---
32 tools/perf/bench/bench.h | 4 ++++
33 tools/perf/bench/epoll-ctl.c | 7 +++----
34 tools/perf/bench/epoll-wait.c | 11 +++++------
35 tools/perf/bench/futex-hash.c | 12 ++++++------
36 tools/perf/bench/futex-lock-pi.c | 11 +++++------
37 5 files changed, 23 insertions(+), 22 deletions(-)
38
39diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
40index fddb3ced9db6..4aa6de1aa67d 100644
41--- a/tools/perf/bench/bench.h
42+++ b/tools/perf/bench/bench.h
43@@ -2,6 +2,10 @@
44 #ifndef BENCH_H
45 #define BENCH_H
46
47+#include <sys/time.h>
48+
49+extern struct timeval bench__start, bench__end, bench__runtime;
50+
51 /*
52 * The madvise transparent hugepage constants were added in glibc
53 * 2.13. For compatibility with older versions of glibc, define these
54diff --git a/tools/perf/bench/epoll-ctl.c b/tools/perf/bench/epoll-ctl.c
55index bb617e568841..a7526c05df38 100644
56--- a/tools/perf/bench/epoll-ctl.c
57+++ b/tools/perf/bench/epoll-ctl.c
58@@ -35,7 +35,6 @@
59
60 static unsigned int nthreads = 0;
61 static unsigned int nsecs = 8;
62-struct timeval start, end, runtime;
63 static bool done, __verbose, randomize;
64
65 /*
66@@ -94,8 +93,8 @@ static void toggle_done(int sig __maybe_unused,
67 {
68 /* inform all threads that we're done for the day */
69 done = true;
70- gettimeofday(&end, NULL);
71- timersub(&end, &start, &runtime);
72+ gettimeofday(&bench__end, NULL);
73+ timersub(&bench__end, &bench__start, &bench__runtime);
74 }
75
76 static void nest_epollfd(void)
77@@ -361,7 +360,7 @@ int bench_epoll_ctl(int argc, const char **argv)
78
79 threads_starting = nthreads;
80
81- gettimeofday(&start, NULL);
82+ gettimeofday(&bench__start, NULL);
83
84 do_threads(worker, cpu);
85
86diff --git a/tools/perf/bench/epoll-wait.c b/tools/perf/bench/epoll-wait.c
87index 7af694437f4e..d1c5cb526b9f 100644
88--- a/tools/perf/bench/epoll-wait.c
89+++ b/tools/perf/bench/epoll-wait.c
90@@ -90,7 +90,6 @@
91
92 static unsigned int nthreads = 0;
93 static unsigned int nsecs = 8;
94-struct timeval start, end, runtime;
95 static bool wdone, done, __verbose, randomize, nonblocking;
96
97 /*
98@@ -276,8 +275,8 @@ static void toggle_done(int sig __maybe_unused,
99 {
100 /* inform all threads that we're done for the day */
101 done = true;
102- gettimeofday(&end, NULL);
103- timersub(&end, &start, &runtime);
104+ gettimeofday(&bench__end, NULL);
105+ timersub(&bench__end, &bench__start, &bench__runtime);
106 }
107
108 static void print_summary(void)
109@@ -287,7 +286,7 @@ static void print_summary(void)
110
111 printf("\nAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
112 avg, rel_stddev_stats(stddev, avg),
113- (int) runtime.tv_sec);
114+ (int)bench__runtime.tv_sec);
115 }
116
117 static int do_threads(struct worker *worker, struct perf_cpu_map *cpu)
118@@ -479,7 +478,7 @@ int bench_epoll_wait(int argc, const char **argv)
119
120 threads_starting = nthreads;
121
122- gettimeofday(&start, NULL);
123+ gettimeofday(&bench__start, NULL);
124
125 do_threads(worker, cpu);
126
127@@ -519,7 +518,7 @@ int bench_epoll_wait(int argc, const char **argv)
128 qsort(worker, nthreads, sizeof(struct worker), cmpworker);
129
130 for (i = 0; i < nthreads; i++) {
131- unsigned long t = worker[i].ops/runtime.tv_sec;
132+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
133
134 update_stats(&throughput_stats, t);
135
136diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
137index 8ba0c3330a9a..21776862e940 100644
138--- a/tools/perf/bench/futex-hash.c
139+++ b/tools/perf/bench/futex-hash.c
140@@ -37,7 +37,7 @@ static unsigned int nfutexes = 1024;
141 static bool fshared = false, done = false, silent = false;
142 static int futex_flag = 0;
143
144-struct timeval start, end, runtime;
145+struct timeval bench__start, bench__end, bench__runtime;
146 static pthread_mutex_t thread_lock;
147 static unsigned int threads_starting;
148 static struct stats throughput_stats;
149@@ -103,8 +103,8 @@ static void toggle_done(int sig __maybe_unused,
150 {
151 /* inform all threads that we're done for the day */
152 done = true;
153- gettimeofday(&end, NULL);
154- timersub(&end, &start, &runtime);
155+ gettimeofday(&bench__end, NULL);
156+ timersub(&bench__end, &bench__start, &bench__runtime);
157 }
158
159 static void print_summary(void)
160@@ -114,7 +114,7 @@ static void print_summary(void)
161
162 printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
163 !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg),
164- (int) runtime.tv_sec);
165+ (int)bench__runtime.tv_sec);
166 }
167
168 int bench_futex_hash(int argc, const char **argv)
169@@ -161,7 +161,7 @@ int bench_futex_hash(int argc, const char **argv)
170
171 threads_starting = nthreads;
172 pthread_attr_init(&thread_attr);
173- gettimeofday(&start, NULL);
174+ gettimeofday(&bench__start, NULL);
175 for (i = 0; i < nthreads; i++) {
176 worker[i].tid = i;
177 worker[i].futex = calloc(nfutexes, sizeof(*worker[i].futex));
178@@ -204,7 +204,7 @@ int bench_futex_hash(int argc, const char **argv)
179 pthread_mutex_destroy(&thread_lock);
180
181 for (i = 0; i < nthreads; i++) {
182- unsigned long t = worker[i].ops/runtime.tv_sec;
183+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
184 update_stats(&throughput_stats, t);
185 if (!silent) {
186 if (nfutexes == 1)
187diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
188index d0cae8125423..30d97121dc4f 100644
189--- a/tools/perf/bench/futex-lock-pi.c
190+++ b/tools/perf/bench/futex-lock-pi.c
191@@ -37,7 +37,6 @@ static bool silent = false, multi = false;
192 static bool done = false, fshared = false;
193 static unsigned int nthreads = 0;
194 static int futex_flag = 0;
195-struct timeval start, end, runtime;
196 static pthread_mutex_t thread_lock;
197 static unsigned int threads_starting;
198 static struct stats throughput_stats;
199@@ -64,7 +63,7 @@ static void print_summary(void)
200
201 printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
202 !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg),
203- (int) runtime.tv_sec);
204+ (int)bench__runtime.tv_sec);
205 }
206
207 static void toggle_done(int sig __maybe_unused,
208@@ -73,8 +72,8 @@ static void toggle_done(int sig __maybe_unused,
209 {
210 /* inform all threads that we're done for the day */
211 done = true;
212- gettimeofday(&end, NULL);
213- timersub(&end, &start, &runtime);
214+ gettimeofday(&bench__end, NULL);
215+ timersub(&bench__end, &bench__start, &bench__runtime);
216 }
217
218 static void *workerfn(void *arg)
219@@ -185,7 +184,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
220
221 threads_starting = nthreads;
222 pthread_attr_init(&thread_attr);
223- gettimeofday(&start, NULL);
224+ gettimeofday(&bench__start, NULL);
225
226 create_threads(worker, thread_attr, cpu);
227 pthread_attr_destroy(&thread_attr);
228@@ -211,7 +210,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
229 pthread_mutex_destroy(&thread_lock);
230
231 for (i = 0; i < nthreads; i++) {
232- unsigned long t = worker[i].ops/runtime.tv_sec;
233+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
234
235 update_stats(&throughput_stats, t);
236 if (!silent)
237--
2382.17.1
239