diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2017-09-12 15:37:06 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-09-14 05:41:05 -0400 |
| commit | 2b9d7f233b835663cbc7b6b3f88dd20f61118d1e (patch) | |
| tree | d7fd3897956a7639fc6e7f399992d3221c0bac2b /kernel | |
| parent | 01f0a02701cbcf32d22cfc9d1ab9a3f0ff2ba68c (diff) | |
watchdog/core: Clean up stub functions
Having stub functions which take a full page is not helping the
readablility of code.
Condense them and move the doubled #ifdef variant into the SYSFS section.
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/20170912194147.045545271@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/watchdog.c | 68 |
1 files changed, 22 insertions, 46 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index c290135fb415..af37c040436c 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -125,10 +125,7 @@ void __weak watchdog_nmi_disable(unsigned int cpu) | |||
| 125 | * - sysctl_hardlockup_all_cpu_backtrace | 125 | * - sysctl_hardlockup_all_cpu_backtrace |
| 126 | * - hardlockup_panic | 126 | * - hardlockup_panic |
| 127 | */ | 127 | */ |
| 128 | void __weak watchdog_nmi_reconfigure(void) | 128 | void __weak watchdog_nmi_reconfigure(void) { } |
| 129 | { | ||
| 130 | } | ||
| 131 | |||
| 132 | 129 | ||
| 133 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR | 130 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR |
| 134 | 131 | ||
| @@ -136,6 +133,11 @@ void __weak watchdog_nmi_reconfigure(void) | |||
| 136 | #define for_each_watchdog_cpu(cpu) \ | 133 | #define for_each_watchdog_cpu(cpu) \ |
| 137 | for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask) | 134 | for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask) |
| 138 | 135 | ||
| 136 | /* Global variables, exported for sysctl */ | ||
| 137 | unsigned int __read_mostly softlockup_panic = | ||
| 138 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE; | ||
| 139 | int __read_mostly soft_watchdog_enabled; | ||
| 140 | |||
| 139 | static u64 __read_mostly sample_period; | 141 | static u64 __read_mostly sample_period; |
| 140 | 142 | ||
| 141 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); | 143 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); |
| @@ -149,13 +151,9 @@ static DEFINE_PER_CPU(struct task_struct *, softlockup_task_ptr_saved); | |||
| 149 | static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); | 151 | static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); |
| 150 | static unsigned long soft_lockup_nmi_warn; | 152 | static unsigned long soft_lockup_nmi_warn; |
| 151 | 153 | ||
| 152 | unsigned int __read_mostly softlockup_panic = | ||
| 153 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE; | ||
| 154 | |||
| 155 | static int __init softlockup_panic_setup(char *str) | 154 | static int __init softlockup_panic_setup(char *str) |
| 156 | { | 155 | { |
| 157 | softlockup_panic = simple_strtoul(str, NULL, 0); | 156 | softlockup_panic = simple_strtoul(str, NULL, 0); |
| 158 | |||
| 159 | return 1; | 157 | return 1; |
| 160 | } | 158 | } |
| 161 | __setup("softlockup_panic=", softlockup_panic_setup); | 159 | __setup("softlockup_panic=", softlockup_panic_setup); |
| @@ -593,44 +591,13 @@ static void watchdog_disable_all_cpus(void) | |||
| 593 | } | 591 | } |
| 594 | } | 592 | } |
| 595 | 593 | ||
| 596 | #ifdef CONFIG_SYSCTL | 594 | #else /* CONFIG_SOFTLOCKUP_DETECTOR */ |
| 597 | static int watchdog_update_cpus(void) | 595 | static inline int watchdog_park_threads(void) { return 0; } |
| 598 | { | 596 | static inline void watchdog_unpark_threads(void) { } |
| 599 | return smpboot_update_cpumask_percpu_thread( | 597 | static inline int watchdog_enable_all_cpus(void) { return 0; } |
| 600 | &watchdog_threads, &watchdog_cpumask); | 598 | static inline void watchdog_disable_all_cpus(void) { } |
| 601 | } | 599 | static inline void set_sample_period(void) { } |
| 602 | #endif | 600 | #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ |
| 603 | |||
| 604 | #else /* SOFTLOCKUP */ | ||
| 605 | static int watchdog_park_threads(void) | ||
| 606 | { | ||
| 607 | return 0; | ||
| 608 | } | ||
| 609 | |||
| 610 | static void watchdog_unpark_threads(void) | ||
| 611 | { | ||
| 612 | } | ||
| 613 | |||
| 614 | static int watchdog_enable_all_cpus(void) | ||
| 615 | { | ||
| 616 | return 0; | ||
| 617 | } | ||
| 618 | |||
| 619 | static void watchdog_disable_all_cpus(void) | ||
| 620 | { | ||
| 621 | } | ||
| 622 | |||
| 623 | #ifdef CONFIG_SYSCTL | ||
| 624 | static int watchdog_update_cpus(void) | ||
| 625 | { | ||
| 626 | return 0; | ||
| 627 | } | ||
| 628 | #endif | ||
| 629 | |||
| 630 | static void set_sample_period(void) | ||
| 631 | { | ||
| 632 | } | ||
| 633 | #endif /* SOFTLOCKUP */ | ||
| 634 | 601 | ||
| 635 | static void __lockup_detector_cleanup(void) | 602 | static void __lockup_detector_cleanup(void) |
| 636 | { | 603 | { |
| @@ -827,6 +794,15 @@ out: | |||
| 827 | return err; | 794 | return err; |
| 828 | } | 795 | } |
| 829 | 796 | ||
| 797 | static int watchdog_update_cpus(void) | ||
| 798 | { | ||
| 799 | if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) { | ||
| 800 | return smpboot_update_cpumask_percpu_thread(&watchdog_threads, | ||
| 801 | &watchdog_cpumask); | ||
| 802 | } | ||
| 803 | return 0; | ||
| 804 | } | ||
| 805 | |||
| 830 | /* | 806 | /* |
| 831 | * The cpumask is the mask of possible cpus that the watchdog can run | 807 | * The cpumask is the mask of possible cpus that the watchdog can run |
| 832 | * on, not the mask of cpus it is actually running on. This allows the | 808 | * on, not the mask of cpus it is actually running on. This allows the |
