From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751811Ab1AYDYT (ORCPT ); Mon, 24 Jan 2011 22:24:19 -0500 Received: from mail-qy0-f174.google.com ([209.85.216.174]:50199 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751446Ab1AYDYS (ORCPT ); Mon, 24 Jan 2011 22:24:18 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Azji1r6iVDkW2y1jxZPp1ZJ+psv+BsWy68r+dbcDxCHajOCJuxZnBv2JI4wd4Fc7BY KDTGLTdiQAhkf7OkG3dQjfoiq0Zf8+hoSQs2uBRnaaq4xTXx/Byk0Gd3P2ipQebI7Ui7 zYnnxtoXiOuWNuqs8qtBdWsueWOg9dUkmBKkc= Date: Tue, 25 Jan 2011 11:24:01 +0800 From: =?utf-8?Q?Am=C3=A9rico?= Wang To: Anithra P Janakiraman Cc: linux-kernel@vger.kernel.org, dave@linux.vnet.ibm.com, xiyou.wangcong@gmail.com, sugaken.r3@gmail.com, alan@lxorguk.ukuu.org.uk, srikar@linux.vnet.ibm.com, suzuki@in.ibm.com, vatsa@linux.vnet.ibm.com, ananth@in.ibm.com Subject: Re: [PATCH v2] Softdog enhancement to optionally invoke panic instead of reboot on timer expiry Message-ID: <20110125032401.GA13618@cr0.nay.redhat.com> References: <20110125000352.0be09450@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110125000352.0be09450@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2011 at 12:03:52AM +0530, Anithra P Janakiraman wrote: > >Hi, > >We currently have no way of determining the reason for failure when a >softdog timeout occurs. We use softdog to watch for critical application >failures, and at the minimum a snapshot of the system would help to >determine the cause. In such a scenario the application could fail but >there isn't a softlockup as such, hence the detect softlockup feature >does not help. >The patch below adds a module parameter soft_panic which when set to >1 causes softdog to invoke panic instead of reboot when the softdog >timer expires. By invoking panic we execute kdump if it is configured >and the vmcore generated by kdump should provide atleast a minimal idea >of the reason for failure. > >Based on an original patch by Ken Sugawara >Signed-off-by: Anithra P J Cool, using a module parameter is better. Reviewed-by: WANG Cong Thanks. >--- > drivers/watchdog/softdog.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > >Index: linux-2.6.38-rc1/drivers/watchdog/softdog.c >=================================================================== >--- linux-2.6.38-rc1.orig/drivers/watchdog/softdog.c >+++ linux-2.6.38-rc1/drivers/watchdog/softdog.c >@@ -48,6 +48,7 @@ > #include > #include > #include >+#include > > #define PFX "SoftDog: " > >@@ -75,6 +76,13 @@ > "Softdog action, set to 1 to ignore reboots, 0 to reboot " > "(default depends on ONLY_TESTING)"); > >+ >+static int soft_panic; >+ >+module_param(soft_panic, int, 0); >+MODULE_PARM_DESC(soft_panic, >+ "Softdog action, set to 1 to panic, 0 to reboot (default 0)"); >+ > /* > * Our timer > */ >@@ -98,7 +106,10 @@ > > if (soft_noboot) > printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); >- else { >+ else if (soft_panic) { >+ printk(KERN_CRIT PFX "Initiating panic.\n"); >+ panic("Software Watchdog Timer expired."); >+ } else { > printk(KERN_CRIT PFX "Initiating system reboot.\n"); > emergency_restart(); > printk(KERN_CRIT PFX "Reboot didn't ?????\n"); >@@ -267,7 +278,8 @@ > }; > > static char banner[] __initdata = KERN_INFO "Software Watchdog Timer: 0.07 " >- "initialized. soft_noboot=%d soft_margin=%d sec (nowayout= %d)\n"; >+ "initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d " >+ "(nowayout= %d)\n"; > > static int __init watchdog_init(void) > { >@@ -298,7 +310,7 @@ > return ret; > } > >- printk(banner, soft_noboot, soft_margin, nowayout); >+ printk(banner, soft_noboot, soft_margin, soft_panic, nowayout); > > return 0; > } > > >