All of lore.kernel.org
 help / color / mirror / Atom feed
* [bpf-next:master 35/79] kernel/bpf/hashtab.c:1292:14: error: call to undeclared function 'arch_cmpxchg_local'; ISO C99 and later do not support implicit function declarations
@ 2026-10-18 12:06 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-10-18 12:06 UTC (permalink / raw)
  To: Josef Bacik; +Cc: llvm, oe-kbuild-all, Alexei Starovoitov

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
head:   a6303535c2ad9d49598d52556183911f02287791
commit: ccb88db8dac8fabde58656d5d4a33711e89c480a [35/79] bpf: Don't hand out a linked element as extra element
config: hexagon-randconfig-1001-20261018 (https://download.01.org/0day-ci/archive/20261018/202610182048.aEaiBP8W-lkp@intel.com/config)
compiler: clang version 21.1.8 (https://github.com/llvm/llvm-project 2078da43e25a4623cab2d0d60decddf709aaea28)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261018/202610182048.aEaiBP8W-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610182048.aEaiBP8W-lkp@intel.com/

All errors (new ones prefixed by >>):

>> kernel/bpf/hashtab.c:1292:14: error: call to undeclared function 'arch_cmpxchg_local'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1292 |                         } while (!try_cmpxchg_local(pl_new, &l_new, NULL));
         |                                   ^
   include/linux/atomic/atomic-instrumented.h:5022:2: note: expanded from macro 'try_cmpxchg_local'
    5022 |         raw_try_cmpxchg_local(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^
   include/linux/atomic/atomic-arch-fallback.h:392:9: note: expanded from macro 'raw_try_cmpxchg_local'
     392 |         ___r = raw_cmpxchg_local((_ptr), ___o, (_new)); \
         |                ^
   include/linux/atomic/atomic-arch-fallback.h:384:27: note: expanded from macro 'raw_cmpxchg_local'
     384 | #define raw_cmpxchg_local arch_cmpxchg_local
         |                           ^
>> kernel/bpf/hashtab.c:1292:14: error: incompatible integer to pointer conversion assigning to 'typeof (*(__ai_ptr))' (aka 'struct htab_elem *') from 'int' [-Wint-conversion]
    1292 |                         } while (!try_cmpxchg_local(pl_new, &l_new, NULL));
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:5022:2: note: expanded from macro 'try_cmpxchg_local'
    5022 |         raw_try_cmpxchg_local(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:392:7: note: expanded from macro 'raw_try_cmpxchg_local'
     392 |         ___r = raw_cmpxchg_local((_ptr), ___o, (_new)); \
         |              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 errors generated.


vim +/arch_cmpxchg_local +1292 kernel/bpf/hashtab.c

  1268	
  1269	static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
  1270						 void *value, u32 key_size, u32 hash,
  1271						 bool percpu, bool onallcpus,
  1272						 struct htab_elem *old_elem, u64 map_flags)
  1273	{
  1274		u32 size = htab->map.value_size;
  1275		bool prealloc = htab_is_prealloc(htab);
  1276		struct htab_elem *l_new, **pl_new;
  1277		void __percpu *pptr;
  1278	
  1279		if (prealloc) {
  1280			if (old_elem) {
  1281				/* if we're updating the existing element,
  1282				 * use per-cpu extra elems to avoid freelist_pop/push.
  1283				 * The caller puts old_elem into the slot once it is
  1284				 * unlinked. Until then the slot is empty for an NMI
  1285				 * or a kprobe that updates this map on this cpu.
  1286				 */
  1287				pl_new = this_cpu_ptr(htab->extra_elems);
  1288				l_new = READ_ONCE(*pl_new);
  1289				do {
  1290					if (!l_new)
  1291						return ERR_PTR(-EBUSY);
> 1292				} while (!try_cmpxchg_local(pl_new, &l_new, NULL));
  1293			} else {
  1294				struct pcpu_freelist_node *l;
  1295	
  1296				l = __pcpu_freelist_pop(&htab->freelist);
  1297				if (!l)
  1298					return ERR_PTR(-E2BIG);
  1299				l_new = container_of(l, struct htab_elem, fnode);
  1300				bpf_map_inc_elem_count(&htab->map);
  1301			}
  1302		} else {
  1303			void *container;
  1304	
  1305			if (is_map_full(htab))
  1306				if (!old_elem)
  1307					/* when map is full and update() is replacing
  1308					 * old element, it's ok to allocate, since
  1309					 * old element will be freed immediately.
  1310					 * Otherwise return an error
  1311					 */
  1312					return ERR_PTR(-E2BIG);
  1313			inc_elem_count(htab);
  1314			container = bpf_mem_cache_alloc(&htab->ma);
  1315			if (!container) {
  1316				l_new = ERR_PTR(-ENOMEM);
  1317				goto dec_count;
  1318			}
  1319			l_new = container + htab->elem_offset;
  1320		}
  1321	
  1322		if (htab_has_hash(htab))
  1323			memcpy(l_new->key, key, key_size);
  1324	
  1325		if (percpu) {
  1326			if (prealloc) {
  1327				pptr = htab_elem_get_ptr(l_new, key_size);
  1328			} else {
  1329				/* alloc_percpu zero-fills */
  1330				void *ptr = bpf_mem_cache_alloc(&htab->pcpu_ma);
  1331	
  1332				if (!ptr) {
  1333					bpf_mem_cache_free(&htab->ma, htab_elem_container(htab, l_new));
  1334					l_new = ERR_PTR(-ENOMEM);
  1335					goto dec_count;
  1336				}
  1337				htab_elem_set_ptr_to_pptr(htab, l_new, ptr);
  1338				pptr = *(void __percpu **)ptr;
  1339			}
  1340	
  1341			pcpu_init_value(htab, pptr, value, onallcpus, map_flags);
  1342	
  1343			if (!prealloc)
  1344				htab_elem_set_ptr(l_new, key_size, pptr);
  1345		} else if (fd_htab_map_needs_adjust(htab)) {
  1346			size = round_up(size, 8);
  1347			memcpy(htab_elem_value(l_new, key_size), value, size);
  1348		} else if (map_flags & BPF_F_LOCK) {
  1349			copy_map_value_locked(&htab->map,
  1350					      htab_elem_value(l_new, key_size),
  1351					      value, false);
  1352		} else {
  1353			copy_map_value(&htab->map, htab_elem_value(l_new, key_size), value);
  1354		}
  1355	
  1356		if (htab_has_hash(htab))
  1357			htab_elem_set_hash(l_new, hash);
  1358		else
  1359			WRITE_ONCE(*(unsigned long *)l_new->key,
  1360				   htab_zero_extend_key(key, key_size));
  1361		return l_new;
  1362	dec_count:
  1363		dec_elem_count(htab);
  1364		return l_new;
  1365	}
  1366	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-18 12:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 12:06 [bpf-next:master 35/79] kernel/bpf/hashtab.c:1292:14: error: call to undeclared function 'arch_cmpxchg_local'; ISO C99 and later do not support implicit function declarations kernel 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.