tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable head: b1cb25d092e113f8a4424a37c94b1d41cb430511 commit: 0ca1d340a231ec8e8f2586c4bf2dc8c4f7d4ddc9 [54/56] nmi_backtrace: allow excluding an arbitrary CPU config: um-randconfig-r034-20230731 (https://download.01.org/0day-ci/archive/20230805/202308051236.R7HDiE39-lkp@xxxxxxxxx/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce: (https://download.01.org/0day-ci/archive/20230805/202308051236.R7HDiE39-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/202308051236.R7HDiE39-lkp@xxxxxxxxx/ All errors (new ones prefixed by >>): In file included from kernel/watchdog.c:21: In file included from include/linux/tick.h:8: In file included from include/linux/clockchips.h:14: In file included from include/linux/clocksource.h:22: In file included from arch/um/include/asm/io.h:24: 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/watchdog.c:21: In file included from include/linux/tick.h:8: In file included from include/linux/clockchips.h:14: In file included from include/linux/clocksource.h:22: In file included from arch/um/include/asm/io.h:24: 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/watchdog.c:21: In file included from include/linux/tick.h:8: In file included from include/linux/clockchips.h:14: In file included from include/linux/clocksource.h:22: In file included from arch/um/include/asm/io.h:24: 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); ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ >> kernel/watchdog.c:526:36: error: too many arguments to function call, expected 0, have 1 trigger_allbutcpu_cpu_backtrace(smp_processor_id()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~ include/linux/smp.h:271:29: note: expanded from macro 'smp_processor_id' # define smp_processor_id() __smp_processor_id() ^~~~~~~~~~~~~~~~~~~~ include/linux/smp.h:264:31: note: expanded from macro '__smp_processor_id' #define __smp_processor_id(x) raw_smp_processor_id(x) ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/smp.h:198:34: note: expanded from macro 'raw_smp_processor_id' #define raw_smp_processor_id() 0 ^ include/linux/nmi.h:193:20: note: 'trigger_allbutcpu_cpu_backtrace' declared here static inline bool trigger_allbutcpu_cpu_backtrace(void) ^ 12 warnings and 1 error generated. vim +526 kernel/watchdog.c 441 442 /* watchdog kicker functions */ 443 static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) 444 { 445 unsigned long touch_ts, period_ts, now; 446 struct pt_regs *regs = get_irq_regs(); 447 int duration; 448 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace; 449 450 if (!watchdog_enabled) 451 return HRTIMER_NORESTART; 452 453 watchdog_hardlockup_kick(); 454 455 /* kick the softlockup detector */ 456 if (completion_done(this_cpu_ptr(&softlockup_completion))) { 457 reinit_completion(this_cpu_ptr(&softlockup_completion)); 458 stop_one_cpu_nowait(smp_processor_id(), 459 softlockup_fn, NULL, 460 this_cpu_ptr(&softlockup_stop_work)); 461 } 462 463 /* .. and repeat */ 464 hrtimer_forward_now(hrtimer, ns_to_ktime(sample_period)); 465 466 /* 467 * Read the current timestamp first. It might become invalid anytime 468 * when a virtual machine is stopped by the host or when the watchog 469 * is touched from NMI. 470 */ 471 now = get_timestamp(); 472 /* 473 * If a virtual machine is stopped by the host it can look to 474 * the watchdog like a soft lockup. This function touches the watchdog. 475 */ 476 kvm_check_and_clear_guest_paused(); 477 /* 478 * The stored timestamp is comparable with @now only when not touched. 479 * It might get touched anytime from NMI. Make sure that is_softlockup() 480 * uses the same (valid) value. 481 */ 482 period_ts = READ_ONCE(*this_cpu_ptr(&watchdog_report_ts)); 483 484 /* Reset the interval when touched by known problematic code. */ 485 if (period_ts == SOFTLOCKUP_DELAY_REPORT) { 486 if (unlikely(__this_cpu_read(softlockup_touch_sync))) { 487 /* 488 * If the time stamp was touched atomically 489 * make sure the scheduler tick is up to date. 490 */ 491 __this_cpu_write(softlockup_touch_sync, false); 492 sched_clock_tick(); 493 } 494 495 update_report_ts(); 496 return HRTIMER_RESTART; 497 } 498 499 /* Check for a softlockup. */ 500 touch_ts = __this_cpu_read(watchdog_touch_ts); 501 duration = is_softlockup(touch_ts, period_ts, now); 502 if (unlikely(duration)) { 503 /* 504 * Prevent multiple soft-lockup reports if one cpu is already 505 * engaged in dumping all cpu back traces. 506 */ 507 if (softlockup_all_cpu_backtrace) { 508 if (test_and_set_bit_lock(0, &soft_lockup_nmi_warn)) 509 return HRTIMER_RESTART; 510 } 511 512 /* Start period for the next softlockup warning. */ 513 update_report_ts(); 514 515 pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", 516 smp_processor_id(), duration, 517 current->comm, task_pid_nr(current)); 518 print_modules(); 519 print_irqtrace_events(current); 520 if (regs) 521 show_regs(regs); 522 else 523 dump_stack(); 524 525 if (softlockup_all_cpu_backtrace) { > 526 trigger_allbutcpu_cpu_backtrace(smp_processor_id()); 527 clear_bit_unlock(0, &soft_lockup_nmi_warn); 528 } 529 530 add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK); 531 if (softlockup_panic) 532 panic("softlockup: hung tasks"); 533 } 534 535 return HRTIMER_RESTART; 536 } 537 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki