linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/15] ali14xx: fix deadlock on error handling
@ 2007-10-01 21:31 Bartlomiej Zolnierkiewicz
  2007-10-02 12:46 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-10-01 21:31 UTC (permalink / raw)
  To: linux-ide


Stop abusing ide_lock lock by switching to a private locking.

Fixes same issue as fixed by Alan Cox in atiixp host driver with
commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/legacy/ali14xx.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/drivers/ide/legacy/ali14xx.c
===================================================================
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -102,6 +102,8 @@ static void outReg (u8 data, u8 reg)
 	outb_p(data, dataPort);
 }
 
+static DEFINE_SPINLOCK(ali14xx_lock);
+
 /*
  * Set PIO mode for the specified drive.
  * This function computes timing parameters
@@ -129,14 +131,14 @@ static void ali14xx_set_pio_mode(ide_dri
 
 	/* stuff timing parameters into controller registers */
 	driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit;
-	spin_lock_irqsave(&ide_lock, flags);
+	spin_lock_irqsave(&ali14xx_lock, flags);
 	outb_p(regOn, basePort);
 	outReg(param1, regTab[driveNum].reg1);
 	outReg(param2, regTab[driveNum].reg2);
 	outReg(param3, regTab[driveNum].reg3);
 	outReg(param4, regTab[driveNum].reg4);
 	outb_p(regOff, basePort);
-	spin_unlock_irqrestore(&ide_lock, flags);
+	spin_unlock_irqrestore(&ali14xx_lock, flags);
 }
 
 /*

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

* Re: [PATCH 1/15] ali14xx: fix deadlock on error handling
  2007-10-01 21:31 [PATCH 1/15] ali14xx: fix deadlock on error handling Bartlomiej Zolnierkiewicz
@ 2007-10-02 12:46 ` Sergei Shtylyov
  2007-10-02 13:47   ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2007-10-02 12:46 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide

Bartlomiej Zolnierkiewicz wrote:

> Stop abusing ide_lock lock by switching to a private locking.

> Fixes same issue as fixed by Alan Cox in atiixp host driver with

    Has been also fixed in the piix driver.

> commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627.

    Heh, I've looked hard at the code trying to understand how this can 
happen, and was unable to figure out. Probably was not hard enough...

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

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

* Re: [PATCH 1/15] ali14xx: fix deadlock on error handling
  2007-10-02 12:46 ` Sergei Shtylyov
@ 2007-10-02 13:47   ` Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2007-10-02 13:47 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Bartlomiej Zolnierkiewicz, linux-ide

On Tue, 02 Oct 2007 16:46:28 +0400
Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:

> Bartlomiej Zolnierkiewicz wrote:
> 
> > Stop abusing ide_lock lock by switching to a private locking.
> 
> > Fixes same issue as fixed by Alan Cox in atiixp host driver with
> 
>     Has been also fixed in the piix driver.
> 
> > commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627.
> 
>     Heh, I've looked hard at the code trying to understand how this can 
> happen, and was unable to figure out. Probably was not hard enough...

The old IDE code timer, error handling and interrupt paths all race each
other. Anything can happen including this.

The proper fix is to rewrite the error handling but it was easier to port
the drivers to working error handling instead - hence libata PATA

Alan

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

end of thread, other threads:[~2007-10-02 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-01 21:31 [PATCH 1/15] ali14xx: fix deadlock on error handling Bartlomiej Zolnierkiewicz
2007-10-02 12:46 ` Sergei Shtylyov
2007-10-02 13:47   ` Alan Cox

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).