tree:
https://github.com/norov/linux find_bit_static
head: a18d2664b9ad8a08be90d073ef0673f62d8a186e
commit: 0cbe876d91e58013824b3628bd98ccf7ec1c87f4 [5/6] lib: add fast path for
find_first_*_bit() and find_last_bit()
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://github.com/norov/linux/commit/0cbe876d91e58013824b3628bd98ccf7ec1...
git remote add norov
https://github.com/norov/linux
git fetch --no-tags norov find_bit_static
git checkout 0cbe876d91e58013824b3628bd98ccf7ec1c87f4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h: In function 'find_next_and_bit':
include/asm-generic/bitops/find.h:60:16: error: implicit declaration of function
'__ffs' [-Werror=implicit-function-declaration]
60 | return val ? __ffs(val) : size;
| ^~~~~
include/asm-generic/bitops/find.h: In function 'find_last_bit':
> include/asm-generic/bitops/find.h:164:16: error: implicit
declaration of function '__fls' [-Werror=implicit-function-declaration]
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
arch/m68k/include/asm/bitops.h: At top level:
arch/m68k/include/asm/bitops.h:497:29: error: conflicting types for '__ffs'
497 | static inline unsigned long __ffs(unsigned long x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h:60:16: note: previous implicit declaration of
'__ffs' was here
60 | return val ? __ffs(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
> arch/m68k/include/asm/bitops.h:515:19: error: static declaration
of '__fls' follows non-static declaration
515 | static inline int
__fls(int x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h:164:16: note: previous implicit declaration of
'__fls' was here
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:528,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/le.h: In function 'find_next_zero_bit_le':
include/asm-generic/bitops/le.h:45:17: warning: dereferencing 'void *' pointer
45 | fz = ffz(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:45:17: error: void value not ignored as it ought to be
include/asm-generic/bitops/le.h: In function 'find_next_bit_le':
include/asm-generic/bitops/le.h:64:19: warning: dereferencing 'void *' pointer
64 | fs = __ffs(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:64:19: error: void value not ignored as it ought to be
cc1: some warnings being treated as errors
--
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
include/asm-generic/bitops/find.h: In function 'find_next_and_bit':
include/asm-generic/bitops/find.h:60:16: error: implicit declaration of function
'__ffs' [-Werror=implicit-function-declaration]
60 | return val ? __ffs(val) : size;
| ^~~~~
include/asm-generic/bitops/find.h: In function 'find_last_bit':
> include/asm-generic/bitops/find.h:164:16: error: implicit
declaration of function '__fls' [-Werror=implicit-function-declaration]
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
arch/m68k/include/asm/bitops.h: At top level:
arch/m68k/include/asm/bitops.h:497:29: error: conflicting types for '__ffs'
497 | static inline unsigned long __ffs(unsigned long x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
include/asm-generic/bitops/find.h:60:16: note: previous implicit declaration of
'__ffs' was here
60 | return val ? __ffs(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
> arch/m68k/include/asm/bitops.h:515:19: error: static declaration
of '__fls' follows non-static declaration
515 | static inline int
__fls(int x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
include/asm-generic/bitops/find.h:164:16: note: previous implicit declaration of
'__fls' was here
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:528,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
include/asm-generic/bitops/le.h: In function 'find_next_zero_bit_le':
include/asm-generic/bitops/le.h:45:17: warning: dereferencing 'void *' pointer
45 | fz = ffz(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:45:17: error: void value not ignored as it ought to be
include/asm-generic/bitops/le.h: In function 'find_next_bit_le':
include/asm-generic/bitops/le.h:64:19: warning: dereferencing 'void *' pointer
64 | fs = __ffs(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:64:19: error: void value not ignored as it ought to be
In file included from include/linux/dcache.h:14,
from include/linux/fs.h:8,
from include/linux/debugfs.h:15,
from kernel//time/test_udelay.c:13:
include/linux/lockref.h: At top level:
include/linux/lockref.h:19:10: fatal error: generated/bounds.h: No such file or
directory
19 | #include <generated/bounds.h>
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
compilation terminated.
--
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h: In function 'find_next_and_bit':
include/asm-generic/bitops/find.h:60:16: error: implicit declaration of function
'__ffs' [-Werror=implicit-function-declaration]
60 | return val ? __ffs(val) : size;
| ^~~~~
include/asm-generic/bitops/find.h: In function 'find_last_bit':
> include/asm-generic/bitops/find.h:164:16: error: implicit
declaration of function '__fls' [-Werror=implicit-function-declaration]
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
arch/m68k/include/asm/bitops.h: At top level:
arch/m68k/include/asm/bitops.h:497:29: error: conflicting types for '__ffs'
497 | static inline unsigned long __ffs(unsigned long x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h:60:16: note: previous implicit declaration of
'__ffs' was here
60 | return val ? __ffs(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
> arch/m68k/include/asm/bitops.h:515:19: error: static declaration
of '__fls' follows non-static declaration
515 | static inline int
__fls(int x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h:164:16: note: previous implicit declaration of
'__fls' was here
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:528,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/le.h: In function 'find_next_zero_bit_le':
include/asm-generic/bitops/le.h:45:17: warning: dereferencing 'void *' pointer
45 | fz = ffz(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:45:17: error: void value not ignored as it ought to be
include/asm-generic/bitops/le.h: In function 'find_next_bit_le':
include/asm-generic/bitops/le.h:64:19: warning: dereferencing 'void *' pointer
64 | fs = __ffs(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:64:19: error: void value not ignored as it ought to be
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:117: kernel/bounds.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1220: prepare0] Error 2
make[1]: Target 'modules_prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'modules_prepare' not remade because of errors.
--
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h: In function 'find_next_and_bit':
include/asm-generic/bitops/find.h:60:16: error: implicit declaration of function
'__ffs' [-Werror=implicit-function-declaration]
60 | return val ? __ffs(val) : size;
| ^~~~~
include/asm-generic/bitops/find.h: In function 'find_last_bit':
> include/asm-generic/bitops/find.h:164:16: error: implicit
declaration of function '__fls' [-Werror=implicit-function-declaration]
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
arch/m68k/include/asm/bitops.h: At top level:
arch/m68k/include/asm/bitops.h:497:29: error: conflicting types for '__ffs'
497 | static inline unsigned long __ffs(unsigned long x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h:60:16: note: previous implicit declaration of
'__ffs' was here
60 | return val ? __ffs(val) : size;
| ^~~~~
In file included from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
> arch/m68k/include/asm/bitops.h:515:19: error: static declaration
of '__fls' follows non-static declaration
515 | static inline int
__fls(int x)
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:443,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/find.h:164:16: note: previous implicit declaration of
'__fls' was here
164 | return val ? __fls(val) : size;
| ^~~~~
In file included from arch/m68k/include/asm/bitops.h:528,
from include/linux/bitops.h:50,
from include/linux/kernel.h:11,
from include/asm-generic/bug.h:20,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/asm-generic/bitops/le.h: In function 'find_next_zero_bit_le':
include/asm-generic/bitops/le.h:45:17: warning: dereferencing 'void *' pointer
45 | fz = ffz(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:45:17: error: void value not ignored as it ought to be
include/asm-generic/bitops/le.h: In function 'find_next_bit_le':
include/asm-generic/bitops/le.h:64:19: warning: dereferencing 'void *' pointer
64 | fs = __ffs(swab(*addr & BITMAP_FIRST_WORD_MASK(offset)));
| ^~~~~
include/asm-generic/bitops/le.h:64:19: error: void value not ignored as it ought to be
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:117: kernel/bounds.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1220: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.
vim +/__fls +164 include/asm-generic/bitops/find.h
34
35 #ifndef find_next_and_bit
36 /**
37 * find_next_and_bit - find the next set bit in both memory regions
38 * @addr1: The first address to base the search on
39 * @addr2: The second address to base the search on
40 * @offset: The bitnumber to start searching at
41 * @size: The bitmap size in bits
42 *
43 * Returns the bit number for the next set bit
44 * If no bits are set, returns @size.
45 */
46 static __always_inline
47 unsigned long find_next_and_bit(const unsigned long *addr1,
48 const unsigned long *addr2, unsigned long size,
49 unsigned long offset)
50 {
51 if (small_const_nbits(size)) {
52 unsigned long val;
53
54 if (unlikely(offset >= size))
55 return size;
56
57 val = *addr1 & *addr2 & BITMAP_FIRST_WORD_MASK(offset)
58 & BITMAP_LAST_WORD_MASK(size);
59
60 return val ? __ffs(val) : size;
61 }
62
63 return _find_next_bit(addr1, addr2, size, offset, 0UL, 0);
64 }
65 #endif
66
67 #ifndef find_next_zero_bit
68 /**
69 * find_next_zero_bit - find the next cleared bit in a memory region
70 * @addr: The address to base the search on
71 * @offset: The bitnumber to start searching at
72 * @size: The bitmap size in bits
73 *
74 * Returns the bit number of the next zero bit
75 * If no bits are zero, returns @size.
76 */
77 static __always_inline
78 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
79 unsigned long offset)
80 {
81 if (small_const_nbits(size)) {
82 unsigned long val;
83
84 if (unlikely(offset >= size))
85 return size;
86
87 val = *addr | !BITMAP_FIRST_WORD_MASK(offset)
88 | !BITMAP_LAST_WORD_MASK(size);
89
90 return val == ~0UL ? size : ffz(val);
91 }
92
93 return _find_next_bit(addr, NULL, size, offset, ~0UL, 0);
94 }
95 #endif
96
97 #ifdef CONFIG_GENERIC_FIND_FIRST_BIT
98
99 /**
100 * find_first_bit - find the first set bit in a memory region
101 * @addr: The address to start the search at
102 * @size: The maximum number of bits to search
103 *
104 * Returns the bit number of the first set bit.
105 * If no bits are set, returns @size.
106 */
107 static __always_inline
108 unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
109 {
110 if (small_const_nbits(size)) {
111 unsigned long val = *addr & BITMAP_LAST_WORD_MASK(size);
112 return val ? __ffs(val) : size;
113 }
114
115 return _find_first_bit(addr, size);
116 }
117
118 /**
119 * find_first_zero_bit - find the first cleared bit in a memory region
120 * @addr: The address to start the search at
121 * @size: The maximum number of bits to search
122 *
123 * Returns the bit number of the first cleared bit.
124 * If no bits are zero, returns @size.
125 */
126 static __always_inline
127 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
128 {
129 if (small_const_nbits(size)) {
130 unsigned long idx;
131 if (*addr == ~0UL)
132 return size;
133
134 idx = ffz(*addr);
135 return idx < size ? idx : size;
136 }
137
138 return _find_first_bit(addr, size);
139 }
140 #else /* CONFIG_GENERIC_FIND_FIRST_BIT */
141
142 #ifndef find_first_bit
143 #define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
144 #endif
145 #ifndef find_first_zero_bit
146 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
147 #endif
148
149 #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
150
151 #ifndef find_last_bit
152 /**
153 * find_last_bit - find the last set bit in a memory region
154 * @addr: The address to start the search at
155 * @size: The number of bits to search
156 *
157 * Returns the bit number of the last set bit, or size.
158 */
159 static __always_inline
160 unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
161 {
162 if (small_const_nbits(size)) {
163 unsigned long val = *addr & BITMAP_LAST_WORD_MASK(size);
164 return val ? __fls(val) : size;
165 }
166
167 return _find_last_bit(addr, size);
168 }
169 #endif
170
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org