Commit 9383d9679056e6cc4e7ff70f31da945a268238f4

Authored by Dimitri Sivanich
Committed by Thomas Gleixner
1 parent 9c44bc03ff

softlockup: fix softlockup_thresh unaligned access and disable detection at runtime

Fix unaligned access errors when setting softlockup_thresh on
64 bit platforms.

Allow softlockup detection to be disabled by setting
softlockup_thresh <= 0.

Detect that boot time softlockup detection has been disabled
earlier in softlockup_tick.

Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Showing 3 changed files with 16 additions and 7 deletions Side-by-side Diff

include/linux/sched.h
... ... @@ -295,10 +295,10 @@
295 295 extern void touch_softlockup_watchdog(void);
296 296 extern void touch_all_softlockup_watchdogs(void);
297 297 extern unsigned int softlockup_panic;
298   -extern unsigned long softlockup_thresh;
299 298 extern unsigned long sysctl_hung_task_check_count;
300 299 extern unsigned long sysctl_hung_task_timeout_secs;
301 300 extern unsigned long sysctl_hung_task_warnings;
  301 +extern int softlockup_thresh;
302 302 #else
303 303 static inline void softlockup_tick(void)
304 304 {
... ... @@ -25,7 +25,7 @@
25 25 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
26 26  
27 27 static int __read_mostly did_panic;
28   -unsigned long __read_mostly softlockup_thresh = 60;
  28 +int __read_mostly softlockup_thresh = 60;
29 29  
30 30 /*
31 31 * Should we panic (and reboot, if panic_timeout= is set) when a
... ... @@ -94,6 +94,14 @@
94 94 struct pt_regs *regs = get_irq_regs();
95 95 unsigned long now;
96 96  
  97 + /* Is detection switched off? */
  98 + if (!per_cpu(watchdog_task, this_cpu) || softlockup_thresh <= 0) {
  99 + /* Be sure we don't false trigger if switched back on */
  100 + if (touch_timestamp)
  101 + per_cpu(touch_timestamp, this_cpu) = 0;
  102 + return;
  103 + }
  104 +
97 105 if (touch_timestamp == 0) {
98 106 touch_softlockup_watchdog();
99 107 return;
... ... @@ -104,7 +112,7 @@
104 112 /* report at most once a second */
105 113 if ((print_timestamp >= touch_timestamp &&
106 114 print_timestamp < (touch_timestamp + 1)) ||
107   - did_panic || !per_cpu(watchdog_task, this_cpu)) {
  115 + did_panic) {
108 116 return;
109 117 }
110 118  
... ... @@ -84,12 +84,13 @@
84 84 extern int sysctl_nr_open_min, sysctl_nr_open_max;
85 85  
86 86 /* Constants used for minimum and maximum */
87   -#if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
  87 +#ifdef CONFIG_HIGHMEM
88 88 static int one = 1;
89 89 #endif
90 90  
91 91 #ifdef CONFIG_DETECT_SOFTLOCKUP
92 92 static int sixty = 60;
  93 +static int neg_one = -1;
93 94 #endif
94 95  
95 96 #ifdef CONFIG_MMU
96 97  
97 98  
... ... @@ -742,11 +743,11 @@
742 743 .ctl_name = CTL_UNNUMBERED,
743 744 .procname = "softlockup_thresh",
744 745 .data = &softlockup_thresh,
745   - .maxlen = sizeof(unsigned long),
  746 + .maxlen = sizeof(int),
746 747 .mode = 0644,
747   - .proc_handler = &proc_doulongvec_minmax,
  748 + .proc_handler = &proc_dointvec_minmax,
748 749 .strategy = &sysctl_intvec,
749   - .extra1 = &one,
  750 + .extra1 = &neg_one,
750 751 .extra2 = &sixty,
751 752 },
752 753 {