[ammarfaizi2-block:crng/random/jd/vdso 8/8] arch/x86/include/asm/vdso/gettimeofday.h:248:34: error: 'VDSO_CLOCKMODE_TSC' undeclared; did you mean 'VDSO_CLOCKMODE_MAX'?

From: kernel test robot
Date: Fri Jul 29 2022 - 13:23:18 EST


tree: https://github.com/ammarfaizi2/linux-block crng/random/jd/vdso
head: 02d56061c924adece19bdfad05ea4add32de4b63
commit: 02d56061c924adece19bdfad05ea4add32de4b63 [8/8] random: implement getrandom() in vDSO
config: um-x86_64_defconfig (https://download.01.org/0day-ci/archive/20220730/202207300138.IedUdmKn-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/ammarfaizi2/linux-block/commit/02d56061c924adece19bdfad05ea4add32de4b63
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block crng/random/jd/vdso
git checkout 02d56061c924adece19bdfad05ea4add32de4b63
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=um SUBARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from include/vdso/processor.h:10,
from include/vdso/datapage.h:17,
from drivers/char/random.c:62:
>> arch/x86/include/asm/vdso/processor.h:11:29: error: redefinition of 'rep_nop'
11 | static __always_inline void rep_nop(void)
| ^~~~~~~
In file included from include/linux/rcupdate.h:30,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/utsname.h:6,
from drivers/char/random.c:28:
arch/x86/um/asm/processor.h:25:29: note: previous definition of 'rep_nop' with type 'void(void)'
25 | static __always_inline void rep_nop(void)
| ^~~~~~~
In file included from include/vdso/processor.h:10,
from include/vdso/datapage.h:17,
from drivers/char/random.c:62:
>> arch/x86/include/asm/vdso/processor.h:16:29: error: redefinition of 'cpu_relax'
16 | static __always_inline void cpu_relax(void)
| ^~~~~~~~~
In file included from include/linux/rcupdate.h:30,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/utsname.h:6,
from drivers/char/random.c:28:
arch/x86/um/asm/processor.h:30:29: note: previous definition of 'cpu_relax' with type 'void(void)'
30 | static __always_inline void cpu_relax(void)
| ^~~~~~~~~
In file included from arch/x86/include/asm/mshyperv.h:10,
from include/clocksource/hyperv_timer.h:18,
from arch/x86/include/asm/vdso/gettimeofday.h:21,
from include/vdso/datapage.h:143,
from drivers/char/random.c:62:
arch/x86/include/asm/nospec-branch.h: In function 'mds_clear_cpu_buffers':
>> arch/x86/include/asm/nospec-branch.h:332:31: error: '__KERNEL_DS' undeclared (first use in this function)
332 | static const u16 ds = __KERNEL_DS;
| ^~~~~~~~~~~
arch/x86/include/asm/nospec-branch.h:332:31: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/asm-generic/bug.h:5,
from ./arch/um/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/um/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/utsname.h:6,
from drivers/char/random.c:28:
arch/x86/include/asm/vdso/gettimeofday.h: In function '__arch_get_hw_counter':
>> arch/x86/include/asm/vdso/gettimeofday.h:248:34: error: 'VDSO_CLOCKMODE_TSC' undeclared (first use in this function); did you mean 'VDSO_CLOCKMODE_MAX'?
248 | if (likely(clock_mode == VDSO_CLOCKMODE_TSC))
| ^~~~~~~~~~~~~~~~~~
include/linux/compiler.h:77:45: note: in definition of macro 'likely'
77 | # define likely(x) __builtin_expect(!!(x), 1)
| ^


vim +248 arch/x86/include/asm/vdso/gettimeofday.h

7ac8707479886c7 Vincenzo Frascino 2019-06-21 244
4c5a116ada953b8 Thomas Gleixner 2020-08-04 245 static inline u64 __arch_get_hw_counter(s32 clock_mode,
4c5a116ada953b8 Thomas Gleixner 2020-08-04 246 const struct vdso_data *vd)
7ac8707479886c7 Vincenzo Frascino 2019-06-21 247 {
b95a8a27c300d1a Thomas Gleixner 2020-02-07 @248 if (likely(clock_mode == VDSO_CLOCKMODE_TSC))
7ac8707479886c7 Vincenzo Frascino 2019-06-21 249 return (u64)rdtsc_ordered();
7ac8707479886c7 Vincenzo Frascino 2019-06-21 250 /*
7ac8707479886c7 Vincenzo Frascino 2019-06-21 251 * For any memory-mapped vclock type, we need to make sure that gcc
7ac8707479886c7 Vincenzo Frascino 2019-06-21 252 * doesn't cleverly hoist a load before the mode check. Otherwise we
7ac8707479886c7 Vincenzo Frascino 2019-06-21 253 * might end up touching the memory-mapped page even if the vclock in
7ac8707479886c7 Vincenzo Frascino 2019-06-21 254 * question isn't enabled, which will segfault. Hence the barriers.
7ac8707479886c7 Vincenzo Frascino 2019-06-21 255 */
7ac8707479886c7 Vincenzo Frascino 2019-06-21 256 #ifdef CONFIG_PARAVIRT_CLOCK
b95a8a27c300d1a Thomas Gleixner 2020-02-07 257 if (clock_mode == VDSO_CLOCKMODE_PVCLOCK) {
7ac8707479886c7 Vincenzo Frascino 2019-06-21 258 barrier();
7ac8707479886c7 Vincenzo Frascino 2019-06-21 259 return vread_pvclock();
7ac8707479886c7 Vincenzo Frascino 2019-06-21 260 }
7ac8707479886c7 Vincenzo Frascino 2019-06-21 261 #endif
3e2d94535adb2df Vitaly Kuznetsov 2019-08-22 262 #ifdef CONFIG_HYPERV_TIMER
b95a8a27c300d1a Thomas Gleixner 2020-02-07 263 if (clock_mode == VDSO_CLOCKMODE_HVCLOCK) {
7ac8707479886c7 Vincenzo Frascino 2019-06-21 264 barrier();
7ac8707479886c7 Vincenzo Frascino 2019-06-21 265 return vread_hvclock();
7ac8707479886c7 Vincenzo Frascino 2019-06-21 266 }
7ac8707479886c7 Vincenzo Frascino 2019-06-21 267 #endif
7ac8707479886c7 Vincenzo Frascino 2019-06-21 268 return U64_MAX;
7ac8707479886c7 Vincenzo Frascino 2019-06-21 269 }
7ac8707479886c7 Vincenzo Frascino 2019-06-21 270

:::::: The code at line 248 was first introduced by commit
:::::: b95a8a27c300d1a39a4e36f63a518ef36e4b966c x86/vdso: Use generic VDSO clock mode storage

:::::: TO: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
:::::: CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp