Skip to contentSkip to conversation

v2.6.26-rc3 patches

WATCHDOG In review Wim Van Sebroeck 6 participants 9 messages May 25, 2008 – May 30, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

Sorry for the delay's. Our new house is however a bigger priority. I compiled the patches/fixes and a new driver that should go in for the 2.6.26 release.

Note: On the watchdog side we still have 2 drivers from Florian Fainelli (where I need to check if we have all fixes first) and Alan's Cox clean-up patches. After that we have the at91sam* driver, the problem with some ICH9 based motherboards, the new driver for the SCH311X io-chipset and we should proceed on the uniform watchdog driver.

So please allready pull from 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git
or if master.kernel.org hasn't synced up yet:
master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git

This will update the following files:

 drivers/watchdog/Kconfig        |   13 +
 drivers/watchdog/Makefile       |    1 
 drivers/watchdog/bfin_wdt.c     |  111 +++++++++-----
 drivers/watchdog/booke_wdt.c    |   88 +++++------
 drivers/watchdog/geodewdt.c     |  309 ++++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/hpwdt.c        |   27 +--
 drivers/watchdog/iTCO_wdt.c     |   14 +
 drivers/watchdog/w83697hf_wdt.c |   38 +++-
 8 files changed, 485 insertions(+), 116 deletions(-)

with these Changes:

Author: Gabriel C <[email protected]>
Date:   Wed Apr 30 16:51:10 2008 +0200

[WATCHDOG] Add ICH9DO into the iTCO_wdt.c driver

Add the Intel ICH9DO controller ID's for the iTCO_wdt kernel driver and bump the driver version.

Tested on an P5E-VM DO ASUS motherboard.

Author: Chen Gong <[email protected]>
Date:   Tue Apr 29 16:42:05 2008 +0800

[WATCHDOG] Fix booke_wdt.c on MPC85xx SMP system's

On Book-E SMP systems each core has its own private watchdog. If only one watchdog is enabled, when the core that doesn't enable the watchdog is hung, system can't reset because no watchdog is running on it. That's bad. It means we must enable watchdogs on both cores.

We can use smp_call_function() to send appropriate messages to all the other cores to enable and update the watchdog.

Author: Jordan Crouse <[email protected]>
Date:   Mon Jan 21 10:07:00 2008 -0700

[WATCHDOG] Add a watchdog driver based on the CS5535/CS5536 MFGPT timers

Add a watchdog timer based on the MFGPT timers in the CS5535/CS5536 companion chips to the AMD Geode GX and LX processors. Only caveat is that the BIOS must provide at least a one free timer, and most do not.

Author: Mingarelli, Thomas <[email protected]>
Date:   Tue Mar 25 17:17:30 2008 +0000

[WATCHDOG] hpwdt: Fix NMI handling.

I need to just return in case it's not my NMI so someone else can take a look at it (and reset die_nmi_called to 0 in case I actually do get one that's mine to handle).

Author: Mike Frysinger <[email protected]>
Date:   Thu Mar 27 11:53:32 2008 -0700

[WATCHDOG] Blackfin Watchdog Driver: split platform device/driver

- split platform device/driver registering from actual watchdog device/driver registering so that we can cleanly load/unload
- fixup __initdata with __initconst and __devinitdata with __devinitconst

Author: Samuel Tardieu <[email protected]>
Date:   Wed Mar 12 14:28:03 2008 +0100

[WATCHDOG] Add w83697h_wdt early_disable option

Pádraig Brady requested the possibility of not disabling the watchdog at module load time or kernel boot time if it had been previously enabled in the bios. It may help rebooting the machine if it freezes before the userland daemon kicks in.

Author: Samuel Tardieu <[email protected]>
Date:   Wed Mar 12 14:28:02 2008 +0100

[WATCHDOG] Make w83697h_wdt timeout option string similar to others

Author: Samuel Tardieu <[email protected]>
Date:   Wed Mar 12 14:28:01 2008 +0100

[WATCHDOG] Make w83697h_wdt void-like functions void

Some non-exported functions always returned 0. Mark them void instead.

The Changes can also be looked at on:

	http://www.kernel.org/git/?p=linux/kernel/git/wim/linux-2.6-watchdog.git;a=summary

