tree: feng/pcache_cleanup
head: a20ca1d06794ad410f289251bf9e9abb781e9008
commit: 85ec1a159459a96dc01e02f957e9ab98d6b0cf87 [51/54] watchdog: warn on soft lockup
config: h8300-randconfig-a001-20200412 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 85ec1a159459a96dc01e02f957e9ab98d6b0cf87
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
h8300-linux-ld: kernel/watchdog.o: in function `watchdog_timer_fn':
> kernel/watchdog.c:447: undefined reference to `pfail'
> h8300-linux-ld: kernel/watchdog.c:447: undefined reference to `pgood'
> h8300-linux-ld: kernel/watchdog.c:447: undefined reference to `ploop'
vim +447 kernel/watchdog.c
360
361 /* watchdog kicker functions */
362 static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
363 {
364 unsigned long touch_ts = __this_cpu_read(watchdog_touch_ts);
365 struct pt_regs *regs = get_irq_regs();
366 int duration;
367 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace;
368
369 if (!watchdog_enabled)
370 return HRTIMER_NORESTART;
371
372 /* kick the hardlockup detector */
373 watchdog_interrupt_count();
374
375 /* kick the softlockup detector */
376 if (completion_done(this_cpu_ptr(&softlockup_completion))) {
377 reinit_completion(this_cpu_ptr(&softlockup_completion));
378 stop_one_cpu_nowait(smp_processor_id(),
379 softlockup_fn, NULL,
380 this_cpu_ptr(&softlockup_stop_work));
381 }
382
383 /* .. and repeat */
384 hrtimer_forward_now(hrtimer, ns_to_ktime(sample_period));
385
386 if (touch_ts == 0) {
387 if (unlikely(__this_cpu_read(softlockup_touch_sync))) {
388 /*
389 * If the time stamp was touched atomically
390 * make sure the scheduler tick is up to date.
391 */
392 __this_cpu_write(softlockup_touch_sync, false);
393 sched_clock_tick();
394 }
395
396 /* Clear the guest paused flag on watchdog reset */
397 kvm_check_and_clear_guest_paused();
398 __touch_watchdog();
399 return HRTIMER_RESTART;
400 }
401
402 /* check for a softlockup
403 * This is done by making sure a high priority task is
404 * being scheduled. The task touches the watchdog to
405 * indicate it is getting cpu time. If it hasn't then
406 * this is a good indication some task is hogging the cpu
407 */
408 duration = is_softlockup(touch_ts);
409 if (unlikely(duration)) {
410 /*
411 * If a virtual machine is stopped by the host it can look to
412 * the watchdog like a soft lockup, check to see if the host
413 * stopped the vm before we issue the warning
414 */
415 if (kvm_check_and_clear_guest_paused())
416 return HRTIMER_RESTART;
417
418 /* only warn once */
419 if (__this_cpu_read(soft_watchdog_warn) == true) {
420 /*
421 * When multiple processes are causing softlockups the
422 * softlockup detector only warns on the first one
423 * because the code relies on a full quiet cycle to
424 * re-arm. The second process prevents the quiet cycle
425 * and never gets reported. Use task pointers to detect
426 * this.
427 */
428 if (__this_cpu_read(softlockup_task_ptr_saved) !=
429 current) {
430 __this_cpu_write(soft_watchdog_warn, false);
431 __touch_watchdog();
432 }
433 return HRTIMER_RESTART;
434 }
435
436 if (softlockup_all_cpu_backtrace) {
437 /* Prevent multiple soft-lockup reports if one cpu is already
438 * engaged in dumping cpu back traces
439 */
440 if (test_and_set_bit(0, &soft_lockup_nmi_warn)) {
441 /* Someone else will report us. Let's give up */
442 __this_cpu_write(soft_watchdog_warn, true);
443 return HRTIMER_RESTART;
444 }
445 }
446
447 mp("ploop=%d pgood = %d pfail = %d", ploop, pgood,
pfail);
448
449 pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n",
450 smp_processor_id(), duration,
451 current->comm, task_pid_nr(current));
452 __this_cpu_write(softlockup_task_ptr_saved, current);
453 print_modules();
454 print_irqtrace_events(current);
455 if (regs)
456 show_regs(regs);
457 else
458 dump_stack();
459
460 if (softlockup_all_cpu_backtrace) {
461 /* Avoid generating two back traces for current
462 * given that one is already made above
463 */
464 trigger_allbutself_cpu_backtrace();
465
466 clear_bit(0, &soft_lockup_nmi_warn);
467 /* Barrier to sync with other cpus */
468 smp_mb__after_atomic();
469 }
470
471 add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
472 if (softlockup_panic)
473 panic("softlockup: hung tasks");
474 __this_cpu_write(soft_watchdog_warn, true);
475 } else
476 __this_cpu_write(soft_watchdog_warn, false);
477
478 return HRTIMER_RESTART;
479 }
480
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org