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

watchdog: Add watchdog enable/disable all functions

This patch adds two new functions to enable/disable
the watchdog across all CPUs.

This will be used by the HT PMU bug workaround code to
disable/enable the NMI watchdog across quirk enablement.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: bp@alien8.de
Cc: jolsa@redhat.com
Cc: kan.liang@intel.com
Cc: maria.n.dimakopoulou@gmail.com
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/1416251225-17721-12-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Stephane Eranian and committed by
Ingo Molnar
b3738d29 c02cdbf6

+36
+8
include/linux/watchdog.h
··· 137 137 extern int watchdog_register_device(struct watchdog_device *); 138 138 extern void watchdog_unregister_device(struct watchdog_device *); 139 139 140 + #ifdef CONFIG_HARDLOCKUP_DETECTOR 141 + void watchdog_nmi_disable_all(void); 142 + void watchdog_nmi_enable_all(void); 143 + #else 144 + static inline void watchdog_nmi_disable_all(void) {} 145 + static inline void watchdog_nmi_enable_all(void) {} 146 + #endif 147 + 140 148 #endif /* ifndef _LINUX_WATCHDOG_H */
+28
kernel/watchdog.c
··· 567 567 cpu0_err = 0; 568 568 } 569 569 } 570 + 571 + void watchdog_nmi_enable_all(void) 572 + { 573 + int cpu; 574 + 575 + if (!watchdog_user_enabled) 576 + return; 577 + 578 + get_online_cpus(); 579 + for_each_online_cpu(cpu) 580 + watchdog_nmi_enable(cpu); 581 + put_online_cpus(); 582 + } 583 + 584 + void watchdog_nmi_disable_all(void) 585 + { 586 + int cpu; 587 + 588 + if (!watchdog_running) 589 + return; 590 + 591 + get_online_cpus(); 592 + for_each_online_cpu(cpu) 593 + watchdog_nmi_disable(cpu); 594 + put_online_cpus(); 595 + } 570 596 #else 571 597 static int watchdog_nmi_enable(unsigned int cpu) { return 0; } 572 598 static void watchdog_nmi_disable(unsigned int cpu) { return; } 599 + void watchdog_nmi_enable_all(void) {} 600 + void watchdog_nmi_disable_all(void) {} 573 601 #endif /* CONFIG_HARDLOCKUP_DETECTOR */ 574 602 575 603 static struct smp_hotplug_thread watchdog_threads = {