]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
ca88558e6b3b92fb88b40f1805dfc151e55881cf
[thirdparty/kernel/stable-queue.git] /
1 From d08c84e01afa7a7eee6badab25d5420fa847f783 Mon Sep 17 00:00:00 2001
2 From: Arnaldo Carvalho de Melo <acme@redhat.com>
3 Date: Wed, 14 Jul 2021 13:06:38 -0300
4 Subject: perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE)
5
6 From: Arnaldo Carvalho de Melo <acme@redhat.com>
7
8 commit d08c84e01afa7a7eee6badab25d5420fa847f783 upstream.
9
10 In fedora rawhide the PTHREAD_STACK_MIN define may end up expanded to a
11 sysconf() call, and that will return 'long int', breaking the build:
12
13 45 fedora:rawhide : FAIL gcc version 11.1.1 20210623 (Red Hat 11.1.1-6) (GCC)
14 builtin-sched.c: In function 'create_tasks':
15 /git/perf-5.14.0-rc1/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
16 43 | (void) (&_max1 == &_max2); \
17 | ^~
18 builtin-sched.c:673:34: note: in expansion of macro 'max'
19 673 | (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
20 | ^~~
21 cc1: all warnings being treated as errors
22
23 $ grep __sysconf /usr/include/*/*.h
24 /usr/include/bits/pthread_stack_min-dynamic.h:extern long int __sysconf (int __name) __THROW;
25 /usr/include/bits/pthread_stack_min-dynamic.h:# define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE)
26 /usr/include/bits/time.h:extern long int __sysconf (int);
27 /usr/include/bits/time.h:# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
28 $
29
30 So cast it to int to cope with that.
31
32 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
33 Cc: Guenter Roeck <linux@roeck-us.net>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 ---
36 tools/perf/builtin-sched.c | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39 --- a/tools/perf/builtin-sched.c
40 +++ b/tools/perf/builtin-sched.c
41 @@ -655,7 +655,7 @@ static void create_tasks(struct perf_sch
42 err = pthread_attr_init(&attr);
43 BUG_ON(err);
44 err = pthread_attr_setstacksize(&attr,
45 - (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
46 + (size_t) max(16 * 1024, (int)PTHREAD_STACK_MIN));
47 BUG_ON(err);
48 err = pthread_mutex_lock(&sched->start_work_mutex);
49 BUG_ON(err);