* arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail
@ 2024-12-05 14:45 Naresh Kamboju
2024-12-05 15:16 ` Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: Naresh Kamboju @ 2024-12-05 14:45 UTC (permalink / raw)
To: open list, lkft-triage, Linux Regressions, Linux ARM,
netfilter-devel
Cc: Arnd Bergmann, Dan Carpenter, Anders Roxell, Johannes Berg, toke,
Al Viro, kernel, kees
The arm64 build started failing from Linux next-20241203 tag with gcc-8
due to following build warnings / errors.
First seen on Linux next-20241203 tag
GOOD: Linux next-20241128 tag
BAD: Linux next-20241203 tag and next-20241205 tag
* arm64, build
- gcc-8-defconfig
- gcc-8-defconfig-40bc7ee5
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Build log:
===========
net/netfilter/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_init':
include/linux/compiler_types.h:542:38: error: call to
'__compiletime_assert_1050' declared with attribute error: clamp() low
limit min greater than high limit max_avail
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:523:4: note: in definition of macro
'__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler_types.h:542:2: note: in expansion of macro
'_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro
'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/minmax.h:188:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:195:2: note: in expansion of macro '__clamp_once'
__clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_),
__UNIQUE_ID(h_))
^~~~~~~~~~~~
include/linux/minmax.h:206:28: note: in expansion of macro '__careful_clamp'
#define clamp(val, lo, hi) __careful_clamp(__auto_type, val, lo, hi)
^~~~~~~~~~~~~~~
net/netfilter/ipvs/ip_vs_conn.c:1498:8: note: in expansion of macro 'clamp'
max = clamp(max, min, max_avail);
^~~~~
Links:
---
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/log
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/details/
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/history/
Steps to reproduce:
------------
# tuxmake --runtime podman --target-arch arm64 --toolchain gcc-8
--kconfig defconfig
metadata:
----
git describe: next-20241203
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git sha: c245a7a79602ccbee780c004c1e4abcda66aec32
kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/config
build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/
toolchain: gcc-8
config: gcc-8-defconfig
arch: arm64
--
Linaro LKFT
https://lkft.linaro.org
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail 2024-12-05 14:45 arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail Naresh Kamboju @ 2024-12-05 15:16 ` Dan Carpenter 2024-12-05 15:59 ` David Laight 2024-12-05 18:42 ` Naresh Kamboju 0 siblings, 2 replies; 7+ messages in thread From: Dan Carpenter @ 2024-12-05 15:16 UTC (permalink / raw) To: Naresh Kamboju, David Laight Cc: open list, lkft-triage, Linux Regressions, Linux ARM, netfilter-devel, Arnd Bergmann, Anders Roxell, Johannes Berg, toke, Al Viro, kernel, kees Add David to the CC list. regards, dan carpenter On Thu, Dec 05, 2024 at 08:15:13PM +0530, Naresh Kamboju wrote: > The arm64 build started failing from Linux next-20241203 tag with gcc-8 > due to following build warnings / errors. > > First seen on Linux next-20241203 tag > GOOD: Linux next-20241128 tag > BAD: Linux next-20241203 tag and next-20241205 tag > > * arm64, build > - gcc-8-defconfig > - gcc-8-defconfig-40bc7ee5 > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> > > Build log: > =========== > net/netfilter/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_init': > include/linux/compiler_types.h:542:38: error: call to > '__compiletime_assert_1050' declared with attribute error: clamp() low > limit min greater than high limit max_avail > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^ > include/linux/compiler_types.h:523:4: note: in definition of macro > '__compiletime_assert' > prefix ## suffix(); \ > ^~~~~~ > include/linux/compiler_types.h:542:2: note: in expansion of macro > '_compiletime_assert' > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^~~~~~~~~~~~~~~~~~~ > include/linux/build_bug.h:39:37: note: in expansion of macro > 'compiletime_assert' > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > ^~~~~~~~~~~~~~~~~~ > include/linux/minmax.h:188:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' > BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \ > ^~~~~~~~~~~~~~~~ > include/linux/minmax.h:195:2: note: in expansion of macro '__clamp_once' > __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), > __UNIQUE_ID(h_)) > ^~~~~~~~~~~~ > include/linux/minmax.h:206:28: note: in expansion of macro '__careful_clamp' > #define clamp(val, lo, hi) __careful_clamp(__auto_type, val, lo, hi) > ^~~~~~~~~~~~~~~ > net/netfilter/ipvs/ip_vs_conn.c:1498:8: note: in expansion of macro 'clamp' > max = clamp(max, min, max_avail); > ^~~~~ > > Links: > --- > - https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/ > - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/log > - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/details/ > - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/history/ > > Steps to reproduce: > ------------ > # tuxmake --runtime podman --target-arch arm64 --toolchain gcc-8 > --kconfig defconfig > > metadata: > ---- > git describe: next-20241203 > git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > git sha: c245a7a79602ccbee780c004c1e4abcda66aec32 > kernel config: > https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/config > build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/ > toolchain: gcc-8 > config: gcc-8-defconfig > arch: arm64 > > -- > Linaro LKFT > https://lkft.linaro.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail 2024-12-05 15:16 ` Dan Carpenter @ 2024-12-05 15:59 ` David Laight 2024-12-05 18:42 ` Naresh Kamboju 1 sibling, 0 replies; 7+ messages in thread From: David Laight @ 2024-12-05 15:59 UTC (permalink / raw) To: 'Dan Carpenter', Naresh Kamboju Cc: open list, lkft-triage@lists.linaro.org, Linux Regressions, Linux ARM, netfilter-devel@vger.kernel.org, Arnd Bergmann, Anders Roxell, Johannes Berg, toke@kernel.org, Al Viro, kernel@jfarr.cc, kees@kernel.org From: Dan Carpenter <dan.carpenter@linaro.org> > Sent: 05 December 2024 15:16 > > Add David to the CC list. I've been forwarded this one before. It is not unreasonable really. Is all stems from order_base_2(totalram_pages()). order_base_2(n) is 'n > 1 ? ilog2(n - 1) + 1 : 0'. And the compiler is generating two copies of the code. (Basically optimising for the zero case.) And the one for totalram_pages() being zero hits the check in clamp(). Flipping to clamp(max_avail, min, max) will stop it bleating. More interesting would be 'launder' the 0 in order_base_2(). By adding something like: #define optimiser_hide_val(x) ({ \ __auto_type(_x) = (x); \ optimiser_hide_var(_x); \ _x; \ }) and change order_base_2() to be: n > 1 ? ilog2(n - 1) + 1 : optimiser_hide_val(0); (ISTR there is a split for constant v non-constant before then.) David > > regards, > dan carpenter > > On Thu, Dec 05, 2024 at 08:15:13PM +0530, Naresh Kamboju wrote: > > The arm64 build started failing from Linux next-20241203 tag with gcc-8 > > due to following build warnings / errors. > > > > First seen on Linux next-20241203 tag > > GOOD: Linux next-20241128 tag > > BAD: Linux next-20241203 tag and next-20241205 tag > > > > * arm64, build > > - gcc-8-defconfig > > - gcc-8-defconfig-40bc7ee5 > > > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> > > > > Build log: > > =========== > > net/netfilter/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_init': > > include/linux/compiler_types.h:542:38: error: call to > > '__compiletime_assert_1050' declared with attribute error: clamp() low > > limit min greater than high limit max_avail > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > ^ > > include/linux/compiler_types.h:523:4: note: in definition of macro > > '__compiletime_assert' > > prefix ## suffix(); \ > > ^~~~~~ > > include/linux/compiler_types.h:542:2: note: in expansion of macro > > '_compiletime_assert' > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > ^~~~~~~~~~~~~~~~~~~ > > include/linux/build_bug.h:39:37: note: in expansion of macro > > 'compiletime_assert' > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > ^~~~~~~~~~~~~~~~~~ > > include/linux/minmax.h:188:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' > > BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \ > > ^~~~~~~~~~~~~~~~ > > include/linux/minmax.h:195:2: note: in expansion of macro '__clamp_once' > > __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), > > __UNIQUE_ID(h_)) > > ^~~~~~~~~~~~ > > include/linux/minmax.h:206:28: note: in expansion of macro '__careful_clamp' > > #define clamp(val, lo, hi) __careful_clamp(__auto_type, val, lo, hi) > > ^~~~~~~~~~~~~~~ > > net/netfilter/ipvs/ip_vs_conn.c:1498:8: note: in expansion of macro 'clamp' > > max = clamp(max, min, max_avail); > > ^~~~~ > > > > Links: > > --- > > - https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/ > > - https://qa-reports.linaro.org/lkft/linux-next-master/build/next- > 20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/log > > - https://qa-reports.linaro.org/lkft/linux-next-master/build/next- > 20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/details/ > > - https://qa-reports.linaro.org/lkft/linux-next-master/build/next- > 20241203/testrun/26189105/suite/build/test/gcc-8-defconfig/history/ > > > > Steps to reproduce: > > ------------ > > # tuxmake --runtime podman --target-arch arm64 --toolchain gcc-8 > > --kconfig defconfig > > > > metadata: > > ---- > > git describe: next-20241203 > > git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > git sha: c245a7a79602ccbee780c004c1e4abcda66aec32 > > kernel config: > > https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/config > > build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAOE9K3Dz9gRywrldKTyaXQoT/ > > toolchain: gcc-8 > > config: gcc-8-defconfig > > arch: arm64 > > > > -- > > Linaro LKFT > > https://lkft.linaro.org - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail 2024-12-05 15:16 ` Dan Carpenter 2024-12-05 15:59 ` David Laight @ 2024-12-05 18:42 ` Naresh Kamboju 2024-12-06 2:18 ` David Laight 1 sibling, 1 reply; 7+ messages in thread From: Naresh Kamboju @ 2024-12-05 18:42 UTC (permalink / raw) To: Dan Carpenter Cc: David Laight, open list, lkft-triage, Linux Regressions, Linux ARM, netfilter-devel, Arnd Bergmann, Anders Roxell, Johannes Berg, toke, Al Viro, kernel, kees On Thu, 5 Dec 2024 at 20:46, Dan Carpenter <dan.carpenter@linaro.org> wrote: > > Add David to the CC list. Anders bisected this reported issue and found the first bad commit as, # first bad commit: [ef32b92ac605ba1b7692827330b9c60259f0af49] minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp() - Naresh ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail 2024-12-05 18:42 ` Naresh Kamboju @ 2024-12-06 2:18 ` David Laight 2024-12-11 12:46 ` Bartosz Golaszewski 0 siblings, 1 reply; 7+ messages in thread From: David Laight @ 2024-12-06 2:18 UTC (permalink / raw) To: 'Naresh Kamboju', Dan Carpenter Cc: open list, lkft-triage@lists.linaro.org, Linux Regressions, Linux ARM, netfilter-devel@vger.kernel.org, Arnd Bergmann, Anders Roxell, Johannes Berg, toke@kernel.org, Al Viro, kernel@jfarr.cc, kees@kernel.org From: Naresh Kamboju > Sent: 05 December 2024 18:42 > > On Thu, 5 Dec 2024 at 20:46, Dan Carpenter <dan.carpenter@linaro.org> wrote: > > > > Add David to the CC list. > > Anders bisected this reported issue and found the first bad commit as, > > # first bad commit: > [ef32b92ac605ba1b7692827330b9c60259f0af49] > minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp() That 'just' changed the test to use __builtin_constant_p() and thus gets checked after the optimiser has run. I can paraphrase the code as: unsigned int fn(unsigned int x) { return clamp(10, 5, x == 0 ? 0 : x - 1); } which is never actually called with x <= 5. The compiler converts it to: return x < 0 ? clamp(10, 5, 0) : clamp(10, 5, x); (Probably because it can see that clamp(10, 5, 0) is constant.) And then the compile-time sanity check in clamp() fires. The order of the arguments to clamp is just wrong! David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail 2024-12-06 2:18 ` David Laight @ 2024-12-11 12:46 ` Bartosz Golaszewski 2024-12-11 13:21 ` Dan Carpenter 0 siblings, 1 reply; 7+ messages in thread From: Bartosz Golaszewski @ 2024-12-11 12:46 UTC (permalink / raw) To: David Laight Cc: Naresh Kamboju, Dan Carpenter, open list, lkft-triage@lists.linaro.org, Linux Regressions, Linux ARM, netfilter-devel@vger.kernel.org, Arnd Bergmann, Anders Roxell, Johannes Berg, toke@kernel.org, Al Viro, kernel@jfarr.cc, kees@kernel.org On Fri, Dec 6, 2024 at 3:20 AM David Laight <David.Laight@aculab.com> wrote: > > From: Naresh Kamboju > > Sent: 05 December 2024 18:42 > > > > On Thu, 5 Dec 2024 at 20:46, Dan Carpenter <dan.carpenter@linaro.org> wrote: > > > > > > Add David to the CC list. > > > > Anders bisected this reported issue and found the first bad commit as, > > > > # first bad commit: > > [ef32b92ac605ba1b7692827330b9c60259f0af49] > > minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp() > > That 'just' changed the test to use __builtin_constant_p() and > thus gets checked after the optimiser has run. > > I can paraphrase the code as: > unsigned int fn(unsigned int x) > { > return clamp(10, 5, x == 0 ? 0 : x - 1); > } > which is never actually called with x <= 5. > The compiler converts it to: > return x < 0 ? clamp(10, 5, 0) : clamp(10, 5, x); > (Probably because it can see that clamp(10, 5, 0) is constant.) > And then the compile-time sanity check in clamp() fires. > > The order of the arguments to clamp is just wrong! > > David > The build is still failing with today's next, should the offending commit be reverted? Bartosz ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail 2024-12-11 12:46 ` Bartosz Golaszewski @ 2024-12-11 13:21 ` Dan Carpenter 0 siblings, 0 replies; 7+ messages in thread From: Dan Carpenter @ 2024-12-11 13:21 UTC (permalink / raw) To: Bartosz Golaszewski Cc: David Laight, Naresh Kamboju, open list, lkft-triage@lists.linaro.org, Linux Regressions, Linux ARM, netfilter-devel@vger.kernel.org, Arnd Bergmann, Anders Roxell, Johannes Berg, toke@kernel.org, Al Viro, kernel@jfarr.cc, kees@kernel.org On Wed, Dec 11, 2024 at 01:46:11PM +0100, Bartosz Golaszewski wrote: > On Fri, Dec 6, 2024 at 3:20 AM David Laight <David.Laight@aculab.com> wrote: > > > > From: Naresh Kamboju > > > Sent: 05 December 2024 18:42 > > > > > > On Thu, 5 Dec 2024 at 20:46, Dan Carpenter <dan.carpenter@linaro.org> wrote: > > > > > > > > Add David to the CC list. > > > > > > Anders bisected this reported issue and found the first bad commit as, > > > > > > # first bad commit: > > > [ef32b92ac605ba1b7692827330b9c60259f0af49] > > > minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp() > > > > That 'just' changed the test to use __builtin_constant_p() and > > thus gets checked after the optimiser has run. > > > > I can paraphrase the code as: > > unsigned int fn(unsigned int x) > > { > > return clamp(10, 5, x == 0 ? 0 : x - 1); > > } > > which is never actually called with x <= 5. > > The compiler converts it to: > > return x < 0 ? clamp(10, 5, 0) : clamp(10, 5, x); > > (Probably because it can see that clamp(10, 5, 0) is constant.) > > And then the compile-time sanity check in clamp() fires. > > > > The order of the arguments to clamp is just wrong! > > > > David > > > > The build is still failing with today's next, should the offending > commit be reverted? > It's a simple fix. I've sent a patch. regards, dan carpenter ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-11 13:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-12-05 14:45 arm64: include/linux/compiler_types.h:542:38: error: call to '__compiletime_assert_1050' declared with attribute error: clamp() low limit min greater than high limit max_avail Naresh Kamboju 2024-12-05 15:16 ` Dan Carpenter 2024-12-05 15:59 ` David Laight 2024-12-05 18:42 ` Naresh Kamboju 2024-12-06 2:18 ` David Laight 2024-12-11 12:46 ` Bartosz Golaszewski 2024-12-11 13:21 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox