diff options
| -rw-r--r-- | include/linux/nmi.h | 2 | ||||
| -rw-r--r-- | kernel/sysctl.c | 4 | ||||
| -rw-r--r-- | kernel/watchdog.c | 30 |
3 files changed, 18 insertions, 18 deletions
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index db50840e6355..6a45fb583ff1 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
| @@ -46,7 +46,7 @@ static inline bool trigger_all_cpu_backtrace(void) | |||
| 46 | #ifdef CONFIG_LOCKUP_DETECTOR | 46 | #ifdef CONFIG_LOCKUP_DETECTOR |
| 47 | int hw_nmi_is_cpu_stuck(struct pt_regs *); | 47 | int hw_nmi_is_cpu_stuck(struct pt_regs *); |
| 48 | u64 hw_nmi_get_sample_period(int watchdog_thresh); | 48 | u64 hw_nmi_get_sample_period(int watchdog_thresh); |
| 49 | extern int watchdog_enabled; | 49 | extern int watchdog_user_enabled; |
| 50 | extern int watchdog_thresh; | 50 | extern int watchdog_thresh; |
| 51 | struct ctl_table; | 51 | struct ctl_table; |
| 52 | extern int proc_dowatchdog(struct ctl_table *, int , | 52 | extern int proc_dowatchdog(struct ctl_table *, int , |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9edcf456e0fc..b0805652c4ff 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -801,7 +801,7 @@ static struct ctl_table kern_table[] = { | |||
| 801 | #if defined(CONFIG_LOCKUP_DETECTOR) | 801 | #if defined(CONFIG_LOCKUP_DETECTOR) |
| 802 | { | 802 | { |
| 803 | .procname = "watchdog", | 803 | .procname = "watchdog", |
| 804 | .data = &watchdog_enabled, | 804 | .data = &watchdog_user_enabled, |
| 805 | .maxlen = sizeof (int), | 805 | .maxlen = sizeof (int), |
| 806 | .mode = 0644, | 806 | .mode = 0644, |
| 807 | .proc_handler = proc_dowatchdog, | 807 | .proc_handler = proc_dowatchdog, |
| @@ -828,7 +828,7 @@ static struct ctl_table kern_table[] = { | |||
| 828 | }, | 828 | }, |
| 829 | { | 829 | { |
| 830 | .procname = "nmi_watchdog", | 830 | .procname = "nmi_watchdog", |
| 831 | .data = &watchdog_enabled, | 831 | .data = &watchdog_user_enabled, |
| 832 | .maxlen = sizeof (int), | 832 | .maxlen = sizeof (int), |
| 833 | .mode = 0644, | 833 | .mode = 0644, |
| 834 | .proc_handler = proc_dowatchdog, | 834 | .proc_handler = proc_dowatchdog, |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 52c9a9b91bdd..51c4f34d258e 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -29,9 +29,9 @@ | |||
| 29 | #include <linux/kvm_para.h> | 29 | #include <linux/kvm_para.h> |
| 30 | #include <linux/perf_event.h> | 30 | #include <linux/perf_event.h> |
| 31 | 31 | ||
| 32 | int watchdog_enabled = 1; | 32 | int watchdog_user_enabled = 1; |
| 33 | int __read_mostly watchdog_thresh = 10; | 33 | int __read_mostly watchdog_thresh = 10; |
| 34 | static int __read_mostly watchdog_disabled = 1; | 34 | static int __read_mostly watchdog_running; |
| 35 | static u64 __read_mostly sample_period; | 35 | static u64 __read_mostly sample_period; |
| 36 | 36 | ||
| 37 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); | 37 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); |
| @@ -63,7 +63,7 @@ static int __init hardlockup_panic_setup(char *str) | |||
| 63 | else if (!strncmp(str, "nopanic", 7)) | 63 | else if (!strncmp(str, "nopanic", 7)) |
| 64 | hardlockup_panic = 0; | 64 | hardlockup_panic = 0; |
| 65 | else if (!strncmp(str, "0", 1)) | 65 | else if (!strncmp(str, "0", 1)) |
| 66 | watchdog_enabled = 0; | 66 | watchdog_user_enabled = 0; |
| 67 | return 1; | 67 | return 1; |
| 68 | } | 68 | } |
| 69 | __setup("nmi_watchdog=", hardlockup_panic_setup); | 69 | __setup("nmi_watchdog=", hardlockup_panic_setup); |
| @@ -82,7 +82,7 @@ __setup("softlockup_panic=", softlockup_panic_setup); | |||
| 82 | 82 | ||
| 83 | static int __init nowatchdog_setup(char *str) | 83 | static int __init nowatchdog_setup(char *str) |
| 84 | { | 84 | { |
| 85 | watchdog_enabled = 0; | 85 | watchdog_user_enabled = 0; |
| 86 | return 1; | 86 | return 1; |
| 87 | } | 87 | } |
| 88 | __setup("nowatchdog", nowatchdog_setup); | 88 | __setup("nowatchdog", nowatchdog_setup); |
| @@ -90,7 +90,7 @@ __setup("nowatchdog", nowatchdog_setup); | |||
| 90 | /* deprecated */ | 90 | /* deprecated */ |
| 91 | static int __init nosoftlockup_setup(char *str) | 91 | static int __init nosoftlockup_setup(char *str) |
| 92 | { | 92 | { |
| 93 | watchdog_enabled = 0; | 93 | watchdog_user_enabled = 0; |
| 94 | return 1; | 94 | return 1; |
| 95 | } | 95 | } |
| 96 | __setup("nosoftlockup", nosoftlockup_setup); | 96 | __setup("nosoftlockup", nosoftlockup_setup); |
| @@ -158,7 +158,7 @@ void touch_all_softlockup_watchdogs(void) | |||
| 158 | #ifdef CONFIG_HARDLOCKUP_DETECTOR | 158 | #ifdef CONFIG_HARDLOCKUP_DETECTOR |
| 159 | void touch_nmi_watchdog(void) | 159 | void touch_nmi_watchdog(void) |
| 160 | { | 160 | { |
| 161 | if (watchdog_enabled) { | 161 | if (watchdog_user_enabled) { |
| 162 | unsigned cpu; | 162 | unsigned cpu; |
| 163 | 163 | ||
| 164 | for_each_present_cpu(cpu) { | 164 | for_each_present_cpu(cpu) { |
| @@ -490,12 +490,12 @@ static int watchdog_enable_all_cpus(void) | |||
| 490 | { | 490 | { |
| 491 | int err = 0; | 491 | int err = 0; |
| 492 | 492 | ||
| 493 | if (watchdog_disabled) { | 493 | if (!watchdog_running) { |
| 494 | err = smpboot_register_percpu_thread(&watchdog_threads); | 494 | err = smpboot_register_percpu_thread(&watchdog_threads); |
| 495 | if (err) | 495 | if (err) |
| 496 | pr_err("Failed to create watchdog threads, disabled\n"); | 496 | pr_err("Failed to create watchdog threads, disabled\n"); |
| 497 | else | 497 | else |
| 498 | watchdog_disabled = 0; | 498 | watchdog_running = 1; |
| 499 | } | 499 | } |
| 500 | 500 | ||
| 501 | return err; | 501 | return err; |
| @@ -506,8 +506,8 @@ static int watchdog_enable_all_cpus(void) | |||
| 506 | #ifdef CONFIG_SYSCTL | 506 | #ifdef CONFIG_SYSCTL |
| 507 | static void watchdog_disable_all_cpus(void) | 507 | static void watchdog_disable_all_cpus(void) |
| 508 | { | 508 | { |
| 509 | if (!watchdog_disabled) { | 509 | if (watchdog_running) { |
| 510 | watchdog_disabled = 1; | 510 | watchdog_running = 0; |
| 511 | smpboot_unregister_percpu_thread(&watchdog_threads); | 511 | smpboot_unregister_percpu_thread(&watchdog_threads); |
| 512 | } | 512 | } |
| 513 | } | 513 | } |
| @@ -522,7 +522,7 @@ int proc_dowatchdog(struct ctl_table *table, int write, | |||
| 522 | int err, old_thresh, old_enabled; | 522 | int err, old_thresh, old_enabled; |
| 523 | 523 | ||
| 524 | old_thresh = ACCESS_ONCE(watchdog_thresh); | 524 | old_thresh = ACCESS_ONCE(watchdog_thresh); |
| 525 | old_enabled = ACCESS_ONCE(watchdog_enabled); | 525 | old_enabled = ACCESS_ONCE(watchdog_user_enabled); |
| 526 | 526 | ||
| 527 | err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); | 527 | err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 528 | if (err || !write) | 528 | if (err || !write) |
| @@ -531,10 +531,10 @@ int proc_dowatchdog(struct ctl_table *table, int write, | |||
| 531 | set_sample_period(); | 531 | set_sample_period(); |
| 532 | /* | 532 | /* |
| 533 | * Watchdog threads shouldn't be enabled if they are | 533 | * Watchdog threads shouldn't be enabled if they are |
| 534 | * disabled. The 'watchdog_disabled' variable check in | 534 | * disabled. The 'watchdog_running' variable check in |
| 535 | * watchdog_*_all_cpus() function takes care of this. | 535 | * watchdog_*_all_cpus() function takes care of this. |
| 536 | */ | 536 | */ |
| 537 | if (watchdog_enabled && watchdog_thresh) | 537 | if (watchdog_user_enabled && watchdog_thresh) |
| 538 | err = watchdog_enable_all_cpus(); | 538 | err = watchdog_enable_all_cpus(); |
| 539 | else | 539 | else |
| 540 | watchdog_disable_all_cpus(); | 540 | watchdog_disable_all_cpus(); |
| @@ -542,7 +542,7 @@ int proc_dowatchdog(struct ctl_table *table, int write, | |||
| 542 | /* Restore old values on failure */ | 542 | /* Restore old values on failure */ |
| 543 | if (err) { | 543 | if (err) { |
| 544 | watchdog_thresh = old_thresh; | 544 | watchdog_thresh = old_thresh; |
| 545 | watchdog_enabled = old_enabled; | 545 | watchdog_user_enabled = old_enabled; |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | return err; | 548 | return err; |
| @@ -553,6 +553,6 @@ void __init lockup_detector_init(void) | |||
| 553 | { | 553 | { |
| 554 | set_sample_period(); | 554 | set_sample_period(); |
| 555 | 555 | ||
| 556 | if (watchdog_enabled) | 556 | if (watchdog_user_enabled) |
| 557 | watchdog_enable_all_cpus(); | 557 | watchdog_enable_all_cpus(); |
| 558 | } | 558 | } |