For completeness, I added the overal diff below.

Greetings,
Wim.

================================================================================

drivers/watchdog/Kconfig +13 -0
index 254d115..ccb78f6 100644
@@ -295,6 +295,19 @@ config ALIM7101_WDT
 
 	  Most people will say N.
 
+config GEODE_WDT
+	tristate "AMD Geode CS5535/CS5536 Watchdog"
+	depends on MGEODE_LX
+	help
+	  This driver enables a watchdog capability built into the
+	  CS5535/CS5536 companion chips for the AMD Geode GX and LX
+	  processors.  This watchdog watches your kernel to make sure
+	  it doesn't freeze, and if it does, it reboots your computer after
+	  a certain amount of time.
+
+	  You can compile this driver directly into the kernel, or use
+	  it as a module.  The module will be called geodewdt.
+
 config SC520_WDT
 	tristate "AMD Elan SC520 processor Watchdog"
 	depends on X86
drivers/watchdog/Makefile +1 -0
index f3fb170..25b352b 100644
@@ -59,6 +59,7 @@ obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
 obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
 obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
 obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
+obj-$(CONFIG_GEODE_WDT) += geodewdt.o
 obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
 obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
 obj-$(CONFIG_IB700_WDT) += ib700wdt.o
drivers/watchdog/bfin_wdt.c +71 -40

153 lines not on this page · raw message

drivers/watchdog/booke_wdt.c +40 -48

181 lines not on this page · raw message

drivers/watchdog/geodewdt.c new file +309 -0

309 lines not on this page · raw message

drivers/watchdog/hpwdt.c +12 -15
index 6483d10..6a63535 100644
@@ -418,23 +418,20 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
 	static unsigned long rom_pl;
 	static int die_nmi_called;
 
-	if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
-		return NOTIFY_OK;
-
-	spin_lock_irqsave(&rom_lock, rom_pl);
-	if (!die_nmi_called)
-		asminline_call(&cmn_regs, cru_rom_addr);
-	die_nmi_called = 1;
-	spin_unlock_irqrestore(&rom_lock, rom_pl);
-	if (cmn_regs.u1.ral == 0) {
-		printk(KERN_WARNING "hpwdt: An NMI occurred, "
-		       "but unable to determine source.\n");
-	} else {
-		panic("An NMI occurred, please see the Integrated "
-			"Management Log for details.\n");
+	if (ulReason == DIE_NMI || ulReason == DIE_NMI_IPI) {
+		spin_lock_irqsave(&rom_lock, rom_pl);
+		if (!die_nmi_called)
+			asminline_call(&cmn_regs, cru_rom_addr);
+		die_nmi_called = 1;
+		spin_unlock_irqrestore(&rom_lock, rom_pl);
+		if (cmn_regs.u1.ral != 0) {
+			panic("An NMI occurred, please see the Integrated "
+			      "Management Log for details.\n");
+		}
 	}
 
-	return NOTIFY_STOP;
+	die_nmi_called = 0;
+	return NOTIFY_DONE;
 }
 
 /*
drivers/watchdog/iTCO_wdt.c +9 -5
index a0e6809..95ba985 100644
@@ -41,9 +41,10 @@
  *	82801HH  (ICH8DH)    : document number 313056-003, 313057-009,
  *	82801HO  (ICH8DO)    : document number 313056-003, 313057-009,
  *	82801HEM (ICH8M-E)   : document number 313056-003, 313057-009,
- *	82801IB  (ICH9)      : document number 316972-001, 316973-001,
- *	82801IR  (ICH9R)     : document number 316972-001, 316973-001,
- *	82801IH  (ICH9DH)    : document number 316972-001, 316973-001,
+ *	82801IB  (ICH9)      : document number 316972-001, 316973-006,
+ *	82801IR  (ICH9R)     : document number 316972-001, 316973-006,
+ *	82801IH  (ICH9DH)    : document number 316972-001, 316973-006,
+ *	82801IO  (ICH9DO)    : document number 316972-001, 316973-006,
  *	6300ESB  (6300ESB)   : document number 300641-003, 300884-010,
  *	631xESB  (631xESB)   : document number 313082-001, 313075-005,
  *	632xESB  (632xESB)   : document number 313082-001, 313075-005
@@ -55,8 +56,8 @@
 
 /* Module and version information */
 #define DRV_NAME        "iTCO_wdt"
