aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-09-12 15:37:19 -0400
committerIngo Molnar <mingo@kernel.org>2017-09-14 05:41:08 -0400
commita994a3147e4c0c9c50a46e6cace7586254975e20 (patch)
treecf1c2481727fce2229e7691ebc6a2b6838b4c3f7
parent178b9f7a36d2c74a38274b66dd89f53611298a19 (diff)
watchdog/hardlockup/perf: Implement init time detection of perf
Use the init time detection of the perf NMI watchdog to determine whether the perf NMI watchdog is functional. If not disable it permanentely. It won't come back magically at runtime. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Don Zickus <dzickus@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sebastian Siewior <bigeasy@linutronix.de> Cc: Ulrich Obergfell <uobergfe@redhat.com> Link: http://lkml.kernel.org/r/20170912194148.099799541@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/watchdog.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 84886319d7b0..fd8a998eb197 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -44,6 +44,7 @@ int __read_mostly watchdog_user_enabled = 1;
44int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT; 44int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
45int __read_mostly soft_watchdog_user_enabled = 1; 45int __read_mostly soft_watchdog_user_enabled = 1;
46int __read_mostly watchdog_thresh = 10; 46int __read_mostly watchdog_thresh = 10;
47int __read_mostly nmi_watchdog_available;
47 48
48struct cpumask watchdog_allowed_mask __read_mostly; 49struct cpumask watchdog_allowed_mask __read_mostly;
49static bool softlockup_threads_initialized __read_mostly; 50static bool softlockup_threads_initialized __read_mostly;
@@ -114,6 +115,12 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
114 hardlockup_detector_perf_disable(); 115 hardlockup_detector_perf_disable();
115} 116}
116 117
118/* Return 0, if a NMI watchdog is available. Error code otherwise */
119int __weak __init watchdog_nmi_probe(void)
120{
121 return hardlockup_detector_perf_init();
122}
123
117/** 124/**
118 * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs 125 * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs
119 * @run: If false stop the watchdogs on all enabled CPUs 126 * @run: If false stop the watchdogs on all enabled CPUs
@@ -145,7 +152,7 @@ static void lockup_detector_update_enable(void)
145 watchdog_enabled = 0; 152 watchdog_enabled = 0;
146 if (!watchdog_user_enabled) 153 if (!watchdog_user_enabled)
147 return; 154 return;
148 if (nmi_watchdog_user_enabled) 155 if (nmi_watchdog_available && nmi_watchdog_user_enabled)
149 watchdog_enabled |= NMI_WATCHDOG_ENABLED; 156 watchdog_enabled |= NMI_WATCHDOG_ENABLED;
150 if (soft_watchdog_user_enabled) 157 if (soft_watchdog_user_enabled)
151 watchdog_enabled |= SOFT_WATCHDOG_ENABLED; 158 watchdog_enabled |= SOFT_WATCHDOG_ENABLED;
@@ -692,6 +699,8 @@ int proc_watchdog(struct ctl_table *table, int write,
692int proc_nmi_watchdog(struct ctl_table *table, int write, 699int proc_nmi_watchdog(struct ctl_table *table, int write,
693 void __user *buffer, size_t *lenp, loff_t *ppos) 700 void __user *buffer, size_t *lenp, loff_t *ppos)
694{ 701{
702 if (!nmi_watchdog_available && write)
703 return -ENOTSUPP;
695 return proc_watchdog_common(NMI_WATCHDOG_ENABLED, 704 return proc_watchdog_common(NMI_WATCHDOG_ENABLED,
696 table, write, buffer, lenp, ppos); 705 table, write, buffer, lenp, ppos);
697} 706}
@@ -764,5 +773,7 @@ void __init lockup_detector_init(void)
764 cpumask_copy(&watchdog_cpumask, cpu_possible_mask); 773 cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
765#endif 774#endif
766 775
776 if (!watchdog_nmi_probe())
777 nmi_watchdog_available = true;
767 softlockup_init_threads(); 778 softlockup_init_threads();
768} 779}