[tip:timers/core 3/3] kernel/time/hrtimer.c:2224:56: error: implicit declaration of function 'housekeeping'

From: kernel test robot
Date: Wed Feb 14 2024 - 01:25:39 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
head: 86342554e102b0d18d50abec43d40f4fc92f1993
commit: 86342554e102b0d18d50abec43d40f4fc92f1993 [3/3] hrtimer: Select housekeeping CPU during migration
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240214/202402141402.ktGAGpFN-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240214/202402141402.ktGAGpFN-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402141402.ktGAGpFN-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

kernel/time/hrtimer.c:120:35: warning: initialized field overwritten [-Woverride-init]
120 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
| ^~~~~~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:120:35: note: (near initialization for 'hrtimer_clock_to_base_table[0]')
kernel/time/hrtimer.c:121:35: warning: initialized field overwritten [-Woverride-init]
121 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:121:35: note: (near initialization for 'hrtimer_clock_to_base_table[1]')
kernel/time/hrtimer.c:122:35: warning: initialized field overwritten [-Woverride-init]
122 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
| ^~~~~~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:122:35: note: (near initialization for 'hrtimer_clock_to_base_table[7]')
kernel/time/hrtimer.c:123:35: warning: initialized field overwritten [-Woverride-init]
123 | [CLOCK_TAI] = HRTIMER_BASE_TAI,
| ^~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:123:35: note: (near initialization for 'hrtimer_clock_to_base_table[11]')
In file included from arch/loongarch/include/asm/processor.h:9,
from arch/loongarch/include/asm/thread_info.h:15,
from include/linux/thread_info.h:60,
from include/asm-generic/current.h:6,
from ./arch/loongarch/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from kernel/time/hrtimer.c:25:
kernel/time/hrtimer.c: In function 'hrtimers_cpu_dying':
>> kernel/time/hrtimer.c:2224:56: error: implicit declaration of function 'housekeeping' [-Werror=implicit-function-declaration]
2224 | int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping(HK_TYPE_TIMER));
| ^~~~~~~~~~~~
include/linux/cpumask.h:774:67: note: in definition of macro 'cpumask_any_and'
774 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2))
| ^~~~~
>> kernel/time/hrtimer.c:2224:69: error: 'HK_TYPE_TIMER' undeclared (first use in this function)
2224 | int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping(HK_TYPE_TIMER));
| ^~~~~~~~~~~~~
include/linux/cpumask.h:774:67: note: in definition of macro 'cpumask_any_and'
774 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2))
| ^~~~~
kernel/time/hrtimer.c:2224:69: note: each undeclared identifier is reported only once for each function it appears in
2224 | int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping(HK_TYPE_TIMER));
| ^~~~~~~~~~~~~
include/linux/cpumask.h:774:67: note: in definition of macro 'cpumask_any_and'
774 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2))
| ^~~~~
cc1: some warnings being treated as errors


vim +/housekeeping +2224 kernel/time/hrtimer.c

2221
2222 int hrtimers_cpu_dying(unsigned int dying_cpu)
2223 {
> 2224 int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping(HK_TYPE_TIMER));
2225 struct hrtimer_cpu_base *old_base, *new_base;
2226
2227 tick_cancel_sched_timer(dying_cpu);
2228
2229 old_base = this_cpu_ptr(&hrtimer_bases);
2230 new_base = &per_cpu(hrtimer_bases, ncpu);
2231
2232 /*
2233 * The caller is globally serialized and nobody else
2234 * takes two locks at once, deadlock is not possible.
2235 */
2236 raw_spin_lock(&old_base->lock);
2237 raw_spin_lock_nested(&new_base->lock, SINGLE_DEPTH_NESTING);
2238
2239 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
2240 migrate_hrtimer_list(&old_base->clock_base[i],
2241 &new_base->clock_base[i]);
2242 }
2243
2244 /*
2245 * The migration might have changed the first expiring softirq
2246 * timer on this CPU. Update it.
2247 */
2248 __hrtimer_get_next_event(new_base, HRTIMER_ACTIVE_SOFT);
2249 /* Tell the other CPU to retrigger the next event */
2250 smp_call_function_single(ncpu, retrigger_next_event, NULL, 0);
2251
2252 raw_spin_unlock(&new_base->lock);
2253 raw_spin_unlock(&old_base->lock);
2254
2255 return 0;
2256 }
2257

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