public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value
@ 2010-08-21  9:43 Akinobu Mita
  2010-08-21  9:43 ` [PATCH 2/2] lockup_detector: remove unnecessary panic_notifier Akinobu Mita
  2010-08-23 13:05 ` [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value Don Zickus
  0 siblings, 2 replies; 4+ messages in thread
From: Akinobu Mita @ 2010-08-21  9:43 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, Don Zickus, Ingo Molnar

By the commit e6bde73b07edeb703d4c89c1daabc09c303de11f
("cpu-hotplug: return better errno on cpu hotplug failure"),
the cpu notifier can return encapsulate errno value.

This converts the cpu notifier to return encapsulate errno value
for lockup_detector.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
 kernel/watchdog.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 613bc1f..de98f77 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -368,7 +368,7 @@ static int watchdog_nmi_enable(int cpu)
 	}
 
 	printk(KERN_ERR "NMI watchdog failed to create perf event on cpu%i: %p\n", cpu, event);
-	return -1;
+	return PTR_ERR(event);
 
 	/* success path */
 out_save:
@@ -412,17 +412,19 @@ static int watchdog_prepare_cpu(int cpu)
 static int watchdog_enable(int cpu)
 {
 	struct task_struct *p = per_cpu(softlockup_watchdog, cpu);
+	int err;
 
 	/* enable the perf event */
-	if (watchdog_nmi_enable(cpu) != 0)
-		return -1;
+	err = watchdog_nmi_enable(cpu);
+	if (err)
+		return err;
 
 	/* create the watchdog thread */
 	if (!p) {
 		p = kthread_create(watchdog, (void *)(unsigned long)cpu, "watchdog/%d", cpu);
 		if (IS_ERR(p)) {
 			printk(KERN_ERR "softlockup watchdog for %i failed\n", cpu);
-			return -1;
+			return PTR_ERR(p);
 		}
 		kthread_bind(p, cpu);
 		per_cpu(watchdog_touch_ts, cpu) = 0;
@@ -516,17 +518,16 @@ static int __cpuinit
 cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
 	int hotcpu = (unsigned long)hcpu;
+	int err = 0;
 
 	switch (action) {
 	case CPU_UP_PREPARE:
 	case CPU_UP_PREPARE_FROZEN:
-		if (watchdog_prepare_cpu(hotcpu))
-			return NOTIFY_BAD;
+		err = watchdog_prepare_cpu(hotcpu);
 		break;
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
-		if (watchdog_enable(hotcpu))
-			return NOTIFY_BAD;
+		err = watchdog_enable(hotcpu);
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_UP_CANCELED:
@@ -539,7 +540,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 		break;
 #endif /* CONFIG_HOTPLUG_CPU */
 	}
-	return NOTIFY_OK;
+	return notifier_from_errno(err);
 }
 
 static struct notifier_block __cpuinitdata cpu_nfb = {
@@ -555,7 +556,7 @@ static int __init spawn_watchdog_task(void)
 		return 0;
 
 	err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
-	WARN_ON(err == NOTIFY_BAD);
+	WARN_ON(notifier_to_errno(err));
 
 	cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
 	register_cpu_notifier(&cpu_nfb);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] lockup_detector: remove unnecessary panic_notifier
  2010-08-21  9:43 [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value Akinobu Mita
@ 2010-08-21  9:43 ` Akinobu Mita
  2010-08-23 13:07   ` Don Zickus
  2010-08-23 13:05 ` [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value Don Zickus
  1 sibling, 1 reply; 4+ messages in thread
From: Akinobu Mita @ 2010-08-21  9:43 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, Don Zickus, Ingo Molnar

The panic notifer in lockup_detector just set did_panic to 1.
But did_panic is not used anywhere so we can just remove it.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
 kernel/watchdog.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index de98f77..1ff0b8c 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -43,7 +43,6 @@ static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
 #endif
 
-static int __read_mostly did_panic;
 static int __initdata no_watchdog;
 
 
@@ -180,18 +179,6 @@ static int is_softlockup(unsigned long touch_ts)
 	return 0;
 }
 
-static int
-watchdog_panic(struct notifier_block *this, unsigned long event, void *ptr)
-{
-	did_panic = 1;
-
-	return NOTIFY_DONE;
-}
-
-static struct notifier_block panic_block = {
-	.notifier_call = watchdog_panic,
-};
-
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
 static struct perf_event_attr wd_hw_attr = {
 	.type		= PERF_TYPE_HARDWARE,
@@ -561,8 +548,6 @@ static int __init spawn_watchdog_task(void)
 	cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
 	register_cpu_notifier(&cpu_nfb);
 
-	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
-
 	return 0;
 }
 early_initcall(spawn_watchdog_task);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value
  2010-08-21  9:43 [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value Akinobu Mita
  2010-08-21  9:43 ` [PATCH 2/2] lockup_detector: remove unnecessary panic_notifier Akinobu Mita
@ 2010-08-23 13:05 ` Don Zickus
  1 sibling, 0 replies; 4+ messages in thread
From: Don Zickus @ 2010-08-23 13:05 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel, akpm, Ingo Molnar

On Sat, Aug 21, 2010 at 06:43:46PM +0900, Akinobu Mita wrote:
> By the commit e6bde73b07edeb703d4c89c1daabc09c303de11f
> ("cpu-hotplug: return better errno on cpu hotplug failure"),
> the cpu notifier can return encapsulate errno value.
> 
> This converts the cpu notifier to return encapsulate errno value
> for lockup_detector.

Looks ok.

Acked-by: Don Zickus <dzickus@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] lockup_detector: remove unnecessary panic_notifier
  2010-08-21  9:43 ` [PATCH 2/2] lockup_detector: remove unnecessary panic_notifier Akinobu Mita
@ 2010-08-23 13:07   ` Don Zickus
  0 siblings, 0 replies; 4+ messages in thread
From: Don Zickus @ 2010-08-23 13:07 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel, akpm, Ingo Molnar

On Sat, Aug 21, 2010 at 06:43:47PM +0900, Akinobu Mita wrote:
> The panic notifer in lockup_detector just set did_panic to 1.
> But did_panic is not used anywhere so we can just remove it.

Thanks.

Acked-by: Don Zickus <dzickus@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-23 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-21  9:43 [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value Akinobu Mita
2010-08-21  9:43 ` [PATCH 2/2] lockup_detector: remove unnecessary panic_notifier Akinobu Mita
2010-08-23 13:07   ` Don Zickus
2010-08-23 13:05 ` [PATCH 1/2] lockup_detector: convert cpu notifier to return encapsulate errno value Don Zickus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox