* [PATCH] lib/bitmap: waive const_eval test as it breaks the build @ 2023-07-17 19:58 Yury Norov 2023-07-17 20:31 ` Nathan Chancellor 0 siblings, 1 reply; 6+ messages in thread From: Yury Norov @ 2023-07-17 19:58 UTC (permalink / raw) To: linux-kernel, llvm, Nick Desaulniers Cc: Yury Norov, Andy Shevchenko, Alexander Lobakin, Maxim Kuvyrkov, Rasmus Villemoes, Nathan Chancellor, Tom Rix, oe-kbuild-all When building with clang, and when KASAN and GCOV_PROFILE_ALL are both enabled, the test fails to build [1]: >> lib/test_bitmap.c:920:2: error: call to '__compiletime_assert_239' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res) BUILD_BUG_ON(!__builtin_constant_p(res)); ^ include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:333:4: note: expanded from macro '__compiletime_assert' prefix ## suffix(); \ ^ <scratch space>:185:1: note: expanded from here __compiletime_assert_239 Originally it was attributed to s390, which now looks seemingly wrong. The issue is also not related to bitmap code itself, but it breaks build for a given configuration. So, disabling the test unless the compiler will get fixed. [1] https://github.com/ClangBuiltLinux/linux/issues/1874 Fixes: dc34d5036692 ("lib: test_bitmap: add compile-time optimization/evaluations assertions") Signed-off-by: Yury Norov <yury.norov@gmail.com> --- lib/test_bitmap.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 187f5b2db4cf..a791fdb7a8c9 100644 --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -1163,6 +1163,9 @@ static void __init test_bitmap_print_buf(void) static void __init test_bitmap_const_eval(void) { +#if defined(CONFIG_CC_IS_CLANG) && defined(CONFIG_KASAN) && defined(CONFIG_GCOV_PROFILE_ALL) +#warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" +#else DECLARE_BITMAP(bitmap, BITS_PER_LONG); unsigned long initvar = BIT(2); unsigned long bitopvar = 0; @@ -1177,20 +1180,9 @@ static void __init test_bitmap_const_eval(void) * in runtime. */ - /* - * Equals to `unsigned long bitmap[1] = { GENMASK(6, 5), }`. - * Clang on s390 optimizes bitops at compile-time as intended, but at - * the same time stops treating @bitmap and @bitopvar as compile-time - * constants after regular test_bit() is executed, thus triggering the - * build bugs below. So, call const_test_bit() there directly until - * the compiler is fixed. - */ + /* Equals to `unsigned long bitmap[1] = { GENMASK(6, 5), }` */ bitmap_clear(bitmap, 0, BITS_PER_LONG); -#if defined(__s390__) && defined(__clang__) - if (!const_test_bit(7, bitmap)) -#else if (!test_bit(7, bitmap)) -#endif bitmap_set(bitmap, 5, 2); /* Equals to `unsigned long bitopvar = BIT(20)` */ @@ -1220,6 +1212,7 @@ static void __init test_bitmap_const_eval(void) /* ~BIT(25) */ BUILD_BUG_ON(!__builtin_constant_p(~var)); BUILD_BUG_ON(~var != ~BIT(25)); +#endif } static void __init selftest(void) -- 2.39.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] lib/bitmap: waive const_eval test as it breaks the build 2023-07-17 19:58 [PATCH] lib/bitmap: waive const_eval test as it breaks the build Yury Norov @ 2023-07-17 20:31 ` Nathan Chancellor 2023-07-17 20:57 ` Nick Desaulniers 0 siblings, 1 reply; 6+ messages in thread From: Nathan Chancellor @ 2023-07-17 20:31 UTC (permalink / raw) To: Yury Norov Cc: linux-kernel, llvm, Nick Desaulniers, Andy Shevchenko, Alexander Lobakin, Maxim Kuvyrkov, Rasmus Villemoes, Tom Rix, oe-kbuild-all Hi Yury, On Mon, Jul 17, 2023 at 12:58:13PM -0700, Yury Norov wrote: > When building with clang, and when KASAN and GCOV_PROFILE_ALL are both > enabled, the test fails to build [1]: > > >> lib/test_bitmap.c:920:2: error: call to '__compiletime_assert_239' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res) > BUILD_BUG_ON(!__builtin_constant_p(res)); > ^ > include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' > BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) > ^ > include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > ^ > include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^ > include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' > __compiletime_assert(condition, msg, prefix, suffix) > ^ > include/linux/compiler_types.h:333:4: note: expanded from macro '__compiletime_assert' > prefix ## suffix(); \ > ^ > <scratch space>:185:1: note: expanded from here > __compiletime_assert_239 > > Originally it was attributed to s390, which now looks seemingly wrong. The > issue is also not related to bitmap code itself, but it breaks build for > a given configuration. So, disabling the test unless the compiler will > get fixed. > > [1] https://github.com/ClangBuiltLinux/linux/issues/1874 > > Fixes: dc34d5036692 ("lib: test_bitmap: add compile-time optimization/evaluations assertions") > Signed-off-by: Yury Norov <yury.norov@gmail.com> > --- > lib/test_bitmap.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c > index 187f5b2db4cf..a791fdb7a8c9 100644 > --- a/lib/test_bitmap.c > +++ b/lib/test_bitmap.c > @@ -1163,6 +1163,9 @@ static void __init test_bitmap_print_buf(void) > > static void __init test_bitmap_const_eval(void) > { > +#if defined(CONFIG_CC_IS_CLANG) && defined(CONFIG_KASAN) && defined(CONFIG_GCOV_PROFILE_ALL) > +#warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" Making this a '#warning' will basically just replace the current error with a different one in the face of CONFIG_WERROR, which seems pointless to me: lib/test_bitmap.c:1167:2: error: "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" [-Werror,-W#warnings] 1167 | #warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" | ^ 1 error generated. Could we just opt out of GCOV for test_bitmap.c if KASAN is enabled with clang? That does not seem too bad of a workaround. I highly doubt there are many people who are interested in debugging test_bitmap.c with KASAN while profiling it with GCOV when building with clang, since they would have hit this already and reported it already; as far as I can tell, only the Intel robot has reported this with a randconfig. diff --git a/lib/Makefile b/lib/Makefile index 42d307ade225..c6f60ae42769 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -83,6 +83,10 @@ obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o +# https://github.com/ClangBuiltLinux/linux/issues/1874 +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_KASAN),yy) +GCOV_PROFILE_test_bitmap.o := n +endif obj-$(CONFIG_TEST_UUID) += test_uuid.o obj-$(CONFIG_TEST_XARRAY) += test_xarray.o obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o Cheers, Nathan > +#else > DECLARE_BITMAP(bitmap, BITS_PER_LONG); > unsigned long initvar = BIT(2); > unsigned long bitopvar = 0; > @@ -1177,20 +1180,9 @@ static void __init test_bitmap_const_eval(void) > * in runtime. > */ > > - /* > - * Equals to `unsigned long bitmap[1] = { GENMASK(6, 5), }`. > - * Clang on s390 optimizes bitops at compile-time as intended, but at > - * the same time stops treating @bitmap and @bitopvar as compile-time > - * constants after regular test_bit() is executed, thus triggering the > - * build bugs below. So, call const_test_bit() there directly until > - * the compiler is fixed. > - */ > + /* Equals to `unsigned long bitmap[1] = { GENMASK(6, 5), }` */ > bitmap_clear(bitmap, 0, BITS_PER_LONG); > -#if defined(__s390__) && defined(__clang__) > - if (!const_test_bit(7, bitmap)) > -#else > if (!test_bit(7, bitmap)) > -#endif > bitmap_set(bitmap, 5, 2); > > /* Equals to `unsigned long bitopvar = BIT(20)` */ > @@ -1220,6 +1212,7 @@ static void __init test_bitmap_const_eval(void) > /* ~BIT(25) */ > BUILD_BUG_ON(!__builtin_constant_p(~var)); > BUILD_BUG_ON(~var != ~BIT(25)); > +#endif > } > > static void __init selftest(void) > -- > 2.39.2 > ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] lib/bitmap: waive const_eval test as it breaks the build 2023-07-17 20:31 ` Nathan Chancellor @ 2023-07-17 20:57 ` Nick Desaulniers 2023-07-17 21:31 ` Yury Norov 0 siblings, 1 reply; 6+ messages in thread From: Nick Desaulniers @ 2023-07-17 20:57 UTC (permalink / raw) To: Nathan Chancellor, Yury Norov Cc: linux-kernel, llvm, Andy Shevchenko, Alexander Lobakin, Maxim Kuvyrkov, Rasmus Villemoes, Tom Rix, oe-kbuild-all On Mon, Jul 17, 2023 at 1:31 PM Nathan Chancellor <nathan@kernel.org> wrote: > > Hi Yury, > > On Mon, Jul 17, 2023 at 12:58:13PM -0700, Yury Norov wrote: > > When building with clang, and when KASAN and GCOV_PROFILE_ALL are both > > enabled, the test fails to build [1]: > > > > >> lib/test_bitmap.c:920:2: error: call to '__compiletime_assert_239' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res) > > BUILD_BUG_ON(!__builtin_constant_p(res)); > > ^ > > include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' > > BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) > > ^ > > include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > ^ > > include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > ^ > > include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' > > __compiletime_assert(condition, msg, prefix, suffix) > > ^ > > include/linux/compiler_types.h:333:4: note: expanded from macro '__compiletime_assert' > > prefix ## suffix(); \ > > ^ > > <scratch space>:185:1: note: expanded from here > > __compiletime_assert_239 > > > > Originally it was attributed to s390, which now looks seemingly wrong. The > > issue is also not related to bitmap code itself, but it breaks build for > > a given configuration. So, disabling the test unless the compiler will > > get fixed. > > > > [1] https://github.com/ClangBuiltLinux/linux/issues/1874 > > > > Fixes: dc34d5036692 ("lib: test_bitmap: add compile-time optimization/evaluations assertions") > > Signed-off-by: Yury Norov <yury.norov@gmail.com> > > --- > > lib/test_bitmap.c | 17 +++++------------ > > 1 file changed, 5 insertions(+), 12 deletions(-) > > > > diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c > > index 187f5b2db4cf..a791fdb7a8c9 100644 > > --- a/lib/test_bitmap.c > > +++ b/lib/test_bitmap.c > > @@ -1163,6 +1163,9 @@ static void __init test_bitmap_print_buf(void) > > > > static void __init test_bitmap_const_eval(void) > > { > > +#if defined(CONFIG_CC_IS_CLANG) && defined(CONFIG_KASAN) && defined(CONFIG_GCOV_PROFILE_ALL) > > +#warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" > > Making this a '#warning' will basically just replace the current error > with a different one in the face of CONFIG_WERROR, which seems pointless > to me: > > lib/test_bitmap.c:1167:2: error: "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" [-Werror,-W#warnings] > 1167 | #warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" > | ^ > 1 error generated. > > Could we just opt out of GCOV for test_bitmap.c if KASAN is enabled with > clang? That does not seem too bad of a workaround. I highly doubt there > are many people who are interested in debugging test_bitmap.c with KASAN > while profiling it with GCOV when building with clang, since they would > have hit this already and reported it already; as far as I can tell, > only the Intel robot has reported this with a randconfig. Yury, Nathan, Thanks for the patches and discussion. Yes, I think a combo of: 1. Nathan's lib/Makefile change plus 2. Yury's removal of the current preprocessor guards in lib/test_bitmap.c make most sense. > > diff --git a/lib/Makefile b/lib/Makefile > index 42d307ade225..c6f60ae42769 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -83,6 +83,10 @@ obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o > obj-$(CONFIG_TEST_PRINTF) += test_printf.o > obj-$(CONFIG_TEST_SCANF) += test_scanf.o > obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o > +# https://github.com/ClangBuiltLinux/linux/issues/1874 > +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_KASAN),yy) > +GCOV_PROFILE_test_bitmap.o := n > +endif > obj-$(CONFIG_TEST_UUID) += test_uuid.o > obj-$(CONFIG_TEST_XARRAY) += test_xarray.o > obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o > > Cheers, > Nathan > > > +#else > > DECLARE_BITMAP(bitmap, BITS_PER_LONG); > > unsigned long initvar = BIT(2); > > unsigned long bitopvar = 0; > > @@ -1177,20 +1180,9 @@ static void __init test_bitmap_const_eval(void) > > * in runtime. > > */ > > > > - /* > > - * Equals to `unsigned long bitmap[1] = { GENMASK(6, 5), }`. > > - * Clang on s390 optimizes bitops at compile-time as intended, but at > > - * the same time stops treating @bitmap and @bitopvar as compile-time > > - * constants after regular test_bit() is executed, thus triggering the > > - * build bugs below. So, call const_test_bit() there directly until > > - * the compiler is fixed. > > - */ > > + /* Equals to `unsigned long bitmap[1] = { GENMASK(6, 5), }` */ > > bitmap_clear(bitmap, 0, BITS_PER_LONG); > > -#if defined(__s390__) && defined(__clang__) > > - if (!const_test_bit(7, bitmap)) > > -#else > > if (!test_bit(7, bitmap)) > > -#endif > > bitmap_set(bitmap, 5, 2); > > > > /* Equals to `unsigned long bitopvar = BIT(20)` */ > > @@ -1220,6 +1212,7 @@ static void __init test_bitmap_const_eval(void) > > /* ~BIT(25) */ > > BUILD_BUG_ON(!__builtin_constant_p(~var)); > > BUILD_BUG_ON(~var != ~BIT(25)); > > +#endif > > } > > > > static void __init selftest(void) > > -- > > 2.39.2 > > > -- Thanks, ~Nick Desaulniers ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lib/bitmap: waive const_eval test as it breaks the build 2023-07-17 20:57 ` Nick Desaulniers @ 2023-07-17 21:31 ` Yury Norov 2023-07-17 21:53 ` Nathan Chancellor 0 siblings, 1 reply; 6+ messages in thread From: Yury Norov @ 2023-07-17 21:31 UTC (permalink / raw) To: Nick Desaulniers Cc: Nathan Chancellor, linux-kernel, llvm, Andy Shevchenko, Alexander Lobakin, Maxim Kuvyrkov, Rasmus Villemoes, Tom Rix, oe-kbuild-all On Mon, Jul 17, 2023 at 01:57:40PM -0700, Nick Desaulniers wrote: > On Mon, Jul 17, 2023 at 1:31 PM Nathan Chancellor <nathan@kernel.org> wrote: > > > > Hi Yury, > > > > On Mon, Jul 17, 2023 at 12:58:13PM -0700, Yury Norov wrote: > > > When building with clang, and when KASAN and GCOV_PROFILE_ALL are both > > > enabled, the test fails to build [1]: > > > > > > >> lib/test_bitmap.c:920:2: error: call to '__compiletime_assert_239' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res) > > > BUILD_BUG_ON(!__builtin_constant_p(res)); > > > ^ > > > include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' > > > BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) > > > ^ > > > include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' > > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > > ^ > > > include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' > > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > > ^ > > > include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' > > > __compiletime_assert(condition, msg, prefix, suffix) > > > ^ > > > include/linux/compiler_types.h:333:4: note: expanded from macro '__compiletime_assert' > > > prefix ## suffix(); \ > > > ^ > > > <scratch space>:185:1: note: expanded from here > > > __compiletime_assert_239 > > > > > > Originally it was attributed to s390, which now looks seemingly wrong. The > > > issue is also not related to bitmap code itself, but it breaks build for > > > a given configuration. So, disabling the test unless the compiler will > > > get fixed. > > > > > > [1] https://github.com/ClangBuiltLinux/linux/issues/1874 > > > > > > Fixes: dc34d5036692 ("lib: test_bitmap: add compile-time optimization/evaluations assertions") > > > Signed-off-by: Yury Norov <yury.norov@gmail.com> > > > --- > > > lib/test_bitmap.c | 17 +++++------------ > > > 1 file changed, 5 insertions(+), 12 deletions(-) > > > > > > diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c > > > index 187f5b2db4cf..a791fdb7a8c9 100644 > > > --- a/lib/test_bitmap.c > > > +++ b/lib/test_bitmap.c > > > @@ -1163,6 +1163,9 @@ static void __init test_bitmap_print_buf(void) > > > > > > static void __init test_bitmap_const_eval(void) > > > { > > > +#if defined(CONFIG_CC_IS_CLANG) && defined(CONFIG_KASAN) && defined(CONFIG_GCOV_PROFILE_ALL) > > > +#warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" > > > > Making this a '#warning' will basically just replace the current error > > with a different one in the face of CONFIG_WERROR, which seems pointless > > to me: > > > > lib/test_bitmap.c:1167:2: error: "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" [-Werror,-W#warnings] > > 1167 | #warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" > > | ^ > > 1 error generated. > > > > Could we just opt out of GCOV for test_bitmap.c if KASAN is enabled with > > clang? That does not seem too bad of a workaround. I highly doubt there > > are many people who are interested in debugging test_bitmap.c with KASAN > > while profiling it with GCOV when building with clang, since they would > > have hit this already and reported it already; as far as I can tell, > > only the Intel robot has reported this with a randconfig. > > Yury, Nathan, > Thanks for the patches and discussion. Yes, I think a combo of: > > 1. Nathan's lib/Makefile change plus > 2. Yury's removal of the current preprocessor guards in lib/test_bitmap.c > > make most sense. OK, then I'll send a v2 shortly. Nathan, don't you mind if I add your co-developed-by for this? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lib/bitmap: waive const_eval test as it breaks the build 2023-07-17 21:31 ` Yury Norov @ 2023-07-17 21:53 ` Nathan Chancellor 2023-07-17 22:06 ` Yury Norov 0 siblings, 1 reply; 6+ messages in thread From: Nathan Chancellor @ 2023-07-17 21:53 UTC (permalink / raw) To: Yury Norov Cc: Nick Desaulniers, linux-kernel, llvm, Andy Shevchenko, Alexander Lobakin, Maxim Kuvyrkov, Rasmus Villemoes, Tom Rix, oe-kbuild-all On Mon, Jul 17, 2023 at 02:31:24PM -0700, Yury Norov wrote: > On Mon, Jul 17, 2023 at 01:57:40PM -0700, Nick Desaulniers wrote: > > On Mon, Jul 17, 2023 at 1:31 PM Nathan Chancellor <nathan@kernel.org> wrote: > > > > > > Hi Yury, > > > > > > On Mon, Jul 17, 2023 at 12:58:13PM -0700, Yury Norov wrote: > > > > When building with clang, and when KASAN and GCOV_PROFILE_ALL are both > > > > enabled, the test fails to build [1]: > > > > > > > > >> lib/test_bitmap.c:920:2: error: call to '__compiletime_assert_239' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res) > > > > BUILD_BUG_ON(!__builtin_constant_p(res)); > > > > ^ > > > > include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' > > > > BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) > > > > ^ > > > > include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' > > > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > > > ^ > > > > include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' > > > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > > > ^ > > > > include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' > > > > __compiletime_assert(condition, msg, prefix, suffix) > > > > ^ > > > > include/linux/compiler_types.h:333:4: note: expanded from macro '__compiletime_assert' > > > > prefix ## suffix(); \ > > > > ^ > > > > <scratch space>:185:1: note: expanded from here > > > > __compiletime_assert_239 > > > > > > > > Originally it was attributed to s390, which now looks seemingly wrong. The > > > > issue is also not related to bitmap code itself, but it breaks build for > > > > a given configuration. So, disabling the test unless the compiler will > > > > get fixed. > > > > > > > > [1] https://github.com/ClangBuiltLinux/linux/issues/1874 > > > > > > > > Fixes: dc34d5036692 ("lib: test_bitmap: add compile-time optimization/evaluations assertions") > > > > Signed-off-by: Yury Norov <yury.norov@gmail.com> > > > > --- > > > > lib/test_bitmap.c | 17 +++++------------ > > > > 1 file changed, 5 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c > > > > index 187f5b2db4cf..a791fdb7a8c9 100644 > > > > --- a/lib/test_bitmap.c > > > > +++ b/lib/test_bitmap.c > > > > @@ -1163,6 +1163,9 @@ static void __init test_bitmap_print_buf(void) > > > > > > > > static void __init test_bitmap_const_eval(void) > > > > { > > > > +#if defined(CONFIG_CC_IS_CLANG) && defined(CONFIG_KASAN) && defined(CONFIG_GCOV_PROFILE_ALL) > > > > +#warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" > > > > > > Making this a '#warning' will basically just replace the current error > > > with a different one in the face of CONFIG_WERROR, which seems pointless > > > to me: > > > > > > lib/test_bitmap.c:1167:2: error: "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" [-Werror,-W#warnings] > > > 1167 | #warning "FIXME: Clang breaks compile time evaluations when KASAN and GCOV are enabled" > > > | ^ > > > 1 error generated. > > > > > > Could we just opt out of GCOV for test_bitmap.c if KASAN is enabled with > > > clang? That does not seem too bad of a workaround. I highly doubt there > > > are many people who are interested in debugging test_bitmap.c with KASAN > > > while profiling it with GCOV when building with clang, since they would > > > have hit this already and reported it already; as far as I can tell, > > > only the Intel robot has reported this with a randconfig. > > > > Yury, Nathan, > > Thanks for the patches and discussion. Yes, I think a combo of: > > > > 1. Nathan's lib/Makefile change plus > > 2. Yury's removal of the current preprocessor guards in lib/test_bitmap.c > > > > make most sense. > > OK, then I'll send a v2 shortly. Nathan, don't you mind if I add your > co-developed-by for this? Sure, no worries! Co-developed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Nathan Chancellor <nathan@kernel.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lib/bitmap: waive const_eval test as it breaks the build 2023-07-17 21:53 ` Nathan Chancellor @ 2023-07-17 22:06 ` Yury Norov 0 siblings, 0 replies; 6+ messages in thread From: Yury Norov @ 2023-07-17 22:06 UTC (permalink / raw) To: Nathan Chancellor Cc: Nick Desaulniers, linux-kernel, llvm, Andy Shevchenko, Alexander Lobakin, Maxim Kuvyrkov, Rasmus Villemoes, Tom Rix, oe-kbuild-all > > > Yury, Nathan, > > > Thanks for the patches and discussion. Yes, I think a combo of: > > > > > > 1. Nathan's lib/Makefile change plus > > > 2. Yury's removal of the current preprocessor guards in lib/test_bitmap.c > > > > > > make most sense. > > > > OK, then I'll send a v2 shortly. Nathan, don't you mind if I add your > > co-developed-by for this? > > Sure, no worries! > > Co-developed-by: Nathan Chancellor <nathan@kernel.org> > Signed-off-by: Nathan Chancellor <nathan@kernel.org> Done. Just removed external link from Makefile. We've got it in commit message anyways, so better to not pollute sources. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-17 22:06 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-07-17 19:58 [PATCH] lib/bitmap: waive const_eval test as it breaks the build Yury Norov 2023-07-17 20:31 ` Nathan Chancellor 2023-07-17 20:57 ` Nick Desaulniers 2023-07-17 21:31 ` Yury Norov 2023-07-17 21:53 ` Nathan Chancellor 2023-07-17 22:06 ` Yury Norov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox