From: kernel test robot <lkp@intel.com>
To: I Hsin Cheng <richard120310@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH] cpumask: Implement "random" version of cpumask_any_but()
Date: Mon, 13 Jan 2025 17:45:30 +0800 [thread overview]
Message-ID: <202501131709.T02YI6Rr-lkp@intel.com> (raw)
In-Reply-To: <20250113061839.22131-1-richard120310@gmail.com>
Hi Hsin,
[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.13-rc7 next-20250113]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/I-Hsin-Cheng/cpumask-Implement-random-version-of-cpumask_any_but/20250113-142111
base: linus/master
patch link: https://lore.kernel.org/r/20250113061839.22131-1-richard120310%40gmail.com
patch subject: [RFC PATCH] cpumask: Implement "random" version of cpumask_any_but()
config: i386-buildonly-randconfig-001-20250113 (https://download.01.org/0day-ci/archive/20250113/202501131709.T02YI6Rr-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250113/202501131709.T02YI6Rr-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/202501131709.T02YI6Rr-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:15:
In file included from include/linux/completion.h:12:
In file included from include/linux/swait.h:7:
In file included from include/linux/spinlock.h:63:
In file included from include/linux/lockdep.h:14:
In file included from include/linux/smp.h:13:
>> include/linux/cpumask.h:407:11: error: call to undeclared function 'cpumask_weight'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
407 | weight = cpumask_weight(mask);
| ^
>> include/linux/cpumask.h:408:6: error: call to undeclared function 'get_random_u32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
408 | n = get_random_u32() % weight;
| ^
>> include/linux/cpumask.h:415:6: error: call to undeclared function 'cpumask_nth'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
415 | i = cpumask_nth(n, mask);
| ^
include/linux/cpumask.h:415:6: note: did you mean 'cpumask_next'?
include/linux/cpumask.h:217:14: note: 'cpumask_next' declared here
217 | unsigned int cpumask_next(int n, const struct cpumask *srcp)
| ^
>> include/linux/cpumask.h:450:14: error: static declaration of 'cpumask_nth' follows non-static declaration
450 | unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
| ^
include/linux/cpumask.h:415:6: note: previous implicit declaration is here
415 | i = cpumask_nth(n, mask);
| ^
>> include/linux/cpumask.h:779:37: error: static declaration of 'cpumask_weight' follows non-static declaration
779 | static __always_inline unsigned int cpumask_weight(const struct cpumask *srcp)
| ^
include/linux/cpumask.h:407:11: note: previous implicit declaration is here
407 | weight = cpumask_weight(mask);
| ^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:17:
In file included from include/linux/slab.h:16:
In file included from include/linux/gfp.h:7:
In file included from include/linux/mmzone.h:18:
In file included from include/linux/nodemask.h:98:
>> include/linux/random.h:42:5: error: conflicting types for 'get_random_u32'
42 | u32 get_random_u32(void);
| ^
include/linux/cpumask.h:408:6: note: previous implicit declaration is here
408 | n = get_random_u32() % weight;
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[2]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
24 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[2]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
24 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
114 | return (set1->sig[3] == set2->sig[3]) &&
| ^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
24 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:114:27: warning: array index 3 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
114 | return (set1->sig[3] == set2->sig[3]) &&
| ^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
24 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:115:5: warning: array index 2 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
115 | (set1->sig[2] == set2->sig[2]) &&
| ^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
24 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:115:21: warning: array index 2 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
115 | (set1->sig[2] == set2->sig[2]) &&
| ^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
24 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
vim +/cpumask_weight +407 include/linux/cpumask.h
317
318 /**
319 * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location
320 * @cpu: the (optionally unsigned) integer iterator
321 * @mask: the cpumask pointer
322 * @start: the start location
323 *
324 * The implementation does not assume any bit in @mask is set (including @start).
325 *
326 * After the loop, cpu is >= nr_cpu_ids.
327 */
328 #define for_each_cpu_wrap(cpu, mask, start) \
329 for_each_set_bit_wrap(cpu, cpumask_bits(mask), small_cpumask_bits, start)
330
331 /**
332 * for_each_cpu_and - iterate over every cpu in both masks
333 * @cpu: the (optionally unsigned) integer iterator
334 * @mask1: the first cpumask pointer
335 * @mask2: the second cpumask pointer
336 *
337 * This saves a temporary CPU mask in many places. It is equivalent to:
338 * struct cpumask tmp;
339 * cpumask_and(&tmp, &mask1, &mask2);
340 * for_each_cpu(cpu, &tmp)
341 * ...
342 *
343 * After the loop, cpu is >= nr_cpu_ids.
344 */
345 #define for_each_cpu_and(cpu, mask1, mask2) \
346 for_each_and_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
347
348 /**
349 * for_each_cpu_andnot - iterate over every cpu present in one mask, excluding
350 * those present in another.
351 * @cpu: the (optionally unsigned) integer iterator
352 * @mask1: the first cpumask pointer
353 * @mask2: the second cpumask pointer
354 *
355 * This saves a temporary CPU mask in many places. It is equivalent to:
356 * struct cpumask tmp;
357 * cpumask_andnot(&tmp, &mask1, &mask2);
358 * for_each_cpu(cpu, &tmp)
359 * ...
360 *
361 * After the loop, cpu is >= nr_cpu_ids.
362 */
363 #define for_each_cpu_andnot(cpu, mask1, mask2) \
364 for_each_andnot_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
365
366 /**
367 * for_each_cpu_or - iterate over every cpu present in either mask
368 * @cpu: the (optionally unsigned) integer iterator
369 * @mask1: the first cpumask pointer
370 * @mask2: the second cpumask pointer
371 *
372 * This saves a temporary CPU mask in many places. It is equivalent to:
373 * struct cpumask tmp;
374 * cpumask_or(&tmp, &mask1, &mask2);
375 * for_each_cpu(cpu, &tmp)
376 * ...
377 *
378 * After the loop, cpu is >= nr_cpu_ids.
379 */
380 #define for_each_cpu_or(cpu, mask1, mask2) \
381 for_each_or_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
382
383 /**
384 * for_each_cpu_from - iterate over CPUs present in @mask, from @cpu to the end of @mask.
385 * @cpu: the (optionally unsigned) integer iterator
386 * @mask: the cpumask pointer
387 *
388 * After the loop, cpu is >= nr_cpu_ids.
389 */
390 #define for_each_cpu_from(cpu, mask) \
391 for_each_set_bit_from(cpu, cpumask_bits(mask), small_cpumask_bits)
392
393 /**
394 * cpumask_any_but - return a "random" in a cpumask, but not this one.
395 * @mask: the cpumask to search
396 * @cpu: the cpu to ignore.
397 *
398 * Often used to find any cpu but smp_processor_id() in a mask.
399 * Return: >= nr_cpu_ids if no cpus set.
400 */
401 static __always_inline
402 unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
403 {
404 unsigned int i, n, weight;
405
406 cpumask_check(cpu);
> 407 weight = cpumask_weight(mask);
> 408 n = get_random_u32() % weight;
409
410 /* If we accidentally pick "n" equal to "cpu",
411 * then simply choose "n + 1"th cpu.
412 */
413 if (n == cpu)
414 n = (n + 1) % weight;
> 415 i = cpumask_nth(n, mask);
416 return i;
417 }
418
419 /**
420 * cpumask_any_and_but - pick a "random" cpu from *mask1 & *mask2, but not this one.
421 * @mask1: the first input cpumask
422 * @mask2: the second input cpumask
423 * @cpu: the cpu to ignore
424 *
425 * Returns >= nr_cpu_ids if no cpus set.
426 */
427 static __always_inline
428 unsigned int cpumask_any_and_but(const struct cpumask *mask1,
429 const struct cpumask *mask2,
430 unsigned int cpu)
431 {
432 unsigned int i;
433
434 cpumask_check(cpu);
435 i = cpumask_first_and(mask1, mask2);
436 if (i != cpu)
437 return i;
438
439 return cpumask_next_and(cpu, mask1, mask2);
440 }
441
442 /**
443 * cpumask_nth - get the Nth cpu in a cpumask
444 * @srcp: the cpumask pointer
445 * @cpu: the Nth cpu to find, starting from 0
446 *
447 * Return: >= nr_cpu_ids if such cpu doesn't exist.
448 */
449 static __always_inline
> 450 unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
451 {
452 return find_nth_bit(cpumask_bits(srcp), small_cpumask_bits, cpumask_check(cpu));
453 }
454
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-01-13 9:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 6:18 [RFC PATCH] cpumask: Implement "random" version of cpumask_any_but() I Hsin Cheng
2025-01-13 9:45 ` kernel test robot
2025-01-13 9:45 ` kernel test robot [this message]
2025-01-13 10:13 ` Kuan-Wei Chiu
2025-01-13 10:27 ` I Hsin Cheng
2025-01-13 11:09 ` Kuan-Wei Chiu
2025-01-13 11:05 ` Mark Rutland
2025-01-13 18:00 ` Yury Norov
2025-01-14 7:15 ` I Hsin Cheng
2025-01-14 15:02 ` Mark Rutland
2025-01-14 15:43 ` Yury Norov
2025-01-15 7:24 ` I Hsin Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202501131709.T02YI6Rr-lkp@intel.com \
--to=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=richard120310@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.