[SCSI] qla2xxx: Disable local-interrupts while polling for RISC status.
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Tue, 13 May 2008 05:21:14 +0000 (22:21 -0700)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Thu, 15 May 2008 15:39:29 +0000 (16:39 +0100)
Matthew Wilcox <matthew@wil.cx> reported the following lockdep
warning:

 > =================================
 > [INFO:inconsistentlockstate]
 > 2.6.26-rc1-00115-g0340eda-dirty#60
 > ---------------------------------
 > inconsistent{hardirq-on-W}->{in-hardirq-W}usage.
 > swapper/1[HC1[1]:SC0[0]:HE0:SE1]takes:
 > (&ha->hardware_lock){+-..},at:[<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > {hardirq-on-W}statewasregisteredat:
 > [<c0139a16>]__lock_acquire+0x459/0xb1d
 > [<c013a091>]__lock_acquire+0xad4/0xb1d
 > [<c013a142>]lock_acquire+0x68/0x82
 > [<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > [<c0506da5>]_spin_lock+0x24/0x4d
 > [<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > [<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > [<c01391e4>]trace_hardirqs_on+0xe7/0x10e
 > [<c034f0a6>]qla2x00_mailbox_command+0x1c6/0x433
 ...
 > other info that might help us debug this:
 > no locks held by swapper/1.
 >
 > stack backtrace:
 > Pid:1,comm:swapperNottainted2.6.26-rc1-00115-g0340eda-dirty#60
 > [<c0138121>]print_usage_bug+0x100/0x10a
 > [<c0138d37>]mark_lock+0xaa/0x395
 > [<c01399af>]__lock_acquire+0x3f2/0xb1d
 > [<c013a091>]__lock_acquire+0xad4/0xb1d
 > [<c013a142>]lock_acquire+0x68/0x82
 > [<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > [<c0506da5>]_spin_lock+0x24/0x4d
 > [<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > [<c035495d>]qla2300_intr_handler+0x35/0x1f5
 > [<c014a37b>]handle_IRQ_event+0x13/0x3d
 > [<c014b366>]handle_fasteoi_irq+0x76/0xab

Which shows that lockdep is detecting the driver's
interrupt-handler is run in both process and interrupt context
with irqs-enabled in the former case.

During init-time and error-recovery (after a RISC reset), the
driver disables interrupts and 'polls' for completions by calling
qla2x00_poll():

static inline void
qla2x00_poll(scsi_qla_host_t *ha)
{
ha->isp_ops->intr_handler(0, ha);
}

which in-turn calls the ISP registered interrupt handler.  This
patch corrects it by disabling local interrupts during polling.

Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/qla2xxx/qla_inline.h

index e9bae27737d1d9a2d9e7fc7414ecdeb6d36f3eb2..92fafbdbbaabd82634377c607415c2b94cc705bf 100644 (file)
@@ -34,7 +34,11 @@ qla2x00_debounce_register(volatile uint16_t __iomem *addr)
 static inline void
 qla2x00_poll(scsi_qla_host_t *ha)
 {
+       unsigned long flags;
+
+       local_irq_save(flags);
        ha->isp_ops->intr_handler(0, ha);
+       local_irq_restore(flags);
 }
 
 static __inline__ scsi_qla_host_t *