* [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
@ 2006-11-06 12:42 Amol Lad
2006-11-07 20:53 ` Andrew Morton
2006-11-07 22:29 ` Christoph Hellwig
0 siblings, 2 replies; 9+ messages in thread
From: Amol Lad @ 2006-11-06 12:42 UTC (permalink / raw)
To: Andrew Morton, James.Bottomley; +Cc: linux kernel
Replaced save_flags()/cli() with spin_lock alternatives
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
Andrew,
Please add this to -mm
---
--- linux-2.6.19-rc4-orig/drivers/scsi/mca_53c9x.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.19-rc4/drivers/scsi/mca_53c9x.c 2006-11-06 18:03:22.000000000 +0530
@@ -341,9 +341,7 @@ static void dma_init_read(struct NCR_ESP
{
unsigned long flags;
-
- save_flags(flags);
- cli();
+ spin_lock_irqsave(esp->ehost->host_lock, flags);
mca_disable_dma(esp->dma);
mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_16 |
@@ -352,16 +350,14 @@ static void dma_init_read(struct NCR_ESP
mca_set_dma_count(esp->dma, length / 2); /* !!! */
mca_enable_dma(esp->dma);
- restore_flags(flags);
+ spin_unlock_irqrestore(esp->ehost->host_lock, flags);
}
static void dma_init_write(struct NCR_ESP *esp, __u32 addr, int length)
{
unsigned long flags;
-
- save_flags(flags);
- cli();
+ spin_lock_irqsave(esp->ehost->host_lock, flags);
mca_disable_dma(esp->dma);
mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_WRITE |
@@ -370,7 +366,7 @@ static void dma_init_write(struct NCR_ES
mca_set_dma_count(esp->dma, length / 2); /* !!! */
mca_enable_dma(esp->dma);
- restore_flags(flags);
+ spin_unlock_irqrestore(esp->ehost->host_lock, flags);
}
static void dma_ints_off(struct NCR_ESP *esp)
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
2006-11-06 12:42 [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal Amol Lad
@ 2006-11-07 20:53 ` Andrew Morton
2006-11-08 0:19 ` James Bottomley
2006-11-07 22:29 ` Christoph Hellwig
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2006-11-07 20:53 UTC (permalink / raw)
To: Amol Lad; +Cc: James.Bottomley, linux kernel
On Mon, 06 Nov 2006 18:12:11 +0530
Amol Lad <amol@verismonetworks.com> wrote:
> Replaced save_flags()/cli() with spin_lock alternatives
>
> Signed-off-by: Amol Lad <amol@verismonetworks.com>
> ---
> Andrew,
> Please add this to -mm
> ---
> --- linux-2.6.19-rc4-orig/drivers/scsi/mca_53c9x.c 2006-08-24 02:46:33.000000000 +0530
> +++ linux-2.6.19-rc4/drivers/scsi/mca_53c9x.c 2006-11-06 18:03:22.000000000 +0530
> @@ -341,9 +341,7 @@ static void dma_init_read(struct NCR_ESP
> {
> unsigned long flags;
>
> -
> - save_flags(flags);
> - cli();
> + spin_lock_irqsave(esp->ehost->host_lock, flags);
>
> mca_disable_dma(esp->dma);
> mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_16 |
> @@ -352,16 +350,14 @@ static void dma_init_read(struct NCR_ESP
> mca_set_dma_count(esp->dma, length / 2); /* !!! */
> mca_enable_dma(esp->dma);
>
> - restore_flags(flags);
> + spin_unlock_irqrestore(esp->ehost->host_lock, flags);
> }
>
> static void dma_init_write(struct NCR_ESP *esp, __u32 addr, int length)
> {
> unsigned long flags;
>
> -
> - save_flags(flags);
> - cli();
> + spin_lock_irqsave(esp->ehost->host_lock, flags);
>
> mca_disable_dma(esp->dma);
> mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_WRITE |
> @@ -370,7 +366,7 @@ static void dma_init_write(struct NCR_ES
> mca_set_dma_count(esp->dma, length / 2); /* !!! */
> mca_enable_dma(esp->dma);
>
> - restore_flags(flags);
> + spin_unlock_irqrestore(esp->ehost->host_lock, flags);
> }
>
> static void dma_ints_off(struct NCR_ESP *esp)
hm. How do we find out if this works?
If it _does_ work then we can now remove the Kconfig BROKEN_ON_SMP dependency
for this driver.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
2006-11-07 20:53 ` Andrew Morton
@ 2006-11-08 0:19 ` James Bottomley
2006-11-08 5:36 ` Amol Lad
2006-11-08 15:36 ` Alan Cox
0 siblings, 2 replies; 9+ messages in thread
From: James Bottomley @ 2006-11-08 0:19 UTC (permalink / raw)
To: Andrew Morton; +Cc: Amol Lad, linux kernel
On Tue, 2006-11-07 at 12:53 -0800, Andrew Morton wrote:
> hm. How do we find out if this works?
I'm not sure anyone has this type of HW anymore. It was the original
SCSI chip for the old MCA based IBM PC. I can dig through my hardware
bins to see if I have a card, but I don't think so.
> If it _does_ work then we can now remove the Kconfig BROKEN_ON_SMP dependency
> for this driver.
Theoretically, yes ... practically I don't think there was an SMP box
produced with this chip.
James
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
2006-11-08 0:19 ` James Bottomley
@ 2006-11-08 5:36 ` Amol Lad
2006-11-08 15:36 ` Alan Cox
1 sibling, 0 replies; 9+ messages in thread
From: Amol Lad @ 2006-11-08 5:36 UTC (permalink / raw)
To: James Bottomley; +Cc: Andrew Morton, linux kernel
On Wed, 2006-11-08 at 09:19 +0900, James Bottomley wrote:
> On Tue, 2006-11-07 at 12:53 -0800, Andrew Morton wrote:
>
> > hm. How do we find out if this works?
>
> I'm not sure anyone has this type of HW anymore. It was the original
> SCSI chip for the old MCA based IBM PC. I can dig through my hardware
> bins to see if I have a card, but I don't think so.
The only way I see is the code review.
Most of the drivers using save_flags()/cli() interfaces are not in use
anymore (such as drivers/char/riscom8.c). There are two possibilities:
1. Remove such drivers from kernel
2. Fix them
This would mean we can remove cli()/sti()/save_flags() interfaces from
the kernel so that any new development does not uses them accidently
>
> > If it _does_ work then we can now remove the Kconfig BROKEN_ON_SMP dependency
> > for this driver.
>
> Theoretically, yes ... practically I don't think there was an SMP box
> produced with this chip.
>
> James
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
2006-11-08 0:19 ` James Bottomley
2006-11-08 5:36 ` Amol Lad
@ 2006-11-08 15:36 ` Alan Cox
1 sibling, 0 replies; 9+ messages in thread
From: Alan Cox @ 2006-11-08 15:36 UTC (permalink / raw)
To: James Bottomley; +Cc: Andrew Morton, Amol Lad, linux kernel
Ar Mer, 2006-11-08 am 09:19 +0900, ysgrifennodd James Bottomley:
> On Tue, 2006-11-07 at 12:53 -0800, Andrew Morton wrote:
>
> > hm. How do we find out if this works?
>
> I'm not sure anyone has this type of HW anymore. It was the original
> SCSI chip for the old MCA based IBM PC. I can dig through my hardware
> bins to see if I have a card, but I don't think so.
There was one in the pile of MCA cards I posted you I think.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
2006-11-06 12:42 [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal Amol Lad
2006-11-07 20:53 ` Andrew Morton
@ 2006-11-07 22:29 ` Christoph Hellwig
2006-11-08 5:26 ` Amol Lad
1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2006-11-07 22:29 UTC (permalink / raw)
To: Amol Lad; +Cc: Andrew Morton, James.Bottomley, linux kernel
On Mon, Nov 06, 2006 at 06:12:11PM +0530, Amol Lad wrote:
> Replaced save_flags()/cli() with spin_lock alternatives
This patch has very little chance to work as-is because it only replaces
cli with spinlocks, but not the irq handler it's locking against.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
2006-11-07 22:29 ` Christoph Hellwig
@ 2006-11-08 5:26 ` Amol Lad
0 siblings, 0 replies; 9+ messages in thread
From: Amol Lad @ 2006-11-08 5:26 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Andrew Morton, James.Bottomley, linux kernel
On Tue, 2006-11-07 at 22:29 +0000, Christoph Hellwig wrote:
> On Mon, Nov 06, 2006 at 06:12:11PM +0530, Amol Lad wrote:
> > Replaced save_flags()/cli() with spin_lock alternatives
>
> This patch has very little chance to work as-is because it only replaces
> cli with spinlocks, but not the irq handler it's locking against.
>
It protects against irq handler also.
drivers/scsi/NCR53C9x.c:
irqreturn_t esp_intr(int irq, void *dev_id)
{
struct NCR_ESP *esp;
unsigned long flags;
int again;
struct Scsi_Host *dev = dev_id;
/* Handle all ESP interrupts showing at this IRQ level. */
spin_lock_irqsave(dev->host_lock, flags);
...
...
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal
@ 2006-11-07 6:51 Amol Lad
0 siblings, 0 replies; 9+ messages in thread
From: Amol Lad @ 2006-11-07 6:51 UTC (permalink / raw)
To: James.Bottomley, akpm; +Cc: linux kernel
Replaced calls with save_flags()/cli() pair with
spi_lock_irqsave()/spin_unlock_irqrestore()
Tested:
1. compilation only
2. Code review to verify that the change does not result in a recursive
locking
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
Andrew,
Please add this to -mm
---
--- linux-2.6.19-rc4-orig/drivers/scsi/mca_53c9x.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.19-rc4/drivers/scsi/mca_53c9x.c 2006-11-06 18:03:22.000000000 +0530
@@ -341,9 +341,7 @@ static void dma_init_read(struct NCR_ESP
{
unsigned long flags;
-
- save_flags(flags);
- cli();
+ spin_lock_irqsave(esp->ehost->host_lock, flags);
mca_disable_dma(esp->dma);
mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_16 |
@@ -352,16 +350,14 @@ static void dma_init_read(struct NCR_ESP
mca_set_dma_count(esp->dma, length / 2); /* !!! */
mca_enable_dma(esp->dma);
- restore_flags(flags);
+ spin_unlock_irqrestore(esp->ehost->host_lock, flags);
}
static void dma_init_write(struct NCR_ESP *esp, __u32 addr, int length)
{
unsigned long flags;
-
- save_flags(flags);
- cli();
+ spin_lock_irqsave(esp->ehost->host_lock, flags);
mca_disable_dma(esp->dma);
mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_WRITE |
@@ -370,7 +366,7 @@ static void dma_init_write(struct NCR_ES
mca_set_dma_count(esp->dma, length / 2); /* !!! */
mca_enable_dma(esp->dma);
- restore_flags(flags);
+ spin_unlock_irqrestore(esp->ehost->host_lock, flags);
}
static void dma_ints_off(struct NCR_ESP *esp)
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH] drivers/scsi/mca_53c9x.c: save_flags()/cli() removal
@ 2006-10-16 6:49 Amol Lad
0 siblings, 0 replies; 9+ messages in thread
From: Amol Lad @ 2006-10-16 6:49 UTC (permalink / raw)
To: linux kernel, James.Bottomley; +Cc: kernel Janitors
Replaced calls with save_flags()/cli() pair with
spi_lock_irqsave()/spin_unlock_irqrestore()
Tested:
1. compilation only
2. Code review to verify that the change does not result in a recursive
locking
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
James,
Though I have done the review to check for recursive locking, can you
also have a look ?
---
--- linux-2.6.19-rc1-orig/drivers/scsi/mca_53c9x.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.19-rc1/drivers/scsi/mca_53c9x.c 2006-10-16 11:47:45.000000000 +0530
@@ -342,9 +342,8 @@ static void dma_init_read(struct NCR_ESP
unsigned long flags;
- save_flags(flags);
- cli();
-
+ spin_lock_irqsave(esp->ehost->host_lock, flags);
+
mca_disable_dma(esp->dma);
mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_16 |
MCA_DMA_MODE_IO);
@@ -352,7 +351,7 @@ static void dma_init_read(struct NCR_ESP
mca_set_dma_count(esp->dma, length / 2); /* !!! */
mca_enable_dma(esp->dma);
- restore_flags(flags);
+ spin_unlock_irqrestore(esp->ehost->host_lock, flags);
}
static void dma_init_write(struct NCR_ESP *esp, __u32 addr, int length)
@@ -360,8 +359,7 @@ static void dma_init_write(struct NCR_ES
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(esp->ehost->host_lock, flags);
mca_disable_dma(esp->dma);
mca_set_dma_mode(esp->dma, MCA_DMA_MODE_XFER | MCA_DMA_MODE_WRITE |
@@ -370,7 +368,7 @@ static void dma_init_write(struct NCR_ES
mca_set_dma_count(esp->dma, length / 2); /* !!! */
mca_enable_dma(esp->dma);
- restore_flags(flags);
+ spin_unlock_irqrestore(esp->ehost->host_lock, flags);
}
static void dma_ints_off(struct NCR_ESP *esp)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-11-08 15:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 12:42 [PATCH] drivers/scsi/mca_53c9x.c : save_flags()/cli() removal Amol Lad
2006-11-07 20:53 ` Andrew Morton
2006-11-08 0:19 ` James Bottomley
2006-11-08 5:36 ` Amol Lad
2006-11-08 15:36 ` Alan Cox
2006-11-07 22:29 ` Christoph Hellwig
2006-11-08 5:26 ` Amol Lad
-- strict thread matches above, loose matches on Subject: below --
2006-11-07 6:51 Amol Lad
2006-10-16 6:49 [PATCH] drivers/scsi/mca_53c9x.c: " Amol Lad
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.