diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2017-09-12 15:37:16 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-09-14 05:41:07 -0400 |
| commit | 6592ad2fcc8f15b4f99b36c1db7d9f65510c203b (patch) | |
| tree | bb6e84eec793718c24aba5f19a28e5473f751f43 /kernel | |
| parent | 7feeb9cd4f5b34476ffb9e6d58d58c5416375b19 (diff) | |
watchdog/core, powerpc: Make watchdog_nmi_reconfigure() two stage
Both the perf reconfiguration and the powerpc watchdog_nmi_reconfigure()
need to be done in two steps.
1) Stop all NMIs
2) Read the new parameters and start NMIs
Right now watchdog_nmi_reconfigure() is a combination of both. To allow a
clean reconfiguration add a 'run' argument and split the functionality in
powerpc.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20170912194147.862865570@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/watchdog.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index baae9fc95031..5693afd2b8ea 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -112,17 +112,25 @@ void __weak watchdog_nmi_disable(unsigned int cpu) | |||
| 112 | hardlockup_detector_perf_disable(); | 112 | hardlockup_detector_perf_disable(); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /* | 115 | /** |
| 116 | * watchdog_nmi_reconfigure can be implemented to be notified after any | 116 | * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs |
| 117 | * watchdog configuration change. The arch hardlockup watchdog should | 117 | * @run: If false stop the watchdogs on all enabled CPUs |
| 118 | * respond to the following variables: | 118 | * If true start the watchdogs on all enabled CPUs |
| 119 | * | ||
| 120 | * The core call order is: | ||
| 121 | * watchdog_nmi_reconfigure(false); | ||
| 122 | * update_variables(); | ||
| 123 | * watchdog_nmi_reconfigure(true); | ||
| 124 | * | ||
| 125 | * The second call which starts the watchdogs again guarantees that the | ||
| 126 | * following variables are stable across the call. | ||
| 119 | * - watchdog_enabled | 127 | * - watchdog_enabled |
| 120 | * - watchdog_thresh | 128 | * - watchdog_thresh |
| 121 | * - watchdog_cpumask | 129 | * - watchdog_cpumask |
| 122 | * - sysctl_hardlockup_all_cpu_backtrace | 130 | * |
| 123 | * - hardlockup_panic | 131 | * After the call the variables can be changed again. |
| 124 | */ | 132 | */ |
| 125 | void __weak watchdog_nmi_reconfigure(void) { } | 133 | void __weak watchdog_nmi_reconfigure(bool run) { } |
| 126 | 134 | ||
| 127 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR | 135 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR |
| 128 | 136 | ||
| @@ -515,10 +523,12 @@ static void softlockup_unpark_threads(void) | |||
| 515 | 523 | ||
| 516 | static void softlockup_reconfigure_threads(bool enabled) | 524 | static void softlockup_reconfigure_threads(bool enabled) |
| 517 | { | 525 | { |
| 526 | watchdog_nmi_reconfigure(false); | ||
| 518 | softlockup_park_all_threads(); | 527 | softlockup_park_all_threads(); |
| 519 | set_sample_period(); | 528 | set_sample_period(); |
| 520 | if (enabled) | 529 | if (enabled) |
| 521 | softlockup_unpark_threads(); | 530 | softlockup_unpark_threads(); |
| 531 | watchdog_nmi_reconfigure(true); | ||
| 522 | } | 532 | } |
| 523 | 533 | ||
| 524 | /* | 534 | /* |
| @@ -559,7 +569,11 @@ static inline void watchdog_unpark_threads(void) { } | |||
| 559 | static inline int watchdog_enable_all_cpus(void) { return 0; } | 569 | static inline int watchdog_enable_all_cpus(void) { return 0; } |
| 560 | static inline void watchdog_disable_all_cpus(void) { } | 570 | static inline void watchdog_disable_all_cpus(void) { } |
| 561 | static inline void softlockup_init_threads(void) { } | 571 | static inline void softlockup_init_threads(void) { } |
| 562 | static inline void softlockup_reconfigure_threads(bool enabled) { } | 572 | static void softlockup_reconfigure_threads(bool enabled) |
| 573 | { | ||
| 574 | watchdog_nmi_reconfigure(false); | ||
| 575 | watchdog_nmi_reconfigure(true); | ||
| 576 | } | ||
| 563 | #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ | 577 | #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ |
| 564 | 578 | ||
| 565 | static void __lockup_detector_cleanup(void) | 579 | static void __lockup_detector_cleanup(void) |
| @@ -599,7 +613,6 @@ static void proc_watchdog_update(void) | |||
| 599 | /* Remove impossible cpus to keep sysctl output clean. */ | 613 | /* Remove impossible cpus to keep sysctl output clean. */ |
| 600 | cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); | 614 | cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); |
| 601 | softlockup_reconfigure_threads(watchdog_enabled && watchdog_thresh); | 615 | softlockup_reconfigure_threads(watchdog_enabled && watchdog_thresh); |
| 602 | watchdog_nmi_reconfigure(); | ||
| 603 | } | 616 | } |
| 604 | 617 | ||
| 605 | /* | 618 | /* |
