From 3850b14e51d32fc0d4297ceb30f3f7bb2c2b4779 Mon Sep 17 00:00:00 2001 From: "kashyap.desai@lsi.com" Date: Thu, 4 Aug 2011 16:41:55 +0530 Subject: [SCSI] mptfusion: Set max sector count module parameter The max_sector setting is currently hard-coded in the driver to 8192 sectors (4MB transfers). Using new module parameter, if max_sectors is specified at load time, the default of 8192 will be overridden. Signed-off-by: Kashyap Desai Signed-off-by: James Bottomley --- drivers/message/fusion/mptsas.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/message/fusion/mptsas.c') diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 7596aecd5072..73229ff9cafa 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -92,6 +92,11 @@ static int max_lun = MPTSAS_MAX_LUN; module_param(max_lun, int, 0); MODULE_PARM_DESC(max_lun, " max lun, default=16895 "); +static int mpt_loadtime_max_sectors = 8192; +module_param(mpt_loadtime_max_sectors, int, 0); +MODULE_PARM_DESC(mpt_loadtime_max_sectors, + " Maximum sector define for Host Bus Adaptor.Range 64 to 8192 default=8192"); + static u8 mptsasDoneCtx = MPT_MAX_PROTOCOL_DRIVERS; static u8 mptsasTaskCtx = MPT_MAX_PROTOCOL_DRIVERS; static u8 mptsasInternalCtx = MPT_MAX_PROTOCOL_DRIVERS; /* Used only for internal commands */ @@ -5239,6 +5244,21 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) sh->sg_tablesize = numSGE; } + if (mpt_loadtime_max_sectors) { + if (mpt_loadtime_max_sectors < 64 || + mpt_loadtime_max_sectors > 8192) { + printk(MYIOC_s_INFO_FMT "Invalid value passed for" + "mpt_loadtime_max_sectors %d." + "Range from 64 to 8192\n", ioc->name, + mpt_loadtime_max_sectors); + } + mpt_loadtime_max_sectors &= 0xFFFFFFFE; + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT + "Resetting max sector to %d from %d\n", + ioc->name, mpt_loadtime_max_sectors, sh->max_sectors)); + sh->max_sectors = mpt_loadtime_max_sectors; + } + hd = shost_priv(sh); hd->ioc = ioc; -- cgit v1.2.2 From e62cca19a9bbfc72c62632d95a7c01cd6476708c Mon Sep 17 00:00:00 2001 From: "kashyap.desai@lsi.com" Date: Thu, 4 Aug 2011 16:42:15 +0530 Subject: [SCSI] mptfusion: Better handling of DEAD IOC PCI-E Link down error condition Find Non-Operation IOC and remove it from OS: Detecting dead(non-functional) ioc will be done reading doorbell register value from fault reset thread, which has been called from work thread context after each specific interval. If doorbell value is 0xFFFFFFFF, it will be considered as IOC is non-operational and marked as dead ioc. Once Dead IOC has been detected, it will be removed at pci layer using "pci_remove_bus_device" API. Signed-off-by: Kashyap Desai Signed-off-by: James Bottomley --- drivers/message/fusion/mptsas.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/message/fusion/mptsas.c') diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 73229ff9cafa..d21924ba4b1a 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -5147,6 +5147,8 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) ioc->TaskCtx = mptsasTaskCtx; ioc->InternalCtx = mptsasInternalCtx; ioc->schedule_target_reset = &mptsas_schedule_target_reset; + ioc->schedule_dead_ioc_flush_running_cmds = + &mptscsih_flush_running_cmds; /* Added sanity check on readiness of the MPT adapter. */ if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) { -- cgit v1.2.2 From a38ae37fdcd77657fb6624b0a0ec57f3d21e2f40 Mon Sep 17 00:00:00 2001 From: "kashyap.desai@lsi.com" Date: Thu, 4 Aug 2011 16:42:46 +0530 Subject: [SCSI] mptfusion: Avoid out of order Event processing due to cpu migration Driver will now schedule MPI event using "delay_work_queue_on" to specify same CPU to be used to schedule work. Earlier it used "delay_work_queue" which can cause migration of work due to kernel' timer migration feature. Signed-off-by: Kashyap Desai Signed-off-by: James Bottomley --- drivers/message/fusion/mptsas.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'drivers/message/fusion/mptsas.c') diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index d21924ba4b1a..074e52254fcd 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -290,10 +290,11 @@ mptsas_add_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event, spin_lock_irqsave(&ioc->fw_event_lock, flags); list_add_tail(&fw_event->list, &ioc->fw_event_list); INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work); - devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: add (fw_event=0x%p)\n", - ioc->name, __func__, fw_event)); - queue_delayed_work(ioc->fw_event_q, &fw_event->work, - delay); + devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: add (fw_event=0x%p)" + "on cpuid %d\n", ioc->name, __func__, + fw_event, smp_processor_id())); + queue_delayed_work_on(smp_processor_id(), ioc->fw_event_q, + &fw_event->work, delay); spin_unlock_irqrestore(&ioc->fw_event_lock, flags); } @@ -305,10 +306,11 @@ mptsas_requeue_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event, unsigned long flags; spin_lock_irqsave(&ioc->fw_event_lock, flags); devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: reschedule task " - "(fw_event=0x%p)\n", ioc->name, __func__, fw_event)); + "(fw_event=0x%p)on cpuid %d\n", ioc->name, __func__, + fw_event, smp_processor_id())); fw_event->retries++; - queue_delayed_work(ioc->fw_event_q, &fw_event->work, - msecs_to_jiffies(delay)); + queue_delayed_work_on(smp_processor_id(), ioc->fw_event_q, + &fw_event->work, msecs_to_jiffies(delay)); spin_unlock_irqrestore(&ioc->fw_event_lock, flags); } -- cgit v1.2.2 From 98cbe371fd373f13806595835b79da07f3a2f934 Mon Sep 17 00:00:00 2001 From: "kashyap.desai@lsi.com" Date: Fri, 5 Aug 2011 11:04:37 +0530 Subject: [SCSI] mptfusion: Fix for device offline while doing aggressive HBA reset [Resend patch as per Bernd Schubert comment ] Issue: Device goes offline while doing aggressive HBA reset along with IO using some utility. Root cause: FW goes into bad state due to aggressive reset. Softreset does not help to recover FW. And also aggressive reset open up the window for Error handling thread to kicked off at the same time HBA will be in constant RESET loop as part of aggressive reset test case can lead Device to goes offline. Changes: 1. Added extra check as below inside eh_timed_out call back as below. if(ioc->ioc_reset_in_progress) Rc = EH_TIMER_RESET 2. Removed " DOORBELL_ACTIVE" check for SAS controller from task management context. Since SAS controller uses high priority queue for task management. This check is not required for SAS controller. 3. Moved SoftReset call to HardReset from Task Mgmt context. Signed-off-by: Kashyap Desai Signed-off-by: James Bottomley --- drivers/message/fusion/mptsas.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/message/fusion/mptsas.c') diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 074e52254fcd..9d9504298549 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -1950,6 +1950,15 @@ static enum blk_eh_timer_return mptsas_eh_timed_out(struct scsi_cmnd *sc) goto done; } + /* In case if IOC is in reset from internal context. + * Do not execute EEH for the same IOC. SML should to reset timer. + */ + if (ioc->ioc_reset_in_progress) { + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: ioc is in reset," + "SML need to reset the timer (sc=%p)\n", + ioc->name, __func__, sc)); + rc = BLK_EH_RESET_TIMER; + } vdevice = sc->device->hostdata; if (vdevice && vdevice->vtarget && (vdevice->vtarget->inDMD || vdevice->vtarget->deleted)) { -- cgit v1.2.2