Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: introduce the hardlockup_detector_disable() function

Have kvm_guest_init() use hardlockup_detector_disable() instead of
watchdog_enable_hardlockup_detector(false).

Remove the watchdog_hardlockup_detector_is_enabled() and the
watchdog_enable_hardlockup_detector() function which are no longer needed.

Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ulrich Obergfell and committed by
Linus Torvalds
692297d8 b2f57c3a

+5 -27
+1 -1
arch/x86/kernel/kvm.c
··· 513 513 * can get false positives too easily, for example if the host is 514 514 * overcommitted. 515 515 */ 516 - watchdog_enable_hardlockup_detector(false); 516 + hardlockup_detector_disable(); 517 517 } 518 518 519 519 static noinline uint32_t __kvm_cpuid_base(void)
+2 -7
include/linux/nmi.h
··· 25 25 #endif 26 26 27 27 #if defined(CONFIG_HARDLOCKUP_DETECTOR) 28 - extern void watchdog_enable_hardlockup_detector(bool val); 29 - extern bool watchdog_hardlockup_detector_is_enabled(void); 28 + extern void hardlockup_detector_disable(void); 30 29 #else 31 - static inline void watchdog_enable_hardlockup_detector(bool val) 30 + static inline void hardlockup_detector_disable(void) 32 31 { 33 - } 34 - static inline bool watchdog_hardlockup_detector_is_enabled(void) 35 - { 36 - return true; 37 32 } 38 33 #endif 39 34
+2 -19
kernel/watchdog.c
··· 83 83 #ifdef CONFIG_HARDLOCKUP_DETECTOR 84 84 static int hardlockup_panic = 85 85 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE; 86 - 87 - static bool hardlockup_detector_enabled = true; 88 86 /* 89 87 * We may not want to enable hard lockup detection by default in all cases, 90 88 * for example when running the kernel as a guest on a hypervisor. In these ··· 91 93 * kernel command line parameters are parsed, because otherwise it is not 92 94 * possible to override this in hardlockup_panic_setup(). 93 95 */ 94 - void watchdog_enable_hardlockup_detector(bool val) 96 + void hardlockup_detector_disable(void) 95 97 { 96 - hardlockup_detector_enabled = val; 97 - } 98 - 99 - bool watchdog_hardlockup_detector_is_enabled(void) 100 - { 101 - return hardlockup_detector_enabled; 98 + watchdog_enabled &= ~NMI_WATCHDOG_ENABLED; 102 99 } 103 100 104 101 static int __init hardlockup_panic_setup(char *str) ··· 523 530 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) 524 531 goto out; 525 532 526 - /* 527 - * Some kernels need to default hard lockup detection to 528 - * 'disabled', for example a guest on a hypervisor. 529 - */ 530 - if (!watchdog_hardlockup_detector_is_enabled()) { 531 - event = ERR_PTR(-ENOENT); 532 - goto handle_err; 533 - } 534 - 535 533 /* is it already setup and enabled? */ 536 534 if (event && event->state > PERF_EVENT_STATE_OFF) 537 535 goto out; ··· 537 553 /* Try to register using hardware perf events */ 538 554 event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL); 539 555 540 - handle_err: 541 556 /* save cpu0 error for future comparision */ 542 557 if (cpu == 0 && IS_ERR(event)) 543 558 cpu0_err = PTR_ERR(event);