mpt2sas: Fix the race between broadcast asyn event and scsi
PATCH 6/10 mpt2sas: Fix the race between broadcast asyn event and scsi
Add support for Customer specific branding messages when device driver loads, False timeout after hard resets, there were two issues which leads to timeout.
(1) Panic because of invalid memory access in the broadcast asyn event processing routine due to a race between accessing the scsi command pointer from broadcast asyn event processing thread and completing the same scsi command from the interrupt context.
(2) Broadcast asyn event notifcations are not handled due to events ignored while the broadcast asyn event is activity being processed from the event process kernel thread.
In addition, changed the ABRT_TASK_SET to ABORT_TASK in the
broadcast async event processing routine. This is less disruptive to other
request that generate Broadcast Asyn Primitives besides target reset. e.g clear reservations, microcode download,and mode select.
---
drivers/scsi/mpt2sas/mpt2sas_base.h +0 -0
drivers/scsi/mpt2sas/mpt2sas_scsih.c +45 -9
117 lines not on this page · raw message
based on specific customer subsystem vendor and device Ids
---
drivers/scsi/mpt2sas/mpt2sas_base.c +26 -0
@@ -1725,6 +1725,31 @@ _base_display_dell_branding(struct MPT2SAS_ADAPTER *ioc) }/** +* _base_display_intel_branding - Display branding string +* @ioc: per adapter object +* +* Return nothing. +*/ +static void +_base_display_intel_branding (struct MPT2SAS_ADAPTER *ioc) +{ +if (ioc->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL && + ioc->pdev->device ==MPI2_MFGPAGE_DEVID_SAS2008 ) { + +switch (ioc->pdev->subsystem_device) { +case MPT2SAS_INTEL_RMS2LL080_SSDID : +printk (MPT2SAS_INFO_FMT "%s\n" , ioc->name, +MPT2SAS_INTEL_RMS2LL080_BRANDING ); +break ; +case MPT2SAS_INTEL_RMS2LL040_SSDID : +printk (MPT2SAS_INFO_FMT "%s\n" , ioc->name, +MPT2SAS_INTEL_RMS2LL040_BRANDING ); +break ; + } + } +} + +/** * _base_display_ioc_capabilities - Disply IOC's capabilities. * @ioc: per adapter object *
@@ -1754,6 +1779,7 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc) ioc->bios_pg3.BiosVersion & 0x000000FF);_base_display_dell_branding (ioc); +_base_display_intel_branding (ioc);printk (MPT2SAS_INFO_FMT "Protocol=(" , ioc->name);
drivers/scsi/mpt2sas/mpt2sas_base.h +14 -0
@@ -154,6 +154,20 @@#define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22/* +* Intel HBA branding +*/ +#define MPT2SAS_INTEL_RMS2LL080_BRANDING \ + "Intel Integrated RAID Module RMS2LL080" +#define MPT2SAS_INTEL_RMS2LL040_BRANDING \ + "Intel Integrated RAID Module RMS2LL040" + +/* +* Intel HBA SSDIDs +*/ +#define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E +#define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F + +/* * per target private data */ #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
Please ignore this patch. I will re-send this patch.
~ Kashyap
Quoted 259 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Kashyap, Desai
Sent: Tuesday, January 04, 2011 11:38 AM
To: [email protected]
Cc: [email protected]; Moore, Eric; Prakash, Sathya
Subject: [PATCH 06/10] mpt2sas: Fix the race between broadcast asyn event and scsiAdd support for Customer specific branding messages when device driver loads,
False timeout after hard resets, there were two issues which leads to timeout.
(1) Panic because of invalid memory access in the broadcast asyn event processing routine due to a race between accessing the scsi command
pointer from broadcast asyn event processing thread and completing the same scsi command from the interrupt context.
(2) Broadcast asyn event notifcations are not handled due to events ignored while the broadcast asyn event is activity being processed from the event process kernel thread.In addition, changed the
ABRT_TASK_SETtoABORT_TASKin the
broadcast async event processing routine. This is less disruptive to
other
request that generate Broadcast Asyn Primitives besides target reset. e.g clear reservations, microcode download,and mode select.Signed-off-by Kashyap Desai <[email protected]>---
drivers/scsi/mpt2sas/mpt2sas_base.h +0
-0drivers/scsi/mpt2sas/mpt2sas_scsih.c +23
-1@@ -819,7 +819,7 @@ _scsih_is_end_device(u32 device_info) }/** -* mptscsih_get_scsi_lookup - returns scmd entry +* _scsih_scsi_lookup_get - returns scmd entry * @ioc: per adapter object * @smid: system request message index * @@ -832,6 +832,28 @@ _scsih_scsi_lookup_get(struct MPT2SAS_ADAPTER *ioc, u16 smid) }/** +* _scsih_scsi_lookup_get_clear - returns scmd entry +* @ioc: per adapter object +* @smid: system request message index +* +* Returns the smid stored scmd pointer. +* Then will derefrence the stored scmd pointer. +*/ +static inline struct scsi_cmnd * +_scsih_scsi_lookup_get_clear (struct MPT2SAS_ADAPTER *ioc,u16 smid) +{ +unsigned long flags; +struct scsi_cmnd *scmd; + +spin_lock_irqsave (&ioc->scsi_lookup_lock, flags); + scmd = ioc->scsi_lookup[smid -1 ].scmd; + ioc->scsi_lookup[smid -1 ].scmd =NULL ; +spin_unlock_irqrestore (&ioc->scsi_lookup_lock, flags); + +return scmd; +} + +/** * _scsih_scsi_lookup_find_by_scmd - scmd lookup * @ioc: per adapter object * @smid: system request message index
drivers/scsi/mpt2sas/mpt2sas_scsih.c +1
-1@@ -3207,7 +3229,7 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc)u16 count =0 ;for (smid =1 ; smid <= ioc->scsiio_depth; smid++) { - scmd =_scsih_scsi_lookup_get (ioc, smid); + scmd =_scsih_scsi_lookup_get_clear (ioc, smid);if (!scmd)continue ;drivers/scsi/mpt2sas/mpt2sas_scsih.c +2
-1count++;@@ -3801,7 +3823,7 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) u32 response_code = 0; mpi_reply =mpt2sas_base_get_reply_virt_addr (ioc, reply); - scmd =_scsih_scsi_lookup_get (ioc, smid); + scmd =_scsih_scsi_lookup_get_clear (ioc, smid);if (scmd ==NULL )return 1 ;@@ -5102,6 +5124,7 @@ _scsih_sas_broadcast_primative_event(structMPT2SAS_ADAPTER *ioc, struct fw_event_work *fw_event) { struct scsi_cmnd *scmd; +struct scsi_device *sdev;u16 smid, handle;u32 lun;drivers/scsi/mpt2sas/mpt2sas_scsih.c +5
-0struct MPT2SAS_DEVICE *sas_device_priv_data;@@ -5112,12 +5135,17 @@ _scsih_sas_broadcast_primative_event(structMPT2SAS_ADAPTER *ioc, Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event- >event_data;#endif u16 ioc_status; +unsigned long flags; +int r; +dewtprintk (ioc,printk (MPT2SAS_INFO_FMT "broadcast primative: " "phy number(%d), width(%d)\n" , ioc->name, event_data->PhyNum, event_data->PortWidth));dtmprintk (ioc,printk (MPT2SAS_INFO_FMT "%s: enter\n" , ioc->name, __func__)); +spin_lock_irqsave (&ioc->scsi_lookup_lock, flags); + ioc->broadcast_aen_busy =0 ; termination_count =0 ;drivers/scsi/mpt2sas/mpt2sas_scsih.c +2
-1query_count =0 ; mpi_reply = ioc->tm_cmds.reply;@@ -5125,7 +5153,8 @@ _scsih_sas_broadcast_primative_event(structMPT2SAS_ADAPTER *ioc, scmd =_scsih_scsi_lookup_get (ioc, smid);if (!scmd)continue ; - sas_device_priv_data = scmd->device->hostdata; + sdev = scmd->device; + sas_device_priv_data = sdev->hostdata;if (!sas_device_priv_data || !sas_device_priv_data- >sas_target)drivers/scsi/mpt2sas/mpt2sas_scsih.c +1
-0continue ;/* skip hidden raid components */ @@ -5141,6 +5170,7 @@ _scsih_sas_broadcast_primative_event(structMPT2SAS_ADAPTER *ioc, lun = sas_device_priv_data->lun; query_count++; +spin_unlock_irqrestore (&ioc->scsi_lookup_lock, flags);mpt2sas_scsih_issue_tm (ioc, handle,0 ,0 , lun,MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK , smid,30 ,NULL );drivers/scsi/mpt2sas/mpt2sas_scsih.c +11
-5ioc->tm_cmds.status =MPT2_CMD_NOT_USED ;@@ -5150,14 +5180,20 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, (mpi_reply->ResponseCode == MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || mpi_reply->ResponseCode == - MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) + MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) { +spin_lock_irqsave (&ioc->scsi_lookup_lock, flags);continue ; - -mpt2sas_scsih_issue_tm (ioc, handle,0 ,0 , lun, -MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET ,0 ,30 ,NULL ); + } + r =mpt2sas_scsih_issue_tm (ioc, handle, sdev->channel, sdev->id, + sdev->lun,MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK , smid,30 , + scmd); +if (r ==FAILED ) +sdev_printk (KERN_WARNING , sdev,"task abort: FAILED " +"scmd(%p)\n" , scmd); termination_count +=le32_to_cpu (mpi_reply- >TerminationCount); +spin_lock_irqsave (&ioc->scsi_lookup_lock, flags); } - ioc->broadcast_aen_busy =0 ; +spin_unlock_irqrestore (&ioc->scsi_lookup_lock, flags); dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s - exit, query_count = %d termination_count = %d\n",based on specific customer subsystem vendor and device Ids
Signed-off-by Kashyap Desai <[email protected]>---
drivers/scsi/mpt2sas/mpt2sas_base.c +25
-0@@ -1725,6 +1725,31 @@ _base_display_dell_branding(struct MPT2SAS_ADAPTER *ioc) }/** +* _base_display_intel_branding - Display branding string +* @ioc: per adapter object +* +* Return nothing. +*/ +static void +_base_display_intel_branding (struct MPT2SAS_ADAPTER *ioc) +{ +if (ioc->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL && + ioc->pdev->device ==MPI2_MFGPAGE_DEVID_SAS2008 ) { + +switch (ioc->pdev->subsystem_device) { +case MPT2SAS_INTEL_RMS2LL080_SSDID : +printk (MPT2SAS_INFO_FMT "%s\n" , ioc->name, +MPT2SAS_INTEL_RMS2LL080_BRANDING ); +break ; +case MPT2SAS_INTEL_RMS2LL040_SSDID : +printk (MPT2SAS_INFO_FMT "%s\n" , ioc->name, +MPT2SAS_INTEL_RMS2LL040_BRANDING ); +break ; + } + } +} + +/** * _base_display_ioc_capabilities - Disply IOC's capabilities. * @ioc: per adapter object *
drivers/scsi/mpt2sas/mpt2sas_base.c +1
-0@@ -1754,6 +1779,7 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc) ioc->bios_pg3.BiosVersion & 0x000000FF);_base_display_dell_branding (ioc); +_base_display_intel_branding (ioc);printk (MPT2SAS_INFO_FMT "Protocol=(" , ioc->name);drivers/scsi/mpt2sas/mpt2sas_base.h +14
-1@@ -154,6 +154,20 @@#define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22/* +* Intel HBA branding +*/ +#define MPT2SAS_INTEL_RMS2LL080_BRANDING \ + "Intel Integrated RAID Module RMS2LL080" +#define MPT2SAS_INTEL_RMS2LL040_BRANDING \ + "Intel Integrated RAID Module RMS2LL040" + +/* +* Intel HBA SSDIDs +*/ +#define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E +#define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F + +/* * per target private data */ #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01 --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html