[tip:timers/core 19/21] kernel/time/posix-timers.c:385:18: error: use of undeclared identifier 'TICK_NSECS'

From: kernel test robot
Date: Mon Jun 05 2023 - 14:15:50 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
head: 1263a2a9d71bac5ffabf9603c36e36cb6edbcdcf
commit: 63dede13d09850a8ace210f8e4227ac5a6b309ae [19/21] posix-timers: Clarify posix_timer_fn() comments
config: hexagon-randconfig-r036-20230605 (https://download.01.org/0day-ci/archive/20230606/202306060236.yHWiRzTI-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 4faf3aaf28226a4e950c103a14f6fc1d1fdabb1b)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=63dede13d09850a8ace210f8e4227ac5a6b309ae
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip timers/core
git checkout 63dede13d09850a8ace210f8e4227ac5a6b309ae
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/time/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306060236.yHWiRzTI-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from kernel/time/posix-timers.c:13:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from kernel/time/posix-timers.c:13:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from kernel/time/posix-timers.c:13:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> kernel/time/posix-timers.c:385:18: error: use of undeclared identifier 'TICK_NSECS'
ktime_t kj = TICK_NSECS;
^
6 warnings and 1 error generated.


vim +/TICK_NSECS +385 kernel/time/posix-timers.c

327
328 /*
329 * This function gets called when a POSIX.1b interval timer expires from
330 * the HRTIMER interrupt (soft interrupt on RT kernels).
331 *
332 * Handles CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_BOOTTIME and CLOCK_TAI
333 * based timers.
334 */
335 static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
336 {
337 struct k_itimer *timr;
338 unsigned long flags;
339 int si_private = 0;
340 enum hrtimer_restart ret = HRTIMER_NORESTART;
341
342 timr = container_of(timer, struct k_itimer, it.real.timer);
343 spin_lock_irqsave(&timr->it_lock, flags);
344
345 timr->it_active = 0;
346 if (timr->it_interval != 0)
347 si_private = ++timr->it_requeue_pending;
348
349 if (posix_timer_event(timr, si_private)) {
350 /*
351 * The signal was not queued due to SIG_IGN. As a
352 * consequence the timer is not going to be rearmed from
353 * the signal delivery path. But as a real signal handler
354 * can be installed later the timer must be rearmed here.
355 */
356 if (timr->it_interval != 0) {
357 ktime_t now = hrtimer_cb_get_time(timer);
358
359 /*
360 * FIXME: What we really want, is to stop this
361 * timer completely and restart it in case the
362 * SIG_IGN is removed. This is a non trivial
363 * change to the signal handling code.
364 *
365 * For now let timers with an interval less than a
366 * jiffie expire every jiffie and recheck for a
367 * valid signal handler.
368 *
369 * This avoids interrupt starvation in case of a
370 * very small interval, which would expire the
371 * timer immediately again.
372 *
373 * Moving now ahead of time by one jiffie tricks
374 * hrtimer_forward() to expire the timer later,
375 * while it still maintains the overrun accuracy
376 * for the price of a slight inconsistency in the
377 * timer_gettime() case. This is at least better
378 * than a timer storm.
379 *
380 * Only required when high resolution timers are
381 * enabled as the periodic tick based timers are
382 * automatically aligned to the next tick.
383 */
384 if (IS_ENABLED(CONFIG_HIGHRES_TIMERS)) {
> 385 ktime_t kj = TICK_NSECS;
386
387 if (timr->it_interval < kj)
388 now = ktime_add(now, kj);
389 }
390
391 timr->it_overrun += hrtimer_forward(timer, now, timr->it_interval);
392 ret = HRTIMER_RESTART;
393 ++timr->it_requeue_pending;
394 timr->it_active = 1;
395 }
396 }
397
398 unlock_timer(timr, flags);
399 return ret;
400 }
401

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