-#define DRV_VERSION     "1.02"
-#define DRV_RELDATE     "26-Jul-2007"
+#define DRV_VERSION     "1.03"
+#define DRV_RELDATE     "30-Apr-2008"
 #define PFX		DRV_NAME ": "
 
 /* Includes */
@@ -104,6 +105,7 @@ enum iTCO_chipsets {
 	TCO_ICH9,	/* ICH9 */
 	TCO_ICH9R,	/* ICH9R */
 	TCO_ICH9DH,	/* ICH9DH */
+	TCO_ICH9DO,     /* ICH9DO */
 	TCO_631XESB,	/* 631xESB/632xESB */
 };
 
@@ -136,6 +138,7 @@ static struct {
 	{"ICH9", 2},
 	{"ICH9R", 2},
 	{"ICH9DH", 2},
+	{"ICH9DO", 2},
 	{"631xESB/632xESB", 2},
 	{NULL,0}
 };
@@ -181,6 +184,7 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
 	{ ITCO_PCI_DEVICE(0x2918,				TCO_ICH9   )},
 	{ ITCO_PCI_DEVICE(0x2916,				TCO_ICH9R  )},
 	{ ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2,		TCO_ICH9DH )},
+	{ ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4,           TCO_ICH9DO )},
 	{ ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0,		TCO_631XESB)},
 	{ ITCO_PCI_DEVICE(0x2671,				TCO_631XESB)},
 	{ ITCO_PCI_DEVICE(0x2672,				TCO_631XESB)},
drivers/watchdog/w83697hf_wdt.c +30 -8
index c622a0e..528b882 100644
@@ -44,6 +44,7 @@
 #define WATCHDOG_NAME "w83697hf/hg WDT"
 #define PFX WATCHDOG_NAME ": "
 #define WATCHDOG_TIMEOUT 60		/* 60 sec default timeout */
+#define WATCHDOG_EARLY_DISABLE 1	/* Disable until userland kicks in */
 
 static unsigned long wdt_is_open;
 static char expect_close;
@@ -56,12 +57,16 @@ MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect)
 
 static int timeout = WATCHDOG_TIMEOUT;	/* in seconds */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
+static int early_disable = WATCHDOG_EARLY_DISABLE;
+module_param(early_disable, int, 0);
+MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")");
+
 /*
  *	Kernel methods.
  */
@@ -140,7 +145,7 @@ w83697hf_init(void)
 	w83697hf_deselect_wdt();
 }
 
-static int
+static void
 wdt_ping(void)
 {
 	spin_lock(&io_lock);
@@ -150,10 +155,9 @@ wdt_ping(void)
 
 	w83697hf_deselect_wdt();
 	spin_unlock(&io_lock);
-	return 0;
 }
 
-static int
+static void
 wdt_enable(void)
 {
 	spin_lock(&io_lock);
@@ -164,10 +168,9 @@ wdt_enable(void)
 
 	w83697hf_deselect_wdt();
 	spin_unlock(&io_lock);
-	return 0;
 }
 
-static int
+static void
 wdt_disable(void)
 {
 	spin_lock(&io_lock);
@@ -178,7 +181,22 @@ wdt_disable(void)
 
 	w83697hf_deselect_wdt();
 	spin_unlock(&io_lock);
-	return 0;
+}
+
+static unsigned char
+wdt_running(void)
+{
+	unsigned char t;
+
+	spin_lock(&io_lock);
+	w83697hf_select_wdt();
+
+	t = w83697hf_get_reg(0xF4);	/* Read timer */
+
+	w83697hf_deselect_wdt();
+	spin_unlock(&io_lock);
+
+	return t;
 }
 
 static int
@@ -397,7 +415,11 @@ wdt_init(void)
 	}
 
 	w83697hf_init();
