public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: joy@entuzijast.net, sparclinux@vger.kernel.org,
	linux-scsi@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: [PATCH scsi-rc-fixes] qla2xxx: Defer enablement of RISC interrupts until ISP initialization completes.
Date: Thu, 11 Sep 2008 22:19:45 -0700	[thread overview]
Message-ID: <20080912051945.GB76313@plap4-2.local> (raw)
In-Reply-To: <20080911221543.GQ66567@plap4-2.local>

Josip Rodin noted
(http://article.gmane.org/gmane.linux.ports.sparc/10152) the
driver oopsing during registration of an rport to the
FC-transport layer with a backtrace indicating a dereferencing of
an shost->shost_data equal to NULL.  David Miller identified a
small window in driver logic where this could happen:

    > Look at how the driver registers the IRQ handler before the host has
    > been registered with the SCSI layer.
    >
    > That leads to a window of time where the shost hasn't been setup
    > fully, yet ISRs can come in and trigger DPC thread events, such as
    > loop resyncs, which expect the transport area to be setup.
    >
    > But it won't be setup, because scsi_add_host() hasn't finished yet.
    >
    > Note that in Josip's crash log, we don't even see the
    >
    >         qla_printk(KERN_INFO, ha, "\n"
    >             " QLogic Fibre Channel HBA Driver: %s\n"
    >             "  QLogic %s - %s\n"
    >             "  ISP%04X: %s @ %s hdma%c, host#=%ld, fw=%s\n",
    >  ...
    >
    > message yet.
    >
    > Which means that the crash occurs between qla2x00_request_irqs()
    > and printing that message.

Close this window by enabling RISC interrupts after the host has
been registered with the SCSI midlayer.

Reported-by: Josip Rodin <joy@entuzijast.net>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_isr.c |    1 -
 drivers/scsi/qla2xxx/qla_os.c  |    2 ++
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index e50752e..fc4bfa7 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1837,7 +1837,6 @@ clear_risc_ints:
 		WRT_REG_WORD(&reg->isp.hccr, HCCR_CLR_HOST_INT);
 	}
 	spin_unlock_irq(&ha->hardware_lock);
-	ha->isp_ops->enable_intrs(ha);
 
 fail:
 	return ret;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index fcbcd44..3433441 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1739,6 +1739,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (ret)
 		goto probe_failed;
 
+	ha->isp_ops->enable_intrs(ha);
+
 	scsi_scan_host(host);
 
 	qla2x00_alloc_sysfs_attr(ha);
-- 
1.6.0.1.267.gec3a


      reply	other threads:[~2008-09-12  5:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04  9:39 kernel 2.6.26.3 qla2xxx oopsing on Fire 280R Josip Rodin
2008-09-08 21:13 ` Andrew Vasquez
2008-09-08 21:23   ` David Miller
2008-09-08 21:49     ` Andrew Vasquez
2008-09-08 23:08       ` David Miller
2008-09-08 23:42         ` Josip Rodin
2008-09-09  1:35         ` Andrew Vasquez
2008-09-09  1:49           ` Josip Rodin
2008-09-09  1:53   ` Josip Rodin
2008-09-09  2:01     ` Andrew Vasquez
2008-09-09 14:39       ` Josip Rodin
2008-09-09 15:00         ` Josip Rodin
2008-09-09 21:30           ` David Miller
2008-09-09 22:00             ` Josip Rodin
2008-09-09 22:57               ` David Miller
2008-09-09 22:59                 ` David Miller
2008-09-10  0:05                   ` Josip Rodin
2008-09-10  0:30                     ` David Miller
2008-09-11 11:37         ` Josip Rodin
2008-09-11 21:57           ` Josip Rodin
2008-09-11 22:01             ` David Miller
2008-09-11 22:15               ` Andrew Vasquez
2008-09-12  5:19                 ` Andrew Vasquez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080912051945.GB76313@plap4-2.local \
    --to=andrew.vasquez@qlogic.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=davem@davemloft.net \
    --cc=joy@entuzijast.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox