All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-09  8:40 Geert Uytterhoeven
  2017-10-09 14:34 ` Jakub Kicinski
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2017-10-09  8:40 UTC (permalink / raw)
  To: Jakub Kicinski, Arnd Bergmann, Andrew Morton
  Cc: kbuild test robot, linux-arch, linux-kernel, Geert Uytterhoeven

On most architectures[*], gcc turns __builtin_ffsll() into a call to
__ffsdi2(), which is not provided by any architecture, leading to
failures like:

    rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'

To fix this, use __ffs64() instead, which is available on all
architectures.

[*] Known exceptions are some 64-bit architectures like amd64, arm64,
    ia64, powerpc64, and tilegx.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 include/linux/bitfield.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index 8b9d6fff002db113..0a827677372756fa 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -15,6 +15,7 @@
 #ifndef _LINUX_BITFIELD_H
 #define _LINUX_BITFIELD_H
 
+#include <linux/bitops.h>
 #include <linux/bug.h>
 
 /*
@@ -46,7 +47,7 @@
  *  reg |= FIELD_PREP(REG_FIELD_C, c);
  */
 
-#define __bf_shf(x) (__builtin_ffsll(x) - 1)
+#define __bf_shf(x) __ffs64(x)
 
 #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)			\
 	({								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
  2017-10-09  8:40 [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2() Geert Uytterhoeven
@ 2017-10-09 14:34 ` Jakub Kicinski
  2017-10-09 22:37   ` kbuild test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2017-10-09 14:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, Andrew Morton, kbuild test robot, linux-arch,
	linux-kernel

On Mon,  9 Oct 2017 10:40:49 +0200, Geert Uytterhoeven wrote:
> On most architectures[*], gcc turns __builtin_ffsll() into a call to
> __ffsdi2(), which is not provided by any architecture, leading to
> failures like:
> 
>     rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'
> 
> To fix this, use __ffs64() instead, which is available on all
> architectures.
> 
> [*] Known exceptions are some 64-bit architectures like amd64, arm64,
>     ia64, powerpc64, and tilegx.
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Thanks!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
  2017-10-09  8:40 [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2() Geert Uytterhoeven
  2017-10-09 14:34 ` Jakub Kicinski
@ 2017-10-09 22:37   ` kbuild test robot
  2017-10-09 22:53 ` Jakub Kicinski
  2017-10-09 22:57   ` kbuild test robot
  3 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-10-09 22:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild-all, Jakub Kicinski, Arnd Bergmann, Andrew Morton,
	kbuild test robot, linux-arch, linux-kernel, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 28509 bytes --]

Hi Geert,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc4]
[cannot apply to next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/bitfield-Use-__ffs64-x-to-fix-missing-__ffsdi2/20171010-050009
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net/mac80211/sta_info.c:12:
   In function 'sta_stats_decode_rate',
       inlined from 'sta_set_rate_info_rx' at net/mac80211/sta_info.c:2016:2,
       inlined from 'sta_set_sinfo' at net/mac80211/sta_info.c:2218:7:
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1971' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) & ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
>> net/mac80211/sta_info.c:1971:14: note: in expansion of macro 'STA_STATS_GET'
     rinfo->bw = STA_STATS_GET(BW, rate);
                 ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1973' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1973:10: note: in expansion of macro 'STA_STATS_GET'
     switch (STA_STATS_GET(TYPE, rate)) {
             ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1976' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) & ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1976:16: note: in expansion of macro 'STA_STATS_GET'
      rinfo->mcs = STA_STATS_GET(VHT_MCS, rate);
                   ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1977' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) & ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1977:16: note: in expansion of macro 'STA_STATS_GET'
      rinfo->nss = STA_STATS_GET(VHT_NSS, rate);
                   ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1978' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/uapi/linux/sysinfo.h:4,
                    from include/uapi/linux/kernel.h:4,
                    from include/linux/cache.h:4,
                    from include/linux/jiffies.h:4,
                    from net/mac80211/rx.c:14:
   net/mac80211/sta_info.h: In function 'sta_stats_encode_rate':
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_772' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) & ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
>> net/mac80211/sta_info.h:772:6: note: in expansion of macro 'STA_STATS_FIELD'
     r = STA_STATS_FIELD(BW, s->bw);
         ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_775' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:57:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?  \
      ^~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:775:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(SGI, 1);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_775' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:775:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(SGI, 1);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_779' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:57:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?  \
      ^~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:779:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_779' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:779:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_780' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) & ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:780:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(VHT_NSS, s->nss);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_781' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) & ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:781:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(VHT_MCS, s->rate_idx);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_784' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~

vim +/__compiletime_assert_1971 +576 include/linux/compiler.h

9a8ab1c3 Daniel Santos 2013-02-21  562  
9a8ab1c3 Daniel Santos 2013-02-21  563  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21  564  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21  565  
9a8ab1c3 Daniel Santos 2013-02-21  566  /**
9a8ab1c3 Daniel Santos 2013-02-21  567   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  568   * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21  569   * @msg:       a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  570   *
9a8ab1c3 Daniel Santos 2013-02-21  571   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21  572   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21  573   * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21  574   */
9a8ab1c3 Daniel Santos 2013-02-21  575  #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @576  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21  577  

:::::: The code at line 576 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39531 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-09 22:37   ` kbuild test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-10-09 22:37 UTC (permalink / raw)
  Cc: kbuild-all, Jakub Kicinski, Arnd Bergmann, Andrew Morton,
	kbuild test robot, linux-arch, linux-kernel, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 28509 bytes --]

