Re: [PATCH] watchdog/hardlockup: reassign last_timestamp when enable nmi event

From: kbuild test robot
Date: Sun Oct 13 2019 - 18:35:51 EST


Hi Li,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.4-rc2 next-20191010]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Li-RongQing/watchdog-hardlockup-reassign-last_timestamp-when-enable-nmi-event/20191014-022936
config: i386-randconfig-g002-201941 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

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

All warnings (new ones prefixed by >>):

In file included from include/asm-generic/percpu.h:7:0,
from arch/x86/include/asm/percpu.h:556,
from arch/x86/include/asm/current.h:6,
from include/linux/sched.h:12,
from include/linux/nmi.h:8,
from kernel/watchdog_hld.c:15:
kernel/watchdog_hld.c: In function 'hardlockup_detector_perf_enable':
kernel/watchdog_hld.c:201:17: error: 'last_timestamp' undeclared (first use in this function); did you mean 'statx_timestamp'?
this_cpu_write(last_timestamp, now);
^
include/linux/percpu-defs.h:220:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
include/linux/percpu-defs.h:509:34: note: in expansion of macro '__pcpu_size_call'
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^~~~~~~~~~~~~~~~
kernel/watchdog_hld.c:201:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(last_timestamp, now);
^~~~~~~~~~~~~~
kernel/watchdog_hld.c:201:17: note: each undeclared identifier is reported only once for each function it appears in
this_cpu_write(last_timestamp, now);
^
include/linux/percpu-defs.h:220:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
include/linux/percpu-defs.h:509:34: note: in expansion of macro '__pcpu_size_call'
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^~~~~~~~~~~~~~~~
kernel/watchdog_hld.c:201:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(last_timestamp, now);
^~~~~~~~~~~~~~
kernel/watchdog_hld.c: In function 'hardlockup_detector_perf_restart':
kernel/watchdog_hld.c:283:12: error: 'last_timestamp' undeclared (first use in this function); did you mean 'statx_timestamp'?
per_cpu(last_timestamp, cpu) = now;
^
include/linux/percpu-defs.h:220:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
>> include/linux/percpu-defs.h:264:47: note: in expansion of macro 'VERIFY_PERCPU_PTR'
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:270:29: note: in expansion of macro 'per_cpu_ptr'
#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
^~~~~~~~~~~
kernel/watchdog_hld.c:283:4: note: in expansion of macro 'per_cpu'
per_cpu(last_timestamp, cpu) = now;
^~~~~~~

vim +/VERIFY_PERCPU_PTR +264 include/linux/percpu-defs.h

62fde54123fb64 Tejun Heo 2014-06-17 206
9c28278a24c01c Tejun Heo 2014-06-17 207 /*
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 208 * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 209 * @ptr and is invoked once before a percpu area is accessed by all
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 210 * accessors and operations. This is performed in the generic part of
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 211 * percpu and arch overrides don't need to worry about it; however, if an
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 212 * arch wants to implement an arch-specific percpu accessor or operation,
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 213 * it may use __verify_pcpu_ptr() to verify the parameters.
9c28278a24c01c Tejun Heo 2014-06-17 214 *
9c28278a24c01c Tejun Heo 2014-06-17 215 * + 0 is required in order to convert the pointer type from a
9c28278a24c01c Tejun Heo 2014-06-17 216 * potential array type to a pointer to a single item of the array.
9c28278a24c01c Tejun Heo 2014-06-17 217 */
eba117889ac444 Tejun Heo 2014-06-17 218 #define __verify_pcpu_ptr(ptr) \
eba117889ac444 Tejun Heo 2014-06-17 219 do { \
9c28278a24c01c Tejun Heo 2014-06-17 @220 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
9c28278a24c01c Tejun Heo 2014-06-17 221 (void)__vpp_verify; \
9c28278a24c01c Tejun Heo 2014-06-17 222 } while (0)
9c28278a24c01c Tejun Heo 2014-06-17 223
62fde54123fb64 Tejun Heo 2014-06-17 224 #ifdef CONFIG_SMP
62fde54123fb64 Tejun Heo 2014-06-17 225
62fde54123fb64 Tejun Heo 2014-06-17 226 /*
62fde54123fb64 Tejun Heo 2014-06-17 227 * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE()
62fde54123fb64 Tejun Heo 2014-06-17 228 * to prevent the compiler from making incorrect assumptions about the
62fde54123fb64 Tejun Heo 2014-06-17 229 * pointer value. The weird cast keeps both GCC and sparse happy.
62fde54123fb64 Tejun Heo 2014-06-17 230 */
eba117889ac444 Tejun Heo 2014-06-17 231 #define SHIFT_PERCPU_PTR(__p, __offset) \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 232 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 233
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 234 #define per_cpu_ptr(ptr, cpu) \
eba117889ac444 Tejun Heo 2014-06-17 235 ({ \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 236 __verify_pcpu_ptr(ptr); \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 237 SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
62fde54123fb64 Tejun Heo 2014-06-17 238 })
62fde54123fb64 Tejun Heo 2014-06-17 239
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 240 #define raw_cpu_ptr(ptr) \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 241 ({ \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 242 __verify_pcpu_ptr(ptr); \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 243 arch_raw_cpu_ptr(ptr); \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 244 })
62fde54123fb64 Tejun Heo 2014-06-17 245
62fde54123fb64 Tejun Heo 2014-06-17 246 #ifdef CONFIG_DEBUG_PREEMPT
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 247 #define this_cpu_ptr(ptr) \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 248 ({ \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 249 __verify_pcpu_ptr(ptr); \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 250 SHIFT_PERCPU_PTR(ptr, my_cpu_offset); \
6fbc07bbe2b5a8 Tejun Heo 2014-06-17 251 })
62fde54123fb64 Tejun Heo 2014-06-17 252 #else
62fde54123fb64 Tejun Heo 2014-06-17 253 #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
62fde54123fb64 Tejun Heo 2014-06-17 254 #endif
62fde54123fb64 Tejun Heo 2014-06-17 255
62fde54123fb64 Tejun Heo 2014-06-17 256 #else /* CONFIG_SMP */
62fde54123fb64 Tejun Heo 2014-06-17 257
eba117889ac444 Tejun Heo 2014-06-17 258 #define VERIFY_PERCPU_PTR(__p) \
eba117889ac444 Tejun Heo 2014-06-17 259 ({ \
eba117889ac444 Tejun Heo 2014-06-17 260 __verify_pcpu_ptr(__p); \
62fde54123fb64 Tejun Heo 2014-06-17 261 (typeof(*(__p)) __kernel __force *)(__p); \
62fde54123fb64 Tejun Heo 2014-06-17 262 })
62fde54123fb64 Tejun Heo 2014-06-17 263
eba117889ac444 Tejun Heo 2014-06-17 @264 #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
3b8ed91d6463f4 Tejun Heo 2014-06-17 265 #define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
3b8ed91d6463f4 Tejun Heo 2014-06-17 266 #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
62fde54123fb64 Tejun Heo 2014-06-17 267

:::::: The code at line 264 was first introduced by commit
:::::: eba117889ac444bea6e8270049cbaeed48169889 percpu: preffity percpu header files

:::::: TO: Tejun Heo <tj@xxxxxxxxxx>
:::::: CC: Tejun Heo <tj@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip