* [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog
@ 2006-01-19 6:58 Kumar Gala
2006-01-19 9:49 ` Alan Cox
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2006-01-19 6:58 UTC (permalink / raw)
To: Andrew Morton, wim; +Cc: linux-kernel, linuxppc-embedded
Since we can only open the watchdog once having a spinlock to protect
multiple access is pointless.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
commit 8852c088c0624f5534b08a769b5887c42a211694
tree 04ad05af51efb90604ff86af48197b6b7b45f77a
parent 1161d00ace361999d5b98bbe3082da4c8d457ba3
author Kumar Gala <galak@kernel.crashing.org> Thu, 19 Jan 2006 01:03:09 -0600
committer Kumar Gala <galak@kernel.crashing.org> Thu, 19 Jan 2006 01:03:09 -0600
drivers/char/watchdog/mpc83xx_wdt.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c
index 5d6f506..b310144 100644
--- a/drivers/char/watchdog/mpc83xx_wdt.c
+++ b/drivers/char/watchdog/mpc83xx_wdt.c
@@ -57,15 +57,12 @@ static int prescale = 1;
static unsigned int timeout_sec;
static unsigned long wdt_is_open;
-static spinlock_t wdt_spinlock;
static void mpc83xx_wdt_keepalive(void)
{
/* Ping the WDT */
- spin_lock(&wdt_spinlock);
out_be16(&wd_base->swsrr, 0x556c);
out_be16(&wd_base->swsrr, 0xaa39);
- spin_unlock(&wdt_spinlock);
}
static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
@@ -184,8 +181,6 @@ static int __devinit mpc83xx_wdt_probe(s
"mode:%s timeout=%d (%d seconds)\n",
reset ? "reset":"interrupt", timeout, timeout_sec);
- spin_lock_init(&wdt_spinlock);
-
return 0;
err_unmap:
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog
2006-01-19 6:58 [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog Kumar Gala
@ 2006-01-19 9:49 ` Alan Cox
2006-01-19 14:21 ` Kumar Gala
2006-01-19 16:48 ` Marcelo Tosatti
0 siblings, 2 replies; 6+ messages in thread
From: Alan Cox @ 2006-01-19 9:49 UTC (permalink / raw)
To: Kumar Gala; +Cc: Andrew Morton, wim, linux-kernel, linuxppc-embedded
On Iau, 2006-01-19 at 00:58 -0600, Kumar Gala wrote:
> Since we can only open the watchdog once having a spinlock to protect
> multiple access is pointless.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
NAK
This is a common mistake.
open is called on the open() call and is indeed in this case 'single
open', but file handles can be inherited and many users may have access
to a single file handle.
eg
f = open("/dev/watchdog", O_RDWR);
fork();
while(1) {
write(f, "Boing", 5);
}
Alan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog
2006-01-19 9:49 ` Alan Cox
@ 2006-01-19 14:21 ` Kumar Gala
2006-01-19 16:48 ` Marcelo Tosatti
1 sibling, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2006-01-19 14:21 UTC (permalink / raw)
To: Alan Cox
Cc: Andrew Morton, wim, LKML List, Linuxppc-Embedded ((E-Mail)),
Marcelo Tosatti
On Jan 19, 2006, at 3:49 AM, Alan Cox wrote:
> On Iau, 2006-01-19 at 00:58 -0600, Kumar Gala wrote:
>> Since we can only open the watchdog once having a spinlock to protect
>> multiple access is pointless.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>
> NAK
>
> This is a common mistake.
>
> open is called on the open() call and is indeed in this case 'single
> open', but file handles can be inherited and many users may have
> access
> to a single file handle.
>
> eg
>
> f = open("/dev/watchdog", O_RDWR);
> fork();
> while(1) {
> write(f, "Boing", 5);
> }
>
> Alan
Thanks, you learn something new every day.
- kumar
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog
2006-01-19 9:49 ` Alan Cox
2006-01-19 14:21 ` Kumar Gala
@ 2006-01-19 16:48 ` Marcelo Tosatti
2006-01-19 22:12 ` Alan Cox
1 sibling, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2006-01-19 16:48 UTC (permalink / raw)
To: Alan Cox; +Cc: Kumar Gala, Andrew Morton, wim, linux-kernel, linuxppc-embedded
On Thu, Jan 19, 2006 at 09:49:16AM +0000, Alan Cox wrote:
> On Iau, 2006-01-19 at 00:58 -0600, Kumar Gala wrote:
> > Since we can only open the watchdog once having a spinlock to protect
> > multiple access is pointless.
> >
> > Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>
> NAK
>
> This is a common mistake.
>
> open is called on the open() call and is indeed in this case 'single
> open', but file handles can be inherited and many users may have access
> to a single file handle.
>
> eg
>
> f = open("/dev/watchdog", O_RDWR);
> fork();
> while(1) {
> write(f, "Boing", 5);
> }
Oops.
At least 50% of the watchdog drivers rely solely on the "wdt_is_open"
atomic variable and are broken with respect to synchronization.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog
2006-01-19 16:48 ` Marcelo Tosatti
@ 2006-01-19 22:12 ` Alan Cox
2006-01-20 11:55 ` Wim Van Sebroeck
0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2006-01-19 22:12 UTC (permalink / raw)
To: Marcelo Tosatti
Cc: Kumar Gala, Andrew Morton, wim, linux-kernel, linuxppc-embedded
On Iau, 2006-01-19 at 14:48 -0200, Marcelo Tosatti wrote:
> On Thu, Jan 19, 2006 at 09:49:16AM +0000, Alan Cox wrote:
> >
> > f = open("/dev/watchdog", O_RDWR);
> > fork();
> > while(1) {
> > write(f, "Boing", 5);
> > }
>
> Oops.
>
> At least 50% of the watchdog drivers rely solely on the "wdt_is_open"
> atomic variable and are broken with respect to synchronization.
What an excellent janitors project
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog
2006-01-19 22:12 ` Alan Cox
@ 2006-01-20 11:55 ` Wim Van Sebroeck
0 siblings, 0 replies; 6+ messages in thread
From: Wim Van Sebroeck @ 2006-01-20 11:55 UTC (permalink / raw)
To: Alan Cox
Cc: Marcelo Tosatti, Kumar Gala, Andrew Morton, linux-kernel,
linuxppc-embedded
All,
> On Iau, 2006-01-19 at 14:48 -0200, Marcelo Tosatti wrote:
> > On Thu, Jan 19, 2006 at 09:49:16AM +0000, Alan Cox wrote:
> > >
> > > f = open("/dev/watchdog", O_RDWR);
> > > fork();
> > > while(1) {
> > > write(f, "Boing", 5);
> > > }
> >
> > Oops.
> >
> > At least 50% of the watchdog drivers rely solely on the "wdt_is_open"
> > atomic variable and are broken with respect to synchronization.
>
> What an excellent janitors project
I'll have a look at it from a global point of view.
Greetings,
Wim.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-01-20 11:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 6:58 [PATCH] powerpc: remove useless spinlock from mpc83xx watchdog Kumar Gala
2006-01-19 9:49 ` Alan Cox
2006-01-19 14:21 ` Kumar Gala
2006-01-19 16:48 ` Marcelo Tosatti
2006-01-19 22:12 ` Alan Cox
2006-01-20 11:55 ` Wim Van Sebroeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).