Hi Geert,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc4]
[cannot apply to next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/bitfield-Use-__ffs64-x-to-fix-missing-__ffsdi2/20171010-050009
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net/mac80211/sta_info.c:12:
   In function 'sta_stats_decode_rate',
       inlined from 'sta_set_rate_info_rx' at net/mac80211/sta_info.c:2016:2,
       inlined from 'sta_set_sinfo' at net/mac80211/sta_info.c:2218:7:
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1971' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) & ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
>> net/mac80211/sta_info.c:1971:14: note: in expansion of macro 'STA_STATS_GET'
     rinfo->bw = STA_STATS_GET(BW, rate);
                 ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1973' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1973:10: note: in expansion of macro 'STA_STATS_GET'
     switch (STA_STATS_GET(TYPE, rate)) {
             ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1976' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) & ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1976:16: note: in expansion of macro 'STA_STATS_GET'
      rinfo->mcs = STA_STATS_GET(VHT_MCS, rate);
                   ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1977' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) & ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1977:16: note: in expansion of macro 'STA_STATS_GET'
      rinfo->nss = STA_STATS_GET(VHT_NSS, rate);
                   ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1978' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/uapi/linux/sysinfo.h:4,
                    from include/uapi/linux/kernel.h:4,
                    from include/linux/cache.h:4,
                    from include/linux/jiffies.h:4,
                    from net/mac80211/rx.c:14:
   net/mac80211/sta_info.h: In function 'sta_stats_encode_rate':
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_772' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) & ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
>> net/mac80211/sta_info.h:772:6: note: in expansion of macro 'STA_STATS_FIELD'
     r = STA_STATS_FIELD(BW, s->bw);
         ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_775' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:57:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?  \
      ^~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:775:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(SGI, 1);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_775' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:775:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(SGI, 1);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_779' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:57:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?  \
      ^~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:779:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_779' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:779:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_780' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) & ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:780:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(VHT_NSS, s->nss);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_781' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) & ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:781:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(VHT_MCS, s->rate_idx);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_784' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~

vim +/__compiletime_assert_1971 +576 include/linux/compiler.h

9a8ab1c3 Daniel Santos 2013-02-21  562  
9a8ab1c3 Daniel Santos 2013-02-21  563  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21  564  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21  565  
9a8ab1c3 Daniel Santos 2013-02-21  566  /**
9a8ab1c3 Daniel Santos 2013-02-21  567   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  568   * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21  569   * @msg:       a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  570   *
9a8ab1c3 Daniel Santos 2013-02-21  571   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21  572   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21  573   * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21  574   */
9a8ab1c3 Daniel Santos 2013-02-21  575  #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @576  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21  577  

:::::: The code at line 576 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39531 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-09 22:37   ` kbuild test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-10-09 22:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild-all, Jakub Kicinski, Arnd Bergmann, Andrew Morton,
	kbuild test robot, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 28509 bytes --]

Hi Geert,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc4]
[cannot apply to next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/bitfield-Use-__ffs64-x-to-fix-missing-__ffsdi2/20171010-050009
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net/mac80211/sta_info.c:12:
   In function 'sta_stats_decode_rate',
       inlined from 'sta_set_rate_info_rx' at net/mac80211/sta_info.c:2016:2,
       inlined from 'sta_set_sinfo' at net/mac80211/sta_info.c:2218:7:
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1971' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) & ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
>> net/mac80211/sta_info.c:1971:14: note: in expansion of macro 'STA_STATS_GET'
     rinfo->bw = STA_STATS_GET(BW, rate);
                 ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1973' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1973:10: note: in expansion of macro 'STA_STATS_GET'
     switch (STA_STATS_GET(TYPE, rate)) {
             ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1976' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) & ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1976:16: note: in expansion of macro 'STA_STATS_GET'
      rinfo->mcs = STA_STATS_GET(VHT_MCS, rate);
                   ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1977' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) & ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:764:32: note: in expansion of macro 'FIELD_GET'
    #define STA_STATS_GET(_n, _v)  FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
                                   ^~~~~~~~~
   net/mac80211/sta_info.c:1977:16: note: in expansion of macro 'STA_STATS_GET'
      rinfo->nss = STA_STATS_GET(VHT_NSS, rate);
                   ^~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1978' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/uapi/linux/sysinfo.h:4,
                    from include/uapi/linux/kernel.h:4,
                    from include/linux/cache.h:4,
                    from include/linux/jiffies.h:4,
                    from net/mac80211/rx.c:14:
   net/mac80211/sta_info.h: In function 'sta_stats_encode_rate':
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_772' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) & ((((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))) + (1ULL << __ffs64((((~0UL) - (1UL << (8)) + 1) & (~0UL >> (64 - 1 - (11))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
>> net/mac80211/sta_info.h:772:6: note: in expansion of macro 'STA_STATS_FIELD'
     r = STA_STATS_FIELD(BW, s->bw);
         ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_775' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:57:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?  \
      ^~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:775:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(SGI, 1);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_775' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) & ((((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))) + (1ULL << __ffs64((((~0UL) - (1UL << (12)) + 1) & (~0UL >> (64 - 1 - (12))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:775:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(SGI, 1);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_779' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/bitfield.h:57:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?  \
      ^~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:779:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_779' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:779:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_780' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) & ((((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))) + (1ULL << __ffs64((((~0UL) - (1UL << (4)) + 1) & (~0UL >> (64 - 1 - (7))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:780:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(VHT_NSS, s->nss);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_781' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) & ((((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))) + (1ULL << __ffs64((((~0UL) - (1UL << (0)) + 1) & (~0UL >> (64 - 1 - (3))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
>> include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> net/mac80211/sta_info.h:763:34: note: in expansion of macro 'FIELD_PREP'
    #define STA_STATS_FIELD(_n, _v)  FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
                                     ^~~~~~~~~~
   net/mac80211/sta_info.h:781:8: note: in expansion of macro 'STA_STATS_FIELD'
      r |= STA_STATS_FIELD(VHT_MCS, s->rate_idx);
           ^~~~~~~~~~~~~~~
   include/linux/compiler.h:576:38: error: call to '__compiletime_assert_784' declared with attribute error: BUILD_BUG_ON failed: ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) & ((((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))) + (1ULL << __ffs64((((~0UL) - (1UL << (13)) + 1) & (~0UL >> (64 - 1 - (15))))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~

vim +/__compiletime_assert_1971 +576 include/linux/compiler.h

9a8ab1c3 Daniel Santos 2013-02-21  562  
9a8ab1c3 Daniel Santos 2013-02-21  563  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21  564  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21  565  
9a8ab1c3 Daniel Santos 2013-02-21  566  /**
9a8ab1c3 Daniel Santos 2013-02-21  567   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  568   * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21  569   * @msg:       a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  570   *
9a8ab1c3 Daniel Santos 2013-02-21  571   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21  572   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21  573   * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21  574   */
9a8ab1c3 Daniel Santos 2013-02-21  575  #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @576  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21  577  

:::::: The code at line 576 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39531 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
  2017-10-09  8:40 [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2() Geert Uytterhoeven
  2017-10-09 14:34 ` Jakub Kicinski
  2017-10-09 22:37   ` kbuild test robot
@ 2017-10-09 22:53 ` Jakub Kicinski
  2017-10-10  7:03     ` Geert Uytterhoeven
  2017-10-09 22:57   ` kbuild test robot
  3 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2017-10-09 22:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, Andrew Morton, kbuild test robot, linux-arch,
	linux-kernel

On Mon,  9 Oct 2017 10:40:49 +0200, Geert Uytterhoeven wrote:
> On most architectures[*], gcc turns __builtin_ffsll() into a call to
> __ffsdi2(), which is not provided by any architecture, leading to
> failures like:
> 
>     rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'
> 
> To fix this, use __ffs64() instead, which is available on all
> architectures.
> 
> [*] Known exceptions are some 64-bit architectures like amd64, arm64,
>     ia64, powerpc64, and tilegx.
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  include/linux/bitfield.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
> index 8b9d6fff002db113..0a827677372756fa 100644
> --- a/include/linux/bitfield.h
> +++ b/include/linux/bitfield.h
> @@ -15,6 +15,7 @@
>  #ifndef _LINUX_BITFIELD_H
>  #define _LINUX_BITFIELD_H
>  
> +#include <linux/bitops.h>
>  #include <linux/bug.h>
>  
>  /*
> @@ -46,7 +47,7 @@
>   *  reg |= FIELD_PREP(REG_FIELD_C, c);
>   */
>  
> -#define __bf_shf(x) (__builtin_ffsll(x) - 1)
> +#define __bf_shf(x) __ffs64(x)

Hm.  The build bot failure made me think.  I think rcar-gen3-cpg.c may
be doing something wrong here, could you point me at the patch in
question?  I don't see any FIELD_* there in Linus's tree.

__bf_shf() is supposed to be used with constant masks only, therefore
the call must be optimized away completely.

>  #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)			\
>  	({								\

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
  2017-10-09  8:40 [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2() Geert Uytterhoeven
  2017-10-09 14:34 ` Jakub Kicinski
@ 2017-10-09 22:57   ` kbuild test robot
  2017-10-09 22:53 ` Jakub Kicinski
  2017-10-09 22:57   ` kbuild test robot
  3 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-10-09 22:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild-all, Jakub Kicinski, Arnd Bergmann, Andrew Morton,
	kbuild test robot, linux-arch, linux-kernel, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 10959 bytes --]

Hi Geert,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc4]
[cannot apply to next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/bitfield-Use-__ffs64-x-to-fix-missing-__ffsdi2/20171010-050009
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/current.h:4:0,
                    from include/linux/sched.h:11,
                    from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:31:
   In function 'iwl_pcie_rx_mq_hw_init',
       inlined from 'iwl_pcie_rx_init' at drivers/net/wireless/intel/iwlwifi/pcie/rx.c:976:3:
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_857' declared with attribute error: BUILD_BUG_ON failed: (((0xF00) + (1ULL << __ffs64(0xF00))) & (((0xF00) + (1ULL << __ffs64(0xF00))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-fh.h:487:34: note: in expansion of macro 'FIELD_PREP'
    #define RFH_GEN_CFG_VAL(_n, _v)  FIELD_PREP(RFH_GEN_CFG_ ## _n, _v)
                                     ^~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/pcie/rx.c:857:11: note: in expansion of macro 'RFH_GEN_CFG_VAL'
              RFH_GEN_CFG_VAL(DEFAULT_RXQ_NUM, 0) |
              ^~~~~~~~~~~~~~~
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_862' declared with attribute error: BUILD_BUG_ON failed: ((((1UL << (4))) + (1ULL << __ffs64((1UL << (4))))) & ((((1UL << (4))) + (1ULL << __ffs64((1UL << (4))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-fh.h:487:34: note: in expansion of macro 'FIELD_PREP'
    #define RFH_GEN_CFG_VAL(_n, _v)  FIELD_PREP(RFH_GEN_CFG_ ## _n, _v)
                                     ^~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/rx.c:859:11: note: in expansion of macro 'RFH_GEN_CFG_VAL'
              RFH_GEN_CFG_VAL(RB_CHUNK_SIZE,
              ^~~~~~~~~~~~~~~
--
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from include/linux/skbuff.h:17,
                    from include/linux/if_ether.h:23,
                    from include/linux/etherdevice.h:25,
                    from drivers/net/wireless/intel/iwlwifi/pcie/tx.c:31:
   drivers/net/wireless/intel/iwlwifi/pcie/tx.c: In function 'iwl_trans_pcie_txq_enable':
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1368' declared with attribute error: BUILD_BUG_ON failed: ((((0x0000007F)) + (1ULL << __ffs64((0x0000007F)))) & ((((0x0000007F)) + (1ULL << __ffs64((0x0000007F)))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-prph.h:256:41: note: in expansion of macro 'FIELD_PREP'
    #define SCD_QUEUE_CTX_REG2_VAL(_n, _v)  FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
                                            ^~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1368:4: note: in expansion of macro 'SCD_QUEUE_CTX_REG2_VAL'
       SCD_QUEUE_CTX_REG2_VAL(WIN_SIZE, frame_limit) |
       ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1369' declared with attribute error: BUILD_BUG_ON failed: ((((0x007F0000)) + (1ULL << __ffs64((0x007F0000)))) & ((((0x007F0000)) + (1ULL << __ffs64((0x007F0000)))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-prph.h:256:41: note: in expansion of macro 'FIELD_PREP'
    #define SCD_QUEUE_CTX_REG2_VAL(_n, _v)  FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
                                            ^~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1369:4: note: in expansion of macro 'SCD_QUEUE_CTX_REG2_VAL'
       SCD_QUEUE_CTX_REG2_VAL(FRAME_LIMIT, frame_limit));
       ^~~~~~~~~~~~~~~~~~~~~~

vim +/__compiletime_assert_857 +576 include/linux/compiler.h

9a8ab1c3 Daniel Santos 2013-02-21  562  
9a8ab1c3 Daniel Santos 2013-02-21  563  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21  564  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21  565  
9a8ab1c3 Daniel Santos 2013-02-21  566  /**
9a8ab1c3 Daniel Santos 2013-02-21  567   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  568   * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21  569   * @msg:       a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  570   *
9a8ab1c3 Daniel Santos 2013-02-21  571   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21  572   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21  573   * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21  574   */
9a8ab1c3 Daniel Santos 2013-02-21  575  #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @576  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21  577  

:::::: The code at line 576 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39531 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-09 22:57   ` kbuild test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-10-09 22:57 UTC (permalink / raw)
  Cc: kbuild-all, Jakub Kicinski, Arnd Bergmann, Andrew Morton,
	kbuild test robot, linux-arch, linux-kernel, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 10959 bytes --]

Hi Geert,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc4]
[cannot apply to next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/bitfield-Use-__ffs64-x-to-fix-missing-__ffsdi2/20171010-050009
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/current.h:4:0,
                    from include/linux/sched.h:11,
                    from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:31:
   In function 'iwl_pcie_rx_mq_hw_init',
       inlined from 'iwl_pcie_rx_init' at drivers/net/wireless/intel/iwlwifi/pcie/rx.c:976:3:
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_857' declared with attribute error: BUILD_BUG_ON failed: (((0xF00) + (1ULL << __ffs64(0xF00))) & (((0xF00) + (1ULL << __ffs64(0xF00))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-fh.h:487:34: note: in expansion of macro 'FIELD_PREP'
    #define RFH_GEN_CFG_VAL(_n, _v)  FIELD_PREP(RFH_GEN_CFG_ ## _n, _v)
                                     ^~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/pcie/rx.c:857:11: note: in expansion of macro 'RFH_GEN_CFG_VAL'
              RFH_GEN_CFG_VAL(DEFAULT_RXQ_NUM, 0) |
              ^~~~~~~~~~~~~~~
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_862' declared with attribute error: BUILD_BUG_ON failed: ((((1UL << (4))) + (1ULL << __ffs64((1UL << (4))))) & ((((1UL << (4))) + (1ULL << __ffs64((1UL << (4))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-fh.h:487:34: note: in expansion of macro 'FIELD_PREP'
    #define RFH_GEN_CFG_VAL(_n, _v)  FIELD_PREP(RFH_GEN_CFG_ ## _n, _v)
                                     ^~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/rx.c:859:11: note: in expansion of macro 'RFH_GEN_CFG_VAL'
              RFH_GEN_CFG_VAL(RB_CHUNK_SIZE,
              ^~~~~~~~~~~~~~~
--
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from include/linux/skbuff.h:17,
                    from include/linux/if_ether.h:23,
                    from include/linux/etherdevice.h:25,
                    from drivers/net/wireless/intel/iwlwifi/pcie/tx.c:31:
   drivers/net/wireless/intel/iwlwifi/pcie/tx.c: In function 'iwl_trans_pcie_txq_enable':
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1368' declared with attribute error: BUILD_BUG_ON failed: ((((0x0000007F)) + (1ULL << __ffs64((0x0000007F)))) & ((((0x0000007F)) + (1ULL << __ffs64((0x0000007F)))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-prph.h:256:41: note: in expansion of macro 'FIELD_PREP'
    #define SCD_QUEUE_CTX_REG2_VAL(_n, _v)  FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
                                            ^~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1368:4: note: in expansion of macro 'SCD_QUEUE_CTX_REG2_VAL'
       SCD_QUEUE_CTX_REG2_VAL(WIN_SIZE, frame_limit) |
       ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1369' declared with attribute error: BUILD_BUG_ON failed: ((((0x007F0000)) + (1ULL << __ffs64((0x007F0000)))) & ((((0x007F0000)) + (1ULL << __ffs64((0x007F0000)))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-prph.h:256:41: note: in expansion of macro 'FIELD_PREP'
    #define SCD_QUEUE_CTX_REG2_VAL(_n, _v)  FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
                                            ^~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1369:4: note: in expansion of macro 'SCD_QUEUE_CTX_REG2_VAL'
       SCD_QUEUE_CTX_REG2_VAL(FRAME_LIMIT, frame_limit));
       ^~~~~~~~~~~~~~~~~~~~~~

vim +/__compiletime_assert_857 +576 include/linux/compiler.h

9a8ab1c3 Daniel Santos 2013-02-21  562  
9a8ab1c3 Daniel Santos 2013-02-21  563  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21  564  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21  565  
9a8ab1c3 Daniel Santos 2013-02-21  566  /**
9a8ab1c3 Daniel Santos 2013-02-21  567   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  568   * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21  569   * @msg:       a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  570   *
9a8ab1c3 Daniel Santos 2013-02-21  571   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21  572   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21  573   * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21  574   */
9a8ab1c3 Daniel Santos 2013-02-21  575  #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @576  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21  577  

:::::: The code at line 576 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39531 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-09 22:57   ` kbuild test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-10-09 22:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild-all, Jakub Kicinski, Arnd Bergmann, Andrew Morton,
	kbuild test robot, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 10959 bytes --]

Hi Geert,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc4]
[cannot apply to next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/bitfield-Use-__ffs64-x-to-fix-missing-__ffsdi2/20171010-050009
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/current.h:4:0,
                    from include/linux/sched.h:11,
                    from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:31:
   In function 'iwl_pcie_rx_mq_hw_init',
       inlined from 'iwl_pcie_rx_init' at drivers/net/wireless/intel/iwlwifi/pcie/rx.c:976:3:
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_857' declared with attribute error: BUILD_BUG_ON failed: (((0xF00) + (1ULL << __ffs64(0xF00))) & (((0xF00) + (1ULL << __ffs64(0xF00))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-fh.h:487:34: note: in expansion of macro 'FIELD_PREP'
    #define RFH_GEN_CFG_VAL(_n, _v)  FIELD_PREP(RFH_GEN_CFG_ ## _n, _v)
                                     ^~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/pcie/rx.c:857:11: note: in expansion of macro 'RFH_GEN_CFG_VAL'
              RFH_GEN_CFG_VAL(DEFAULT_RXQ_NUM, 0) |
              ^~~~~~~~~~~~~~~
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_862' declared with attribute error: BUILD_BUG_ON failed: ((((1UL << (4))) + (1ULL << __ffs64((1UL << (4))))) & ((((1UL << (4))) + (1ULL << __ffs64((1UL << (4))))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-fh.h:487:34: note: in expansion of macro 'FIELD_PREP'
    #define RFH_GEN_CFG_VAL(_n, _v)  FIELD_PREP(RFH_GEN_CFG_ ## _n, _v)
                                     ^~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/rx.c:859:11: note: in expansion of macro 'RFH_GEN_CFG_VAL'
              RFH_GEN_CFG_VAL(RB_CHUNK_SIZE,
              ^~~~~~~~~~~~~~~
--
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from include/linux/skbuff.h:17,
                    from include/linux/if_ether.h:23,
                    from include/linux/etherdevice.h:25,
                    from drivers/net/wireless/intel/iwlwifi/pcie/tx.c:31:
   drivers/net/wireless/intel/iwlwifi/pcie/tx.c: In function 'iwl_trans_pcie_txq_enable':
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1368' declared with attribute error: BUILD_BUG_ON failed: ((((0x0000007F)) + (1ULL << __ffs64((0x0000007F)))) & ((((0x0000007F)) + (1ULL << __ffs64((0x0000007F)))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-prph.h:256:41: note: in expansion of macro 'FIELD_PREP'
    #define SCD_QUEUE_CTX_REG2_VAL(_n, _v)  FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
                                            ^~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1368:4: note: in expansion of macro 'SCD_QUEUE_CTX_REG2_VAL'
       SCD_QUEUE_CTX_REG2_VAL(WIN_SIZE, frame_limit) |
       ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_1369' declared with attribute error: BUILD_BUG_ON failed: ((((0x007F0000)) + (1ULL << __ffs64((0x007F0000)))) & ((((0x007F0000)) + (1ULL << __ffs64((0x007F0000)))) - 1)) != 0
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   include/linux/build_bug.h:19:2: note: in expansion of macro 'BUILD_BUG_ON'
     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
     ^~~~~~~~~~~~
   include/linux/bitfield.h:62:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
      __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +   \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:89:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
      ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/iwl-prph.h:256:41: note: in expansion of macro 'FIELD_PREP'
    #define SCD_QUEUE_CTX_REG2_VAL(_n, _v)  FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
                                            ^~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1369:4: note: in expansion of macro 'SCD_QUEUE_CTX_REG2_VAL'
       SCD_QUEUE_CTX_REG2_VAL(FRAME_LIMIT, frame_limit));
       ^~~~~~~~~~~~~~~~~~~~~~

vim +/__compiletime_assert_857 +576 include/linux/compiler.h

9a8ab1c3 Daniel Santos 2013-02-21  562  
9a8ab1c3 Daniel Santos 2013-02-21  563  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21  564  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21  565  
9a8ab1c3 Daniel Santos 2013-02-21  566  /**
9a8ab1c3 Daniel Santos 2013-02-21  567   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  568   * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21  569   * @msg:       a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21  570   *
9a8ab1c3 Daniel Santos 2013-02-21  571   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21  572   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21  573   * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21  574   */
9a8ab1c3 Daniel Santos 2013-02-21  575  #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @576  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21  577  

:::::: The code at line 576 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39531 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
  2017-10-09 22:53 ` Jakub Kicinski
@ 2017-10-10  7:03     ` Geert Uytterhoeven
  0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2017-10-10  7:03 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Geert Uytterhoeven, Arnd Bergmann, Andrew Morton,
	kbuild test robot, Linux-Arch, linux-kernel

Hi Jakub,

On Tue, Oct 10, 2017 at 12:53 AM, Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
> On Mon,  9 Oct 2017 10:40:49 +0200, Geert Uytterhoeven wrote:
>> On most architectures[*], gcc turns __builtin_ffsll() into a call to
>> __ffsdi2(), which is not provided by any architecture, leading to
>> failures like:
>>
>>     rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'
>>
>> To fix this, use __ffs64() instead, which is available on all
>> architectures.
>>
>> [*] Known exceptions are some 64-bit architectures like amd64, arm64,
>>     ia64, powerpc64, and tilegx.
>>
>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>> Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  include/linux/bitfield.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
>> index 8b9d6fff002db113..0a827677372756fa 100644
>> --- a/include/linux/bitfield.h
>> +++ b/include/linux/bitfield.h
>> @@ -15,6 +15,7 @@
>>  #ifndef _LINUX_BITFIELD_H
>>  #define _LINUX_BITFIELD_H
>>
>> +#include <linux/bitops.h>
>>  #include <linux/bug.h>
>>
>>  /*
>> @@ -46,7 +47,7 @@
>>   *  reg |= FIELD_PREP(REG_FIELD_C, c);
>>   */
>>
>> -#define __bf_shf(x) (__builtin_ffsll(x) - 1)
>> +#define __bf_shf(x) __ffs64(x)
>
> Hm.  The build bot failure made me think.  I think rcar-gen3-cpg.c may
> be doing something wrong here, could you point me at the patch in
> question?  I don't see any FIELD_* there in Linus's tree.

See series "[PATCH v3 0/6] clk: renesas: r8a779[56]: Add Z and Z2 clock
support" (https://www.spinics.net/lists/arm-kernel/msg609499.html).

> __bf_shf() is supposed to be used with constant masks only, therefore
> the call must be optimized away completely.
>
>>  #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)                    \
>>       ({                                                              \

IC.

Yes, it looks like __ffs64() can't be optimized away like __builtin_ffsll() :-(

Apparently the patch series above uses __bf_shf() directly, to avoid the
BUILD_BUG_ON_MSG(), which doesn't work when the call isn't optimized away.
Sorry for not noticing that before...

One way to fix that (non-)API abuse would be to get rid of __bf_shf(),
and open code it as __builtin_ffsll(x) - 1 everywhere...

What do you think?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-10  7:03     ` Geert Uytterhoeven
  0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2017-10-10  7:03 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Geert Uytterhoeven, Arnd Bergmann, Andrew Morton,
	kbuild test robot, Linux-Arch, linux-kernel

Hi Jakub,

On Tue, Oct 10, 2017 at 12:53 AM, Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
> On Mon,  9 Oct 2017 10:40:49 +0200, Geert Uytterhoeven wrote:
>> On most architectures[*], gcc turns __builtin_ffsll() into a call to
>> __ffsdi2(), which is not provided by any architecture, leading to
>> failures like:
>>
>>     rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'
>>
>> To fix this, use __ffs64() instead, which is available on all
>> architectures.
>>
>> [*] Known exceptions are some 64-bit architectures like amd64, arm64,
>>     ia64, powerpc64, and tilegx.
>>
>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>> Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  include/linux/bitfield.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
>> index 8b9d6fff002db113..0a827677372756fa 100644
>> --- a/include/linux/bitfield.h
>> +++ b/include/linux/bitfield.h
>> @@ -15,6 +15,7 @@
>>  #ifndef _LINUX_BITFIELD_H
>>  #define _LINUX_BITFIELD_H
>>
>> +#include <linux/bitops.h>
>>  #include <linux/bug.h>
>>
>>  /*
>> @@ -46,7 +47,7 @@
>>   *  reg |= FIELD_PREP(REG_FIELD_C, c);
>>   */
>>
>> -#define __bf_shf(x) (__builtin_ffsll(x) - 1)
>> +#define __bf_shf(x) __ffs64(x)
>
> Hm.  The build bot failure made me think.  I think rcar-gen3-cpg.c may
> be doing something wrong here, could you point me at the patch in
> question?  I don't see any FIELD_* there in Linus's tree.

See series "[PATCH v3 0/6] clk: renesas: r8a779[56]: Add Z and Z2 clock
support" (https://www.spinics.net/lists/arm-kernel/msg609499.html).

> __bf_shf() is supposed to be used with constant masks only, therefore
> the call must be optimized away completely.
>
>>  #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)                    \
>>       ({                                                              \

IC.

Yes, it looks like __ffs64() can't be optimized away like __builtin_ffsll() :-(

Apparently the patch series above uses __bf_shf() directly, to avoid the
BUILD_BUG_ON_MSG(), which doesn't work when the call isn't optimized away.
Sorry for not noticing that before...

One way to fix that (non-)API abuse would be to get rid of __bf_shf(),
and open code it as __builtin_ffsll(x) - 1 everywhere...

What do you think?

Thanks!

Gr{oetje,eeting}s,

                        Geert

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
  2017-10-10  7:03     ` Geert Uytterhoeven
  (?)
@ 2017-10-10 15:06     ` Jakub Kicinski
  -1 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2017-10-10 15:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Arnd Bergmann, Andrew Morton,
	kbuild test robot, Linux-Arch, linux-kernel

On Tue, 10 Oct 2017 09:03:50 +0200, Geert Uytterhoeven wrote:
> Hi Jakub,
> 
> On Tue, Oct 10, 2017 at 12:53 AM, Jakub Kicinski
> <jakub.kicinski@netronome.com> wrote:
> > On Mon,  9 Oct 2017 10:40:49 +0200, Geert Uytterhoeven wrote:  
> >> On most architectures[*], gcc turns __builtin_ffsll() into a call to
> >> __ffsdi2(), which is not provided by any architecture, leading to
> >> failures like:
> >>
> >>     rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'
> >>
> >> To fix this, use __ffs64() instead, which is available on all
> >> architectures.
> >>
> >> [*] Known exceptions are some 64-bit architectures like amd64, arm64,
> >>     ia64, powerpc64, and tilegx.
> >>
> >> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> >> Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> ---
> >>  include/linux/bitfield.h | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
> >> index 8b9d6fff002db113..0a827677372756fa 100644
> >> --- a/include/linux/bitfield.h
> >> +++ b/include/linux/bitfield.h
> >> @@ -15,6 +15,7 @@
> >>  #ifndef _LINUX_BITFIELD_H
> >>  #define _LINUX_BITFIELD_H
> >>
> >> +#include <linux/bitops.h>
> >>  #include <linux/bug.h>
> >>
> >>  /*
> >> @@ -46,7 +47,7 @@
> >>   *  reg |= FIELD_PREP(REG_FIELD_C, c);
> >>   */
> >>
> >> -#define __bf_shf(x) (__builtin_ffsll(x) - 1)
> >> +#define __bf_shf(x) __ffs64(x)  
> >
> > Hm.  The build bot failure made me think.  I think rcar-gen3-cpg.c may
> > be doing something wrong here, could you point me at the patch in
> > question?  I don't see any FIELD_* there in Linus's tree.  
> 
> See series "[PATCH v3 0/6] clk: renesas: r8a779[56]: Add Z and Z2 clock
> support" (https://www.spinics.net/lists/arm-kernel/msg609499.html).
> 
> > __bf_shf() is supposed to be used with constant masks only, therefore
> > the call must be optimized away completely.
> >  
> >>  #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)                    \
> >>       ({                                                              \  
> 
> IC.
> 
> Yes, it looks like __ffs64() can't be optimized away like __builtin_ffsll() :-(
> 
> Apparently the patch series above uses __bf_shf() directly, to avoid the
> BUILD_BUG_ON_MSG(), which doesn't work when the call isn't optimized away.
> Sorry for not noticing that before...
> 
> One way to fix that (non-)API abuse would be to get rid of __bf_shf(),
> and open code it as __builtin_ffsll(x) - 1 everywhere...
> 
> What do you think?

I'm starting to feel like we/I should come up with a way to convert the
masks into something that can be passed to functions :(  The "mask must
be constant" problem is coming up again and again.  The only problem is
I'm not sure how to pack the mask+shift into a single argument :(  Also
the mask can be 32 or 64 bit, it would be nice to not force the output
to always be 64bit...

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-10 15:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09  8:40 [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2() Geert Uytterhoeven
2017-10-09 14:34 ` Jakub Kicinski
2017-10-09 22:37 ` kbuild test robot
2017-10-09 22:37   ` kbuild test robot
2017-10-09 22:37   ` kbuild test robot
2017-10-09 22:53 ` Jakub Kicinski
2017-10-10  7:03   ` Geert Uytterhoeven
2017-10-10  7:03     ` Geert Uytterhoeven
2017-10-10 15:06     ` Jakub Kicinski
2017-10-09 22:57 ` kbuild test robot
2017-10-09 22:57   ` kbuild test robot
2017-10-09 22:57   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.