Re: [PATCH v3] posix-timers: add multi_clock_gettime system call

From: kernel test robot
Date: Thu Dec 28 2023 - 23:06:05 EST


Hi Sagi,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/asm]
[also build test ERROR on arnd-asm-generic/master tip/timers/core linus/master v6.7-rc7]
[cannot apply to next-20231222]
[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/Sagi-Maimon/posix-timers-add-multi_clock_gettime-system-call/20231228-202632
base: tip/x86/asm
patch link: https://lore.kernel.org/r/20231228122411.3189-1-maimon.sagi%40gmail.com
patch subject: [PATCH v3] posix-timers: add multi_clock_gettime system call
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20231229/202312291154.hCJdKLKM-lkp@xxxxxxxxx/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 8a4266a626914765c0c69839e8a51be383013c1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231229/202312291154.hCJdKLKM-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/202312291154.hCJdKLKM-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

In file included from kernel/time/time.c:33:
>> include/linux/syscalls.h:1164:48: warning: declaration of 'struct __ptp_multi_clock_get' will not be visible outside of this function [-Wvisibility]
1164 | asmlinkage long sys_multi_clock_gettime(struct __ptp_multi_clock_get __user * ptp_multi_clk_get);
| ^
1 warning generated.
--
In file included from kernel/time/hrtimer.c:30:
>> include/linux/syscalls.h:1164:48: warning: declaration of 'struct __ptp_multi_clock_get' will not be visible outside of this function [-Wvisibility]
1164 | asmlinkage long sys_multi_clock_gettime(struct __ptp_multi_clock_get __user * ptp_multi_clk_get);
| ^
kernel/time/hrtimer.c:147:20: warning: unused function 'is_migration_base' [-Wunused-function]
147 | static inline bool is_migration_base(struct hrtimer_clock_base *base)
| ^~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:1876:20: warning: unused function '__hrtimer_peek_ahead_timers' [-Wunused-function]
1876 | static inline void __hrtimer_peek_ahead_timers(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
--
In file included from kernel/time/posix-timers.c:26:
>> include/linux/syscalls.h:1164:48: warning: declaration of 'struct __ptp_multi_clock_get' will not be visible outside of this function [-Wvisibility]
1164 | asmlinkage long sys_multi_clock_gettime(struct __ptp_multi_clock_get __user * ptp_multi_clk_get);
| ^
>> kernel/time/posix-timers.c:1430:1: error: conflicting types for 'sys_multi_clock_gettime'
1430 | SYSCALL_DEFINE1(multi_clock_gettime, struct __ptp_multi_clock_get __user *, ptp_multi_clk_get)
| ^
include/linux/syscalls.h:219:36: note: expanded from macro 'SYSCALL_DEFINE1'
219 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
| ^
include/linux/syscalls.h:230:2: note: expanded from macro 'SYSCALL_DEFINEx'
230 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^
include/linux/syscalls.h:244:18: note: expanded from macro '__SYSCALL_DEFINEx'
244 | asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
| ^
<scratch space>:135:1: note: expanded from here
135 | sys_multi_clock_gettime
| ^
include/linux/syscalls.h:1164:17: note: previous declaration is here
1164 | asmlinkage long sys_multi_clock_gettime(struct __ptp_multi_clock_get __user * ptp_multi_clk_get);
| ^
1 warning and 1 error generated.


vim +/sys_multi_clock_gettime +1430 kernel/time/posix-timers.c

1429
> 1430 SYSCALL_DEFINE1(multi_clock_gettime, struct __ptp_multi_clock_get __user *, ptp_multi_clk_get)
1431 {
1432 const struct k_clock *kc;
1433 struct timespec64 kernel_tp;
1434 struct __ptp_multi_clock_get multi_clk_get;
1435 unsigned int i, j;
1436 int error;
1437
1438 if (copy_from_user(&multi_clk_get, ptp_multi_clk_get, sizeof(multi_clk_get)))
1439 return -EFAULT;
1440
1441 if (multi_clk_get.n_samples > MULTI_PTP_MAX_SAMPLES)
1442 return -EINVAL;
1443 if (multi_clk_get.n_clocks > MULTI_PTP_MAX_CLOCKS)
1444 return -EINVAL;
1445
1446 for (j = 0; j < multi_clk_get.n_samples; j++) {
1447 for (i = 0; i < multi_clk_get.n_clocks; i++) {
1448 kc = clockid_to_kclock(multi_clk_get.clkid_arr[i]);
1449 if (!kc)
1450 return -EINVAL;
1451 error = kc->clock_get_timespec(multi_clk_get.clkid_arr[i], &kernel_tp);
1452 if (!error && put_timespec64(&kernel_tp, (struct __kernel_timespec __user *)
1453 &ptp_multi_clk_get->ts[j][i]))
1454 error = -EFAULT;
1455 }
1456 }
1457
1458 return error;
1459 }
1460

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