diff options
| -rw-r--r-- | include/linux/nmi.h | 5 | ||||
| -rw-r--r-- | include/linux/sched.h | 1 | ||||
| -rw-r--r-- | kernel/sysctl.c | 12 | ||||
| -rw-r--r-- | kernel/watchdog.c | 25 |
4 files changed, 20 insertions, 23 deletions
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index c536f8545f74..5317b8b2198f 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
| @@ -47,9 +47,10 @@ static inline bool trigger_all_cpu_backtrace(void) | |||
| 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(void); | 48 | u64 hw_nmi_get_sample_period(void); |
| 49 | extern int watchdog_enabled; | 49 | extern int watchdog_enabled; |
| 50 | extern int watchdog_thresh; | ||
| 50 | struct ctl_table; | 51 | struct ctl_table; |
| 51 | extern int proc_dowatchdog_enabled(struct ctl_table *, int , | 52 | extern int proc_dowatchdog(struct ctl_table *, int , |
| 52 | void __user *, size_t *, loff_t *); | 53 | void __user *, size_t *, loff_t *); |
| 53 | #endif | 54 | #endif |
| 54 | 55 | ||
| 55 | #endif | 56 | #endif |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 12211e1666e2..d8b2d0bec0d8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -315,7 +315,6 @@ extern int proc_dowatchdog_thresh(struct ctl_table *table, int write, | |||
| 315 | void __user *buffer, | 315 | void __user *buffer, |
| 316 | size_t *lenp, loff_t *ppos); | 316 | size_t *lenp, loff_t *ppos); |
| 317 | extern unsigned int softlockup_panic; | 317 | extern unsigned int softlockup_panic; |
| 318 | extern int softlockup_thresh; | ||
| 319 | void lockup_detector_init(void); | 318 | void lockup_detector_init(void); |
| 320 | #else | 319 | #else |
| 321 | static inline void touch_softlockup_watchdog(void) | 320 | static inline void touch_softlockup_watchdog(void) |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c0bb32414b17..3dd0c46fa3bb 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -730,14 +730,16 @@ static struct ctl_table kern_table[] = { | |||
| 730 | .data = &watchdog_enabled, | 730 | .data = &watchdog_enabled, |
| 731 | .maxlen = sizeof (int), | 731 | .maxlen = sizeof (int), |
| 732 | .mode = 0644, | 732 | .mode = 0644, |
| 733 | .proc_handler = proc_dowatchdog_enabled, | 733 | .proc_handler = proc_dowatchdog, |
| 734 | .extra1 = &zero, | ||
| 735 | .extra2 = &one, | ||
| 734 | }, | 736 | }, |
| 735 | { | 737 | { |
| 736 | .procname = "watchdog_thresh", | 738 | .procname = "watchdog_thresh", |
| 737 | .data = &softlockup_thresh, | 739 | .data = &watchdog_thresh, |
| 738 | .maxlen = sizeof(int), | 740 | .maxlen = sizeof(int), |
| 739 | .mode = 0644, | 741 | .mode = 0644, |
| 740 | .proc_handler = proc_dowatchdog_thresh, | 742 | .proc_handler = proc_dowatchdog, |
| 741 | .extra1 = &neg_one, | 743 | .extra1 = &neg_one, |
| 742 | .extra2 = &sixty, | 744 | .extra2 = &sixty, |
| 743 | }, | 745 | }, |
| @@ -755,7 +757,9 @@ static struct ctl_table kern_table[] = { | |||
| 755 | .data = &watchdog_enabled, | 757 | .data = &watchdog_enabled, |
| 756 | .maxlen = sizeof (int), | 758 | .maxlen = sizeof (int), |
| 757 | .mode = 0644, | 759 | .mode = 0644, |
| 758 | .proc_handler = proc_dowatchdog_enabled, | 760 | .proc_handler = proc_dowatchdog, |
| 761 | .extra1 = &zero, | ||
| 762 | .extra2 = &one, | ||
| 759 | }, | 763 | }, |
| 760 | #endif | 764 | #endif |
| 761 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | 765 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index cf0e09f452e7..60301916f62e 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <linux/perf_event.h> | 28 | #include <linux/perf_event.h> |
| 29 | 29 | ||
| 30 | int watchdog_enabled = 1; | 30 | int watchdog_enabled = 1; |
| 31 | int __read_mostly softlockup_thresh = 60; | 31 | int __read_mostly watchdog_thresh = 60; |
| 32 | 32 | ||
| 33 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); | 33 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); |
| 34 | static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); | 34 | static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); |
| @@ -105,12 +105,12 @@ static unsigned long get_timestamp(int this_cpu) | |||
| 105 | static unsigned long get_sample_period(void) | 105 | static unsigned long get_sample_period(void) |
| 106 | { | 106 | { |
| 107 | /* | 107 | /* |
| 108 | * convert softlockup_thresh from seconds to ns | 108 | * convert watchdog_thresh from seconds to ns |
| 109 | * the divide by 5 is to give hrtimer 5 chances to | 109 | * the divide by 5 is to give hrtimer 5 chances to |
| 110 | * increment before the hardlockup detector generates | 110 | * increment before the hardlockup detector generates |
| 111 | * a warning | 111 | * a warning |
| 112 | */ | 112 | */ |
| 113 | return softlockup_thresh * (NSEC_PER_SEC / 5); | 113 | return watchdog_thresh * (NSEC_PER_SEC / 5); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /* Commands for resetting the watchdog */ | 116 | /* Commands for resetting the watchdog */ |
| @@ -182,7 +182,7 @@ static int is_softlockup(unsigned long touch_ts) | |||
| 182 | unsigned long now = get_timestamp(smp_processor_id()); | 182 | unsigned long now = get_timestamp(smp_processor_id()); |
| 183 | 183 | ||
| 184 | /* Warn about unreasonable delays: */ | 184 | /* Warn about unreasonable delays: */ |
| 185 | if (time_after(now, touch_ts + softlockup_thresh)) | 185 | if (time_after(now, touch_ts + watchdog_thresh)) |
| 186 | return now - touch_ts; | 186 | return now - touch_ts; |
| 187 | 187 | ||
| 188 | return 0; | 188 | return 0; |
| @@ -501,19 +501,19 @@ static void watchdog_disable_all_cpus(void) | |||
| 501 | /* sysctl functions */ | 501 | /* sysctl functions */ |
| 502 | #ifdef CONFIG_SYSCTL | 502 | #ifdef CONFIG_SYSCTL |
| 503 | /* | 503 | /* |
| 504 | * proc handler for /proc/sys/kernel/nmi_watchdog | 504 | * proc handler for /proc/sys/kernel/nmi_watchdog,watchdog_thresh |
| 505 | */ | 505 | */ |
| 506 | 506 | ||
| 507 | int proc_dowatchdog_enabled(struct ctl_table *table, int write, | 507 | int proc_dowatchdog(struct ctl_table *table, int write, |
| 508 | void __user *buffer, size_t *length, loff_t *ppos) | 508 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 509 | { | 509 | { |
| 510 | int ret; | 510 | int ret; |
| 511 | 511 | ||
| 512 | ret = proc_dointvec(table, write, buffer, length, ppos); | 512 | ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 513 | if (ret || !write) | 513 | if (ret || !write) |
| 514 | goto out; | 514 | goto out; |
| 515 | 515 | ||
| 516 | if (watchdog_enabled) | 516 | if (watchdog_enabled && watchdog_thresh) |
| 517 | watchdog_enable_all_cpus(); | 517 | watchdog_enable_all_cpus(); |
| 518 | else | 518 | else |
| 519 | watchdog_disable_all_cpus(); | 519 | watchdog_disable_all_cpus(); |
| @@ -521,13 +521,6 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write, | |||
| 521 | out: | 521 | out: |
| 522 | return ret; | 522 | return ret; |
| 523 | } | 523 | } |
| 524 | |||
| 525 | int proc_dowatchdog_thresh(struct ctl_table *table, int write, | ||
| 526 | void __user *buffer, | ||
| 527 | size_t *lenp, loff_t *ppos) | ||
| 528 | { | ||
| 529 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); | ||
| 530 | } | ||
| 531 | #endif /* CONFIG_SYSCTL */ | 524 | #endif /* CONFIG_SYSCTL */ |
| 532 | 525 | ||
| 533 | 526 | ||
