]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
9abaef25d1b46fa56b2059a2ea2ed9fd204c88ac
[thirdparty/kernel/stable-queue.git] /
1 From 3d1d57debee2d342a47615707588b96658fabb85 Mon Sep 17 00:00:00 2001
2 From: Arnaldo Carvalho de Melo <acme@redhat.com>
3 Date: Tue, 30 Nov 2021 10:12:41 -0300
4 Subject: tools build: Remove needless libpython-version feature check that breaks test-all fast path
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Arnaldo Carvalho de Melo <acme@redhat.com>
10
11 commit 3d1d57debee2d342a47615707588b96658fabb85 upstream.
12
13 Since 66dfdff03d196e51 ("perf tools: Add Python 3 support") we don't use
14 the tools/build/feature/test-libpython-version.c version in any Makefile
15 feature check:
16
17 $ find tools/ -type f | xargs grep feature-libpython-version
18 $
19
20 The only place where this was used was removed in 66dfdff03d196e51:
21
22 - ifneq ($(feature-libpython-version), 1)
23 - $(warning Python 3 is not yet supported; please set)
24 - $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
25 - $(warning If you also have Python 2 installed, then)
26 - $(warning try something like:)
27 - $(warning $(and ,))
28 - $(warning $(and ,) make PYTHON=python2)
29 - $(warning $(and ,))
30 - $(warning Otherwise, disable Python support entirely:)
31 - $(warning $(and ,))
32 - $(warning $(and ,) make NO_LIBPYTHON=1)
33 - $(warning $(and ,))
34 - $(error $(and ,))
35 - else
36 - LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
37 - EXTLIBS += $(PYTHON_EMBED_LIBADD)
38 - LANG_BINDINGS += $(obj-perf)python/perf.so
39 - $(call detected,CONFIG_LIBPYTHON)
40 - endif
41
42 And nowadays we either build with PYTHON=python3 or just install the
43 python3 devel packages and perf will build against it.
44
45 But the leftover feature-libpython-version check made the fast path
46 feature detection to break in all cases except when python2 devel files
47 were installed:
48
49 $ rpm -qa | grep python.*devel
50 python3-devel-3.9.7-1.fc34.x86_64
51 $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
52 $ make -C tools/perf O=/tmp/build/perf install-bin
53 make: Entering directory '/var/home/acme/git/perf/tools/perf'
54 BUILD: Doing 'make -j32' parallel build
55 HOSTCC /tmp/build/perf/fixdep.o
56 <SNIP>
57 $ cat /tmp/build/perf/feature/test-all.make.output
58 In file included from test-all.c:18:
59 test-libpython-version.c:5:10: error: #error
60 5 | #error
61 | ^~~~~
62 $ ldd ~/bin/perf | grep python
63 libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007fda6dbcf000)
64 $
65
66 As python3 is the norm these days, fix this by just removing the unused
67 feature-libpython-version feature check, making the test-all fast path
68 to work with the common case.
69
70 With this:
71
72 $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
73 $ make -C tools/perf O=/tmp/build/perf install-bin |& head
74 make: Entering directory '/var/home/acme/git/perf/tools/perf'
75 BUILD: Doing 'make -j32' parallel build
76 HOSTCC /tmp/build/perf/fixdep.o
77 HOSTLD /tmp/build/perf/fixdep-in.o
78 LINK /tmp/build/perf/fixdep
79
80 Auto-detecting system features:
81 ... dwarf: [ on ]
82 ... dwarf_getlocations: [ on ]
83 ... glibc: [ on ]
84 $ ldd ~/bin/perf | grep python
85 libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007f58800b0000)
86 $ cat /tmp/build/perf/feature/test-all.make.output
87 $
88
89 Reviewed-by: James Clark <james.clark@arm.com>
90 Fixes: 66dfdff03d196e51 ("perf tools: Add Python 3 support")
91 Cc: Adrian Hunter <adrian.hunter@intel.com>
92 Cc: Ian Rogers <irogers@google.com>
93 Cc: Jaroslav Škarvada <jskarvad@redhat.com>
94 Cc: Jiri Olsa <jolsa@kernel.org>
95 Cc: Namhyung Kim <namhyung@kernel.org>
96 Link: https://lore.kernel.org/lkml/YaYmeeC6CS2b8OSz@kernel.org
97 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
98 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
99 ---
100 tools/build/Makefile.feature | 1 -
101 tools/build/feature/Makefile | 4 ----
102 tools/build/feature/test-all.c | 5 -----
103 tools/build/feature/test-libpython-version.c | 11 -----------
104 tools/perf/Makefile.config | 2 --
105 5 files changed, 23 deletions(-)
106 delete mode 100644 tools/build/feature/test-libpython-version.c
107
108 --- a/tools/build/Makefile.feature
109 +++ b/tools/build/Makefile.feature
110 @@ -48,7 +48,6 @@ FEATURE_TESTS_BASIC :=
111 numa_num_possible_cpus \
112 libperl \
113 libpython \
114 - libpython-version \
115 libslang \
116 libslang-include-subdir \
117 libtraceevent \
118 --- a/tools/build/feature/Makefile
119 +++ b/tools/build/feature/Makefile
120 @@ -32,7 +32,6 @@ FILES=
121 test-numa_num_possible_cpus.bin \
122 test-libperl.bin \
123 test-libpython.bin \
124 - test-libpython-version.bin \
125 test-libslang.bin \
126 test-libslang-include-subdir.bin \
127 test-libtraceevent.bin \
128 @@ -223,9 +222,6 @@ $(OUTPUT)test-libperl.bin:
129 $(OUTPUT)test-libpython.bin:
130 $(BUILD) $(FLAGS_PYTHON_EMBED)
131
132 -$(OUTPUT)test-libpython-version.bin:
133 - $(BUILD)
134 -
135 $(OUTPUT)test-libbfd.bin:
136 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
137
138 --- a/tools/build/feature/test-all.c
139 +++ b/tools/build/feature/test-all.c
140 @@ -14,10 +14,6 @@
141 # include "test-libpython.c"
142 #undef main
143
144 -#define main main_test_libpython_version
145 -# include "test-libpython-version.c"
146 -#undef main
147 -
148 #define main main_test_libperl
149 # include "test-libperl.c"
150 #undef main
151 @@ -177,7 +173,6 @@
152 int main(int argc, char *argv[])
153 {
154 main_test_libpython();
155 - main_test_libpython_version();
156 main_test_libperl();
157 main_test_hello();
158 main_test_libelf();
159 --- a/tools/build/feature/test-libpython-version.c
160 +++ /dev/null
161 @@ -1,11 +0,0 @@
162 -// SPDX-License-Identifier: GPL-2.0
163 -#include <Python.h>
164 -
165 -#if PY_VERSION_HEX >= 0x03000000
166 - #error
167 -#endif
168 -
169 -int main(void)
170 -{
171 - return 0;
172 -}
173 --- a/tools/perf/Makefile.config
174 +++ b/tools/perf/Makefile.config
175 @@ -271,8 +271,6 @@ endif
176
177 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
178 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
179 -FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
180 -FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
181
182 FEATURE_CHECK_LDFLAGS-libaio = -lrt
183