-	wdt_disable();	/* Disable watchdog until first use */
+	if (early_disable) {
+		if (wdt_running())
+			printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n");
+		wdt_disable();
+	}
 
 	if (wdt_set_heartbeat(timeout)) {
 		wdt_set_heartbeat(WATCHDOG_TIMEOUT);
#1 lore raw
Quoted 23 lines
drivers/watchdog/geodewdt.c new file +23 -0
+
+static void geodewdt_ping(void)
+{
+	/* Stop the counter */
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
+
+	/* Reset the counter */
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
+
+	/* Enable the counter */
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
+}
+
+static void geodewdt_disable(void)
+{
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
+}
+
+static int geodewdt_set_heartbeat(int val)
+{
+	if (val < 1 || val > GEODEWDT_MAX_SECONDS)
+		return -EINVAL;

drivers/watchdog/geodewdt.c line 79

Quoted 10 lines
drivers/watchdog/geodewdt.c new file +10 -0
+
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ);
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
+	geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
+
+	timeout = val;
+	return 0;
+}
+

There is no locking in geodewdt - so all those routines can end up being run together. Not sure it is a problem just noting it while reviewing.

#2 lore raw

Hi Alan,

Quoted 2 lines

There is no locking in geodewdt - so all those routines can end up being run together. Not sure it is a problem just noting it while reviewing.

Yep, we need to fix that together with the unlocked_iotcl change also.

Greetings,
Wim.

#3 lore raw

PATCH 1/1 drivers/watchdog/geodewdt.c: build fix

In reply to Wim Van Sebroeck
Quoted 4 lines · Wim Van Sebroeck
Author: Jordan Crouse <[email protected]>
Date:   Mon Jan 21 10:07:00 2008 -0700

[WATCHDOG] Add a watchdog driver based on the CS5535/CS5536 MFGPT timers

-tip testing found the following build failure on latest -git:

drivers/watchdog/geodewdt.c: In function 'geodewdt_probe':
drivers/watchdog/geodewdt.c:225: error: too many arguments to function 'geode_mfgpt_alloc_timer' make[1]: *** [drivers/watchdog/geodewdt.o] Error 1
make: *** [drivers/watchdog/geodewdt.o] Error 2

with this config:

http://redhat.com/~mingo/misc/config-Fri_May_30_15_19_52_CEST_2008.bad

find the fix below.

---
 drivers/watchdog/geodewdt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/watchdog/geodewdt.c +1 -2
