Skip to contentSkip to conversation

disable softlockup detection at boottime

PATCH In review Dimitri Sivanich 3 participants 8 messages Apr 23, 2008 – Apr 29, 2008 Proc sysctl

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disable softlockup detection at boottime

This patch allows softlockup detection to be disabled by specifying a boottime parameter.

kernel/softlockup.c +19 -1
Index: linux/kernel/softlockup.c
===================================================================
@@ -24,6 +24,7 @@ static DEFINE_PER_CPU(unsigned long, tou
 static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 
+static int __read_mostly softlockup_off;
 static int __read_mostly did_panic;
 unsigned long __read_mostly softlockup_thresh = 60;
 
@@ -53,7 +54,8 @@ void touch_softlockup_watchdog(void)
 {
 	int this_cpu = raw_smp_processor_id();
 
-	__raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
+	if (!softlockup_off)
+		__raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
 }
 EXPORT_SYMBOL(touch_softlockup_watchdog);
 
@@ -61,6 +63,9 @@ void touch_all_softlockup_watchdogs(void
 {
 	int cpu;
 
+	if (softlockup_off)
+		return;
+
 	/* Cause each CPU to re-update its timestamp rather than complain */
 	for_each_online_cpu(cpu)
 		per_cpu(touch_timestamp, cpu) = 0;
@@ -79,6 +84,9 @@ void softlockup_tick(void)
 	struct pt_regs *regs = get_irq_regs();
 	unsigned long now;
 
+	if (softlockup_off)
+		return;
+
 	if (touch_timestamp == 0) {
 		touch_softlockup_watchdog();
 		return;
@@ -306,9 +314,19 @@ __init void spawn_softlockup_task(void)
 	void *cpu = (void *)(long)smp_processor_id();
 	int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
 
+	if (softlockup_off)
+		return;
+
 	BUG_ON(err == NOTIFY_BAD);
 	cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
 	register_cpu_notifier(&cpu_nfb);
 
 	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
 }
+
+static int __init disable_softlockup_detection(char *str)
+{
+	softlockup_off = 1;
+	return 1;
+}
+__setup("nosoftlockup", disable_softlockup_detection);
#1 lore raw
Quoted 2 lines · On Wed, 23 Apr 2008 15:16:13 -0500 Dimitri Sivanich wrote:

This patch allows softlockup detection to be disabled by specifying a boottime parameter.

Seems to be missing (a) justification/why and
(b) entry in Documentation/kernel-parameters.txt

Quoted 55 lines

Index: linux/kernel/softlockup.c
===================================================================

kernel/softlockup.c +12 -1
@@ -24,6 +24,7 @@ static DEFINE_PER_CPU(unsigned long, tou
 static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 
+static int __read_mostly softlockup_off;
 static int __read_mostly did_panic;
 unsigned long __read_mostly softlockup_thresh = 60;
 
@@ -53,7 +54,8 @@ void touch_softlockup_watchdog(void)
 {
 	int this_cpu = raw_smp_processor_id();
 
-	__raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
+	if (!softlockup_off)
+		__raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
 }
 EXPORT_SYMBOL(touch_softlockup_watchdog);
 
@@ -61,6 +63,9 @@ void touch_all_softlockup_watchdogs(void
 {
 	int cpu;
 
+	if (softlockup_off)
+		return;
+
 	/* Cause each CPU to re-update its timestamp rather than complain */
 	for_each_online_cpu(cpu)
 		per_cpu(touch_timestamp, cpu) = 0;
@@ -79,6 +84,9 @@ void softlockup_tick(void)
 	struct pt_regs *regs = get_irq_regs();
 	unsigned long now;
 
+	if (softlockup_off)
+		return;
+
 	if (touch_timestamp == 0) {
 		touch_softlockup_watchdog();
 		return;
@@ -306,9 +314,19 @@ __init void spawn_softlockup_task(void)
 	void *cpu = (void *)(long)smp_processor_id();
 	int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
 
+	if (softlockup_off)
+		return;
+
 	BUG_ON(err == NOTIFY_BAD);
 	cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
 	register_cpu_notifier(&cpu_nfb);
 

kernel/softlockup.c __init void spawn_softlockup_task(void)

Quoted 10 lines
kernel/softlockup.c +7 -1
 	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
 }
+
+static int __init disable_softlockup_detection(char *str)
+{
+	softlockup_off = 1;
+	return 1;
+}
+__setup("nosoftlockup", disable_softlockup_detection);
--

---
~Randy

#2 lore raw
Quoted 1 line · Randy Dunlap

(b) entry in Documentation/kernel-parameters.txt

Oops, my bad, I missed the other 'nosoftlockup'.

#3 lore raw
In reply to Dimitri Sivanich
Quoted 2 lines · Dimitri Sivanich

This patch allows softlockup detection to be disabled by specifying a boottime parameter.

good idea - but why dont you set softlockup_thresh to 0, which is the "off" switch already? (and that way it can be turned back on later as well, by the sysadmin.)

Ingo

#4 lore raw
Quoted 5 lines · Ingo Molnar

good idea - but why dont you set softlockup_thresh to 0, which is the "off" switch already? (and that way it can be turned back on later as well, by the sysadmin.)

I'm getting unaligned access errors trying to set it to anything, so it's not working for me currently (2.6.25):

It's tripping up on the address of 'one', which is an int that is not properly aligned for the unsigned long comparison in proc_doulongvec_minmax on my 64 bit machine. Also, the value '0' is invalid for softlockup_thresh, correct?

I temporarily got around these issues with the following hack.

kernel/sysctl.c 2008-04-28 13:37:43.000561710 -0500 renamed from kernel/sysctl.c 2008-04-16 21:49:44.000000000 -0500 +2 -2
Index: linux/kernel/sysctl.c
===================================================================
@@ -748,9 +748,9 @@ static struct ctl_table kern_table[] = {
                .data           = &softlockup_thresh,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = &proc_dointvec_minmax,
                .strategy       = &sysctl_intvec,
-               .extra1         = &one,
+               .extra1         = &zero,
                .extra2         = &sixty,
 
 

Also, I'm not convinced that changing this to 0 does indeed switch off softlockup detection (but I could be missing something):

void softlockup_tick(void)
{
..
..

        /* Warn about unreasonable delays: */
        if (now <= (touch_timestamp + softlockup_thresh))
                return;
        
        per_cpu(print_timestamp, this_cpu) = touch_timestamp;
   
        spin_lock(&print_lock);
        printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
                        this_cpu, now - touch_timestamp,
                        current->comm, task_pid_nr(current));

Dimitri

#5 lore raw
Quoted 10 lines · Dimitri Sivanich
Quoted 5 lines · Ingo Molnar

good idea - but why dont you set softlockup_thresh to 0, which is the "off" switch already? (and that way it can be turned back on later as well, by the sysadmin.)

I'm getting unaligned access errors trying to set it to anything, so it's not working for me currently (2.6.25):

Quoted 6 lines

It's tripping up on the address of 'one', which is an int that is not properly aligned for the unsigned long comparison in proc_doulongvec_minmax on my 64 bit machine. Also, the value '0' is invalid for softlockup_thresh, correct?

I temporarily got around these issues with the following hack.

ah, sorry. But ... perhaps using threshold -1 would be the most intuitive setting? (for 'infinite timeout' ==> softlockup detector turned off) That way it all becomes configurable as part of the threshold? No strong opinion though.

Ingo

#6 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 8 lines · Dimitri Sivanich

I'm getting unaligned access errors trying to set it to anything, so it's not working for me currently (2.6.25):

It's tripping up on the address of 'one', which is an int that is not properly aligned for the unsigned long comparison in proc_doulongvec_minmax on my 64 bit machine. Also, the value '0' is invalid for softlockup_thresh, correct?

Quoted 7 lines
Quoted 1 line

I temporarily got around these issues with the following hack.

ah, sorry. But ... perhaps using threshold -1 would be the most intuitive setting? (for 'infinite timeout' ==> softlockup detector turned off) That way it all becomes configurable as part of the threshold? No strong opinion though.

Having the ability to switch it off dynamically would be nice to have, but will need a little work yet. Any solution should also minimize the amount of time spent in softlockup_tick.

Either '0' or '-1' seems OK to me, but if '-1' turns it off, do we allow a value of '0'?.

#7 lore raw
Quoted 11 lines · Dimitri Sivanich
Quoted 4 lines

ah, sorry. But ... perhaps using threshold -1 would be the most intuitive setting? (for 'infinite timeout' ==> softlockup detector turned off) That way it all becomes configurable as part of the threshold? No strong opinion though.

Having the ability to switch it off dynamically would be nice to have, but will need a little work yet. Any solution should also minimize the amount of time spent in softlockup_tick.

Either '0' or '-1' seems OK to me, but if '-1' turns it off, do we allow a value of '0'?.

i think <= 0 should be the condition for "off". That means both -1 and 0 would be OK.

Ingo