aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/watchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/watchdog.c')
-rw-r--r--kernel/watchdog.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7f9c3c52ecc1..e359b2e7e7d5 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -377,7 +377,8 @@ static int watchdog_nmi_enable(int cpu)
377 goto out_save; 377 goto out_save;
378 } 378 }
379 379
380 printk(KERN_ERR "NMI watchdog failed to create perf event on cpu%i: %p\n", cpu, event); 380 printk(KERN_ERR "NMI watchdog disabled for cpu%i: unable to create perf event: %ld\n",
381 cpu, PTR_ERR(event));
381 return -1; 382 return -1;
382 383
383 /* success path */ 384 /* success path */
@@ -440,9 +441,6 @@ static int watchdog_enable(int cpu)
440 wake_up_process(p); 441 wake_up_process(p);
441 } 442 }
442 443
443 /* if any cpu succeeds, watchdog is considered enabled for the system */
444 watchdog_enabled = 1;
445
446 return 0; 444 return 0;
447} 445}
448 446
@@ -470,12 +468,16 @@ static void watchdog_disable(int cpu)
470static void watchdog_enable_all_cpus(void) 468static void watchdog_enable_all_cpus(void)
471{ 469{
472 int cpu; 470 int cpu;
473 int result = 0; 471
472 watchdog_enabled = 0;
474 473
475 for_each_online_cpu(cpu) 474 for_each_online_cpu(cpu)
476 result += watchdog_enable(cpu); 475 if (!watchdog_enable(cpu))
476 /* if any cpu succeeds, watchdog is considered
477 enabled for the system */
478 watchdog_enabled = 1;
477 479
478 if (result) 480 if (!watchdog_enabled)
479 printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n"); 481 printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n");
480 482
481} 483}
@@ -503,10 +505,12 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write,
503{ 505{
504 proc_dointvec(table, write, buffer, length, ppos); 506 proc_dointvec(table, write, buffer, length, ppos);
505 507
506 if (watchdog_enabled) 508 if (write) {
507 watchdog_enable_all_cpus(); 509 if (watchdog_enabled)
508 else 510 watchdog_enable_all_cpus();
509 watchdog_disable_all_cpus(); 511 else
512 watchdog_disable_all_cpus();
513 }
510 return 0; 514 return 0;
511} 515}
512 516