Index: tip/drivers/watchdog/geodewdt.c
===================================================================
@@ -221,8 +221,7 @@ geodewdt_probe(struct platform_device *d
 {
 	int ret, timer;
 
-	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY,
-					MFGPT_DOMAIN_WORKING, THIS_MODULE);
+	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
 
 	if (timer == -1) {
 		printk(KERN_ERR "geodewdt:  No timers were available\n");
Acked-by on v1 1/1
#4 lore raw

Re: drivers/watchdog/geodewdt.c: build fix

Quoted 15 lines · Ingo Molnar
Quoted 4 lines · Wim Van Sebroeck
Author: Jordan Crouse <[email protected]>
Date:   Mon Jan 21 10:07:00 2008 -0700

[WATCHDOG] Add a watchdog driver based on the CS5535/CS5536 MFGPT timers

-tip testing found the following build failure on latest -git:

drivers/watchdog/geodewdt.c: In function 'geodewdt_probe':
drivers/watchdog/geodewdt.c:225: error: too many arguments to function 'geode_mfgpt_alloc_timer' make[1]: *** [drivers/watchdog/geodewdt.o] Error 1
make: *** [drivers/watchdog/geodewdt.o] Error 2

Quoted 7 lines

with this config:

http://redhat.com/~mingo/misc/config-Fri_May_30_15_19_52_CEST_2008.bad

find the fix below.

Quoted 19 lines
---
 drivers/watchdog/geodewdt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: tip/drivers/watchdog/geodewdt.c
===================================================================

drivers/watchdog/geodewdt.c +1 -2
@@ -221,8 +221,7 @@ geodewdt_probe(struct platform_device *d
 {
 	int ret, timer;
 
-	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY,
-					MFGPT_DOMAIN_WORKING, THIS_MODULE);
+	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
 
 	if (timer == -1) {
 		printk(KERN_ERR "geodewdt:  No timers were available\n");
Signature · 3 lines
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.
#5 lore raw

Re: drivers/watchdog/geodewdt.c: build fix

I was trying to compile a kernel with this support, and noticed this bug, too. The interface was changed in commit fa28e067c3b8af96c79c060e163b1387c172ae75, with the message:

Quoted 5 lines

We had planned to use the 'owner' field for allowing re-allocation of MFGPTs; however, doing it by module owner name isn't flexible enough. So, drop this for now. If it turns out that we need timers in modules, we'll need to come up with a scheme that matches the write-once fields of the MFGPTx_SETUP register, and drops ponies from > the sky.

I may be reading this incorrectly, but it seems that to do this correctly, we would either need to drop module support for this driver or rework the MFGPT code. I'm not sure there's a kernel hook for dropping ponies from the sky quite yet.

Thanks,
David Brigada

Quoted 43 lines · Jordan Crouse
Quoted 13 lines · Ingo Molnar
Quoted 4 lines · Wim Van Sebroeck
Author: Jordan Crouse <[email protected]>
Date:   Mon Jan 21 10:07:00 2008 -0700

[WATCHDOG] Add a watchdog driver based on the CS5535/CS5536 MFGPT timers

-tip testing found the following build failure on latest -git:

drivers/watchdog/geodewdt.c: In function 'geodewdt_probe':
drivers/watchdog/geodewdt.c:225: error: too many arguments to function 'geode_mfgpt_alloc_timer' make[1]: *** [drivers/watchdog/geodewdt.o] Error 1
make: *** [drivers/watchdog/geodewdt.o] Error 2

Quoted 7 lines

with this config:

http://redhat.com/~mingo/misc/config-Fri_May_30_15_19_52_CEST_2008.bad

find the fix below.

Quoted 19 lines
---
 drivers/watchdog/geodewdt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: tip/drivers/watchdog/geodewdt.c
===================================================================

drivers/watchdog/geodewdt.c +1 -2
@@ -221,8 +221,7 @@ geodewdt_probe(struct platform_device *d
 {
 	int ret, timer;
 
-	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY,
-					MFGPT_DOMAIN_WORKING, THIS_MODULE);
+	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
 
 	if (timer == -1) {
 		printk(KERN_ERR "geodewdt:  No timers were available\n");
#6 lore raw

Re: drivers/watchdog/geodewdt.c: build fix

Quoted 7 lines · David Brigada

I was trying to compile a kernel with this support, and noticed this bug, too. The interface was changed in commit fa28e067c3b8af96c79c060e163b1387c172ae75, with the message:

Quoted 2 lines

We had planned to use the 'owner' field for allowing re-allocation of MFGPTs; however, doing it by module owner name isn't flexible enough. >

So, drop this for now. If it turns out that we need timers in

Quoted 8 lines
Quoted 2 lines

modules, we'll need to come up with a scheme that matches the write-once fields of the MFGPTx_SETUP register, and drops ponies from >

the sky.

I may be reading this incorrectly, but it seems that to do this correctly, we would either need to drop module support for this driver or rework the MFGPT code. I'm not sure there's a kernel hook for dropping ponies from the sky quite yet.

I think the hamster dropping code is queued for 2.6.27, so at least we're up to mammals.

The story here is that in an unfortunate instance of bad planning the MFGPT timers can only be configured once, so a module can't allocate a timer at init and release it when it is done. The original object of this code was to try give the timer back to a module if it happened to go away and come back, but that is clearly a more complex process then just simply storing the module name, and this code fell into bitrot.

So its not so much that we need to drop module support, rather it needs to be understood that if you remove and insert your module on a regular basis you will run out of timers, and deprive others of the timers too. I think that is a reasonable restriction to impose, given the limited usefulness of these timers for general purpose use.

Jordan

Quoted 44 lines
Quoted 41 lines · Jordan Crouse
Quoted 15 lines · Ingo Molnar
Quoted 5 lines · Wim Van Sebroeck
Author: Jordan Crouse <[email protected]>
Date:   Mon Jan 21 10:07:00 2008 -0700

[WATCHDOG] Add a watchdog driver based on the CS5535/CS5536 MFGPT
timers

-tip testing found the following build failure on latest -git:

drivers/watchdog/geodewdt.c: In function 'geodewdt_probe':
drivers/watchdog/geodewdt.c:225: error: too many arguments to function
'geode_mfgpt_alloc_timer'
make[1]: *** [drivers/watchdog/geodewdt.o] Error 1
make: *** [drivers/watchdog/geodewdt.o] Error 2

Quoted 7 lines

with this config:

http://redhat.com/~mingo/misc/config-Fri_May_30_15_19_52_CEST_2008.bad

find the fix below.

Quoted 17 lines
---
 drivers/watchdog/geodewdt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: tip/drivers/watchdog/geodewdt.c
===================================================================

drivers/watchdog/geodewdt.c +1 -1
@@ -221,8 +221,7 @@ geodewdt_probe(struct platform_device *d
 {
 	int ret, timer;
 -	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY,
-					MFGPT_DOMAIN_WORKING, THIS_MODULE);
+	timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
  	if (timer == -1) {
 		printk(KERN_ERR "geodewdt:  No timers were available\n");
 
Signature · 3 lines
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.
#7 lore raw

Re: drivers/watchdog/geodewdt.c: build fix

Quoted 9 lines · Jordan Crouse

I think the hamster dropping code is queued for 2.6.27, so at least we're up to mammals.

The story here is that in an unfortunate instance of bad planning the MFGPT timers can only be configured once, so a module can't allocate a timer at init and release it when it is done. The original object of this code was to try give the timer back to a module if it happened to go away and come back, but that is clearly a more complex process then just simply storing the module name, and this code fell into bitrot.

It is a bit unfortunate that someone decided to design 'configure once' hardware. What were they thinking?

I run a watchdog using the mfgpt, and I simply tore out the code that prevents reuse of the timers, and I decided which timers I am going to use for which purpose and never reuse them for anything else, so the parts of the configuration in the hardware that is fixed isn't an issue then. I start the watchdog from grub, so I had to override the check when the kernel takes over the timer watchdog management after all.

Quoted 5 lines

So its not so much that we need to drop module support, rather it needs to be understood that if you remove and insert your module on a regular basis you will run out of timers, and deprive others of the timers too. I think that is a reasonable restriction to impose, given the limited usefulness of these timers for general purpose use.

They are useful timers, but yes perhaps not for general purpose. As a source of interrupts at certain intervals or as a watchdog they are not too bad.

Signature · 1 line
Len Sorensen
#8 lore raw

Re: drivers/watchdog/geodewdt.c: build fix

Quoted 11 lines · Lennart Sorensen
Quoted 9 lines · Jordan Crouse

I think the hamster dropping code is queued for 2.6.27, so at least we're up to mammals.

The story here is that in an unfortunate instance of bad planning the MFGPT timers can only be configured once, so a module can't allocate a timer at init and release it when it is done. The original object of this code was to try give the timer back to a module if it happened to go away and come back, but that is clearly a more complex process then just simply storing the module name, and this code fell into bitrot.

Quoted 2 lines

It is a bit unfortunate that someone decided to design 'configure once' hardware. What were they thinking?

Agreed, very sub-optimal. For all those prospective silicon vendors out
there, this is a good lesson. Always let your software people review the specification before you freeze the RTL - it will save you grief in the long run. </sermon>

Quoted 6 lines

I run a watchdog using the mfgpt, and I simply tore out the code that prevents reuse of the timers, and I decided which timers I am going to use for which purpose and never reuse them for anything else, so the parts of the configuration in the hardware that is fixed isn't an issue then. I start the watchdog from grub, so I had to override the check when the kernel takes over the timer watchdog management after all.

I expect that this will be the primary usage model - every platform needs to have a gentleman's agreement for how the timers are allocated and used.

Quoted 9 lines
Quoted 5 lines

So its not so much that we need to drop module support, rather it needs to be understood that if you remove and insert your module on a regular basis you will run out of timers, and deprive others of the timers too. I think that is a reasonable restriction to impose, given the limited usefulness of these timers for general purpose use.

They are useful timers, but yes perhaps not for general purpose. As a source of interrupts at certain intervals or as a watchdog they are not too bad.

For the longest time, I thought they were only good as a watchdog or driving an external output. I had to eat some crow when we figured out that we could use them as the tick source for tickless, so I no longer say that they won't be good for anything else, but their usefulness is certainly limited.

Signature · 3 lines
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.