mpt3sas: Improve device readiness handling and event recovery
Subsystems (2)
Ranjan Kumar
maintainercover mpt3sas: Improve device readiness handling and event recovery
This patch series enhances the mpt3sas driver’s device bring-up, readiness detection, and event recovery mechanisms to improve robustness in environments with slow-responding or transient SAS/PCIe devices.
The series introduces optional control over issuing TEST UNIT READY (TUR) commands during device unblocking, configurable retry limits, and a mechanism to requeue firmware topology events when devices are temporarily busy. Together, these updates reduce discovery failures and improve recovery reliability following firmware or link events.
Ranjan Kumar (5):
mpt3sas: Added no_turs flag to device unblock logic
mpt3sas: Added issue_scsi_cmd_to_bringup_drive module parameter part-1
mpt3sas: improve device discovery and readiness handling for slow
devices part-2
mpt3sas: Add firmware event requeue support for busy devices
mpt3sas: Add configurable command retry limit for slow-to-respond
devices
drivers/scsi/mpt3sas/mpt3sas_base.c | 6 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1459 ++++++++++++++++++++++++-- 3 files changed, 1370 insertions(+), 99 deletions(-)
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH 1/5 mpt3sas: Added no_turs flag to device unblock logic
Add a "no_turs" flag to _scsih_ublock_io_all_device() to optionally skip TEST UNIT READY (TUR) checks while unblocking devices. This is used after broadcast events where sending TURs is not required.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +10 -3
@@ -3829,7 +3829,7 @@ _scsih_internal_device_unblock(struct scsi_device *sdev,* change the device state from block to running */ static void -_scsih_ublock_io_all_device (struct MPT3SAS_ADAPTER *ioc) +_scsih_ublock_io_all_device (struct MPT3SAS_ADAPTER *ioc,u8 no_turs) {struct MPT3SAS_DEVICE *sas_device_priv_data;struct scsi_device *sdev;
@@ -3841,6 +3841,13 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc)if (!sas_device_priv_data->block)continue ; +if (no_turs) { +sdev_printk (KERN_WARNING , sdev,"device_unblocked handle(0x%04x)\n" , + sas_device_priv_data->sas_target->handle); +_scsih_internal_device_unblock (sdev, sas_device_priv_data); +continue ; + } +dewtprintk (ioc,sdev_printk (KERN_INFO , sdev,"device_running, handle(0x%04x)\n" , sas_device_priv_data->sas_target->handle));
@@ -8810,7 +8817,7 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, ioc->broadcast_aen_busy =0 ;if (!ioc->shost_recovery) -_scsih_ublock_io_all_device (ioc); +_scsih_ublock_io_all_device (ioc,1 );mutex_unlock (&ioc->tm_cmds.mutex); }
@@ -10344,7 +10351,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc)ioc_info (ioc,"removing unresponding devices: complete\n" );/* unblock devices */ -_scsih_ublock_io_all_device (ioc); +_scsih_ublock_io_all_device (ioc,0 ); } static void
Signature · 1 line
2.47.3
kernel test robot
build botRe: [PATCH v1 1/5] mpt3sas: Added no_turs flag to device unblock logic
kernel test robot noticed the following build warnings:
Hi Ranjan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.18-rc3 next-20251030] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpt3sas-Added-no_turs-flag-to-device-unblock-logic/20251030-025730 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next patch link: https://lore.kernel.org/r/20251029181058.39157-2-ranjan.kumar%40broadcom.com patch subject: [PATCH v1 1/5] mpt3sas: Added no_turs flag to device unblock logic config: i386-randconfig-054-20251030 (https://download.01.org/0day-ci/archive/20251031/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251031/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:3832 function parameter 'no_turs' not described in '_scsih_ublock_io_all_device'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Ranjan Kumar
maintainerPATCH 2/5 mpt3sas: Added issue_scsi_cmd_to_bringup_drive module parameter part-1
In reply to Ranjan KumarIntroduced a new module parameter "issue_scsi_cmd_to_bringup_drive" (default=1) which allows overriding the driver's behavior of issuing SCSI TEST_UNIT_READY/START_UNIT commands to bring devices to READY state during unblock.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +9 -0
@@ -159,6 +159,15 @@ module_param(enable_sdev_max_qd, bool, 0444);MODULE_PARM_DESC (enable_sdev_max_qd,"Enable sdev max qd as can_queue, def=disabled(0)" ); +/* +* permit overriding the SCSI command issuing capability of +* the driver to bring the drive to READY state +*/ +static int issue_scsi_cmd_to_bringup_drive =1 ; +module_param (issue_scsi_cmd_to_bringup_drive, int,0444 ); +MODULE_PARM_DESC (issue_scsi_cmd_to_bringup_drive,"allow host driver to\n" +"issue SCSI commands to bring the drive to READY state, default=1 " ); +static int multipath_on_hba =-1 ;module_param (multipath_on_hba, int,0 ); MODULE_PARM_DESC(multipath_on_hba,
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH 3/5 mpt3sas: improve device discovery and readiness handling for slow devices part-2
In reply to Ranjan KumarImproves device discovery and I/O unblocking reliability in the mpt3sas driver by adding robust device readiness checks and separate callback handling for discovery I/O. It introduces new helper routines for SCSI command execution and readiness determination, ensuring smoother recovery and initialization for slow or transient devices.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 6 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1115 +++++++++++++++++++++++++- 3 files changed, 1108 insertions(+), 17 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +5 -1
@@ -1564,6 +1564,8 @@ _base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid)int i;u16 ctl_smid = ioc->scsiio_depth -INTERNAL_SCSIIO_CMDS_COUNT +1 ;u8 cb_idx =0xFF ; +u16 discovery_smid = + ioc->shost->can_queue +INTERNAL_SCSIIO_FOR_DISCOVERY ;if (smid < ioc->hi_priority_smid) {struct scsiio_tracker *st;
@@ -1572,8 +1574,10 @@ _base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid) st =_get_st_from_smid (ioc, smid);if (st) cb_idx = st->cb_idx; - }else if (smid == ctl_smid) + }else if (smid < discovery_smid) cb_idx = ioc->ctl_cb_idx; +else + cb_idx = ioc->scsih_cb_idx; }else if (smid < ioc->internal_smid) { i = smid - ioc->hi_priority_smid; cb_idx = ioc->hpr_lookup[i].cb_idx;
drivers/scsi/mpt3sas/mpt3sas_base.h +4 -0
@@ -147,6 +147,7 @@#define INTERNAL_CMDS_COUNT 10/* reserved cmds */ /* reserved for issuing internally framed scsi io cmds */ #define INTERNAL_SCSIIO_CMDS_COUNT 3 +#define INTERNAL_SCSIIO_FOR_DISCOVERY 2#define MPI3_HIM_MASK 0xFFFFFFFF/* mask every bit*/
@@ -480,6 +481,7 @@ struct MPT3SAS_DEVICE {u32 flags;u8 configured_lun;u8 block; +u8 deleted;u8 tlr_snoop_check;u8 ignore_delay_remove;/* Iopriority Command Handling */
@@ -577,7 +579,9 @@ struct _sas_device {u8 chassis_slot;u8 is_chassis_slot_valid;u8 connector_name[5 ]; +u8 ssd_device;struct kref refcount; +u8 port_type;struct hba_port *port;struct sas_rphy *rphy;
drivers/scsi/mpt3sas/mpt3sas_scsih.c +1099 -16
1,310 lines not on this page · raw message
Signature · 1 line
2.47.3
kernel test robot
build botRe: [PATCH v1 3/5] mpt3sas: improve device discovery and readiness handling for slow devices part-2
kernel test robot noticed the following build warnings:
Hi Ranjan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.18-rc3 next-20251030] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpt3sas-Added-no_turs-flag-to-device-unblock-logic/20251030-025730 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next patch link: https://lore.kernel.org/r/20251029181058.39157-4-ranjan.kumar%40broadcom.com patch subject: [PATCH v1 3/5] mpt3sas: improve device discovery and readiness handling for slow devices part-2 config: i386-randconfig-054-20251030 (https://download.01.org/0day-ci/archive/20251031/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251031/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:274 struct member 'retries' not described in 'fw_event_work' >> Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:274 struct member 'delayed_work_active' not described in 'fw_event_work' >> Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:274 struct member 'delayed_work' not described in 'fw_event_work' Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:3885 function parameter 'no_turs' not described in '_scsih_ublock_io_all_device' >> Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:3921 function parameter 'sas_address' not described in '_scsih_ublock_io_device_wait'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Ranjan Kumar
maintainerPATCH 4/5 mpt3sas: Add firmware event requeue support for busy devices
In reply to Ranjan KumarAdd support to requeue SAS/PCIe topology change events when devices are busy or not ready. Introduce delayed work with retry counters so events are retried instead of dropped, improving device discovery by retrying transient failures instead of dropping events.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 128 +++++++++++++++++++++++---- 1 file changed, 110 insertions(+), 18 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +110 -18
@@ -89,6 +89,7 @@ _scsih_ata_pass_thru_idd(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 *is_ssd_devstatic enum device_responsive_state _scsih_wait_for_device_to_become_ready (struct MPT3SAS_ADAPTER *ioc,u16 handle,u8 retry_count,u8 is_pd,int lun,u8 tr_timeout,u8 tr_method); +static void _firmware_event_work_delayed (struct work_struct *work);/* global parameters */ LIST_HEAD (mpt3sas_ioc_list);
@@ -272,11 +273,16 @@ struct fw_event_work {u16 event;struct kref refcount;char event_data[]__aligned(4) ; + };static void fw_event_work_free (struct kref *r) { -kfree (container_of(r ,struct fw_event_work ,refcount )); +struct fw_event_work *fw_work; + + fw_work = container_of(r, struct fw_event_work, refcount); +kfree (fw_work->retries); +kfree (fw_work); }static void fw_event_work_get (struct fw_event_work *fw_work)
@@ -3648,6 +3654,35 @@ _scsih_fw_event_del_from_list(struct MPT3SAS_ADAPTER *ioc, struct fw_event_workspin_unlock_irqrestore (&ioc->fw_event_lock, flags); } +/** +* _scsih_fw_event_requeue - requeue an event +* @ioc: per adapter object +* @fw_event: object describing the event +* Context: This function will acquire ioc->fw_event_lock. +* +* Return nothing. +*/ +static void +_scsih_fw_event_requeue (struct MPT3SAS_ADAPTER *ioc,struct fw_event_work + *fw_event,unsigned long delay) +{ +unsigned long flags; + +if (ioc->firmware_event_thread ==NULL ) +return ; + +spin_lock_irqsave (&ioc->fw_event_lock, flags); +fw_event_work_get (fw_event); +list_add_tail (&fw_event->list, &ioc->fw_event_list); +if (!fw_event->delayed_work_active) { + fw_event->delayed_work_active =1 ; +INIT_DELAYED_WORK (&fw_event->delayed_work, + _firmware_event_work_delayed); + } +queue_delayed_work (ioc->firmware_event_thread, &fw_event->delayed_work, +msecs_to_jiffies (delay)); +spin_unlock_irqrestore (&ioc->fw_event_lock, flags); +}/** * mpt3sas_send_trigger_data_event - send event for processing trigger data
@@ -8586,6 +8621,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, {int i;int rc; +int requeue_event;u16 parent_handle, handle;u16 reason_code;u8 phy_number, max_phys;
@@ -8640,7 +8676,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc,spin_unlock_irqrestore (&ioc->sas_node_lock, flags);/* handle siblings events */ -for (i =0 ; i < event_data->NumEntries; i++) { +for (i =0 , requeue_event =0 ; i < event_data->NumEntries; i++) {if (fw_event->ignore) {dewtprintk (ioc,ioc_info (ioc,"ignoring expander event\n" ));
@@ -8660,7 +8696,14 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc,if (fw_event->delayed_work_active && (reason_code ==MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING )) {dewtprintk (ioc,ioc_info (ioc,"ignoring\n" -"Targ not responding event phy in re-queued event processing\n" )); +"Target not responding event phy in re-queued event processing\n" )); +continue ; + } + +if (fw_event->delayed_work_active && (reason_code == +MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING )) { +dewtprintk (ioc,ioc_info (ioc,"ignoring Target not responding\n" +"event phy in re-queued event processing\n" ));continue ; }
@@ -8711,7 +8754,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, "event to a device add\n", handle)); event_data->PHY[i].PhyStatus &=0xF0 ; event_data->PHY[i].PhyStatus |= -MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED ; +MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED ; fallthrough;
@@ -8728,11 +8771,13 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, rc =_scsih_add_device (ioc, handle, fw_event->retries[i],0 ); -if (rc)/* retry due to busy device */ +if (rc) {/* retry due to busy device */ fw_event->retries[i]++; -else /* mark entry vacant */ + requeue_event =1 ; + }else {/* mark entry vacant */ event_data->PHY[i].PhyStatus |= -MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT ; +MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT ; + }break ;case MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING :
@@ -8747,7 +8792,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, sas_expander)mpt3sas_expander_remove (ioc ,sas_address ,port ); -return 0 ; +return requeue_event; }/**
@@ -9425,7 +9470,7 @@ _scsih_pcie_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc,* Context: user. * */ -static void +static int _scsih_pcie_topology_change_event (struct MPT3SAS_ADAPTER *ioc,struct fw_event_work *fw_event) {
@@ -9435,6 +9480,7 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,u8 link_rate, prev_link_rate;unsigned long flags;int rc; +int requeue_event;Mpi26EventDataPCIeTopologyChangeList_t *event_data = (Mpi26EventDataPCIeTopologyChangeList_t *) fw_event->event_data;struct _pcie_device *pcie_device;
@@ -9444,22 +9490,22 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,if (ioc->shost_recovery || ioc->remove_host || ioc->pci_error_recovery) -return ; +return 0 ;if (fw_event->ignore) {dewtprintk (ioc,ioc_info (ioc,"ignoring switch event\n" )); -return ; +return 0 ; }/* handle siblings events */ -for (i =0 ; i < event_data->NumEntries; i++) { +for (i =0 , requeue_event =0 ; i < event_data->NumEntries; i++) {if (fw_event->ignore) {dewtprintk (ioc,ioc_info (ioc,"ignoring switch event\n" )); -return ; +return 0 ; }if (ioc->remove_host || ioc->pci_error_recovery) -return ; +return 0 ; reason_code = event_data->PortEntry[i].PortStatus; handle =le16_to_cpu (event_data->PortEntry[i].AttachedDevHandle);
@@ -9515,8 +9561,8 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, rc =_scsih_pcie_add_device (ioc, handle, fw_event->retries[i]);if (rc) {/* retry due to busy device */ - fw_event->retries[i]++; + requeue_event =1 ; }else {/* mark entry vacant */ /* TODO This needs to be reviewed and fixed,
@@ -9532,11 +9578,12 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,break ; } } +return requeue_event; }/** * _scsih_pcie_device_status_change_event_debug - debug for device event -* @ioc: ? +* @ioc: per adapter object * @event_data: event data payload * Context: user. */
@@ -11867,7 +11914,11 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)_scsih_turn_on_pfa_led (ioc, fw_event->device_handle);break ;case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST : -_scsih_sas_topology_change_event (ioc, fw_event); +if (_scsih_sas_topology_change_event (ioc, fw_event)) { +_scsih_fw_event_requeue (ioc, fw_event,1000 ); + ioc->current_event =NULL ; +return ; + }break ;case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE :if (ioc->logging_level &MPT_DEBUG_EVENT_WORK_TASK )
@@ -11907,7 +11958,11 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)_scsih_pcie_enumeration_event (ioc, fw_event);break ;case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST : -_scsih_pcie_topology_change_event (ioc, fw_event); +if (_scsih_pcie_topology_change_event (ioc, fw_event)) { +_scsih_fw_event_requeue (ioc, fw_event,1000 ); + ioc->current_event =NULL ; +return ; + }break ; } out:
@@ -11932,6 +11987,15 @@ _firmware_event_work(struct work_struct *work)_mpt3sas_fw_work (fw_event->ioc, fw_event); } +static void +_firmware_event_work_delayed (struct work_struct *work) +{ +struct fw_event_work *fw_event =container_of (work, + struct fw_event_work, delayed_work.work); + +_mpt3sas_fw_work (fw_event->ioc, fw_event); +} +/** * mpt3sas_scsih_event_callback - firmware event handler (called at ISR time) * @ioc: per adapter object
@@ -12112,6 +12176,34 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,return 1 ; } +if (event ==MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST ) { +Mpi2EventDataSasTopologyChangeList_t *topo_event_data = + (Mpi2EventDataSasTopologyChangeList_t *) + mpi_reply->EventData; + fw_event->retries =kzalloc (topo_event_data->NumEntries, +GFP_ATOMIC ); +if (!fw_event->retries) { + +ioc_err (ioc,"failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__); +kfree (fw_event->event_data); +fw_event_work_put (fw_event); +return 1 ; + } + } + +if (event ==MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST ) { +Mpi26EventDataPCIeTopologyChangeList_t *topo_event_data = + (Mpi26EventDataPCIeTopologyChangeList_t *) mpi_reply->EventData; + fw_event->retries =kzalloc (topo_event_data->NumEntries, +GFP_ATOMIC ); +if (!fw_event->retries) { + +ioc_err (ioc,"failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__); +fw_event_work_put (fw_event); +return 1 ; + } + } +memcpy (fw_event->event_data, mpi_reply->EventData, sz); fw_event->ioc = ioc; fw_event->VF_ID = mpi_reply->VF_ID;
Signature · 1 line
2.47.3
kernel test robot
build botRe: [PATCH v1 4/5] mpt3sas: Add firmware event requeue support for busy devices
kernel test robot noticed the following build warnings:
Hi Ranjan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.18-rc3 next-20251030] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpt3sas-Added-no_turs-flag-to-device-unblock-logic/20251030-025730 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next patch link: https://lore.kernel.org/r/20251029181058.39157-5-ranjan.kumar%40broadcom.com patch subject: [PATCH v1 4/5] mpt3sas: Add firmware event requeue support for busy devices config: i386-randconfig-054-20251030 (https://download.01.org/0day-ci/archive/20251031/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251031/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:276 struct member 'retries' not described in 'fw_event_work'
Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:276 struct member 'delayed_work_active' not described in 'fw_event_work'
Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:276 struct member 'delayed_work' not described in 'fw_event_work'
>> Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:3667 function parameter 'delay' not described in '_scsih_fw_event_requeue'
Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:3920 function parameter 'no_turs' not described in '_scsih_ublock_io_all_device'
Warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:3956 function parameter 'sas_address' not described in '_scsih_ublock_io_device_wait'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Ranjan Kumar
maintainerPATCH 5/5 mpt3sas: Add configurable command retry limit for slow-to-respond devices
In reply to Ranjan KumarAdds a new module parameter "command_retry_count" to control the number of retries during device discovery and readiness checks, improving reliability for slow or transient SAS/PCIe devices.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 84 ++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +78 -6
@@ -195,6 +195,11 @@ module_param(host_tagset_enable, int, 0444);MODULE_PARM_DESC (host_tagset_enable,"Shared host tagset enable/disable Default: enable(1)" ); +static int command_retry_count =144 ; +module_param (command_retry_count, int,0444 ); +MODULE_PARM_DESC (command_retry_count,"Device discovery TUR command retry\n" +"count: (default=144)" ); +/* raid transport support */ static struct raid_template *mpt3sas_raid_template;static struct raid_template *mpt2sas_raid_template;
@@ -3921,11 +3926,24 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc, u8 no_turs) {struct MPT3SAS_DEVICE *sas_device_priv_data;struct scsi_device *sdev; +struct MPT3SAS_TARGET *sas_target; +enum device_responsive_state rc; +struct _sas_device *sas_device =NULL ; +struct _pcie_device *pcie_device =NULL ; +int count =0 ; +u8 tr_method =0 ; +u8 tr_timeout =30 ; +shost_for_each_device (sdev, ioc->shost) { sas_device_priv_data = sdev->hostdata;if (!sas_device_priv_data)continue ; + + sas_target = sas_device_priv_data->sas_target; +if (!sas_target || sas_target->deleted) +continue ; +if (!sas_device_priv_data->block)continue ;
@@ -3936,10 +3954,62 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc, u8 no_turs)continue ; } -dewtprintk (ioc,sdev_printk (KERN_INFO , sdev, -"device_running, handle(0x%04x)\n" , - sas_device_priv_data->sas_target->handle)); +do { + pcie_device =mpt3sas_get_pdev_by_handle (ioc, sas_target->handle); +if (pcie_device && (!ioc->tm_custom_handling) && + (!(mpt3sas_scsih_is_pcie_scsi_device (pcie_device->device_info)))) { + tr_timeout = pcie_device->reset_timeout; + tr_method =MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE ; + } + rc =_scsih_wait_for_device_to_become_ready (ioc, + sas_target->handle,0 , (sas_target->flags & +MPT_TARGET_FLAGS_RAID_COMPONENT ), sdev->lun, tr_timeout, tr_method); +if (rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || + rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA ) +ssleep (1 ); +if (pcie_device) +pcie_device_put (pcie_device); + }while ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || + rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA ) + && count++ < command_retry_count); + sas_device_priv_data->block =0 ; +if (rc !=DEVICE_READY ) + sas_device_priv_data->deleted =1 ; +_scsih_internal_device_unblock (sdev, sas_device_priv_data); + +if (rc !=DEVICE_READY ) { +sdev_printk (KERN_WARNING , sdev,"%s: device_offlined,\n" +"handle(0x%04x)\n" , + __func__, sas_device_priv_data->sas_target->handle); +scsi_device_set_state (sdev,SDEV_OFFLINE ); + sas_device =mpt3sas_get_sdev_by_addr (ioc, + sas_device_priv_data->sas_target->sas_address, + sas_device_priv_data->sas_target->port); +if (sas_device) { +_scsih_display_enclosure_chassis_info (NULL , sas_device, sdev,NULL ); +sas_device_put (sas_device); + }else { + pcie_device =mpt3sas_get_pdev_by_wwid (ioc, + sas_device_priv_data->sas_target->sas_address); +if (pcie_device) { +if (pcie_device->enclosure_handle !=0 ) +sdev_printk (KERN_INFO , sdev,"enclosure logical id\n" +"(0x%016llx), slot(%d)\n" , (unsigned long long ) + pcie_device->enclosure_logical_id, + pcie_device->slot); +if (pcie_device->connector_name[0 ] !='\0' ) +sdev_printk (KERN_INFO , sdev,"enclosure level(0x%04x),\n" +" connector name( %s)\n" , + pcie_device->enclosure_level, + pcie_device->connector_name); +pcie_device_put (pcie_device); + } + } + }else +sdev_printk (KERN_WARNING , sdev,"device_unblocked,\n" +"handle(0x%04x)\n" , + sas_device_priv_data->sas_target->handle); } }
@@ -3964,6 +4034,7 @@ _scsih_ublock_io_device_wait(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,struct _pcie_device *pcie_device;u8 tr_timeout =30 ;u8 tr_method =0 ; +int count =0 ;/* moving devices from SDEV_OFFLINE to SDEV_BLOCK */ shost_for_each_device (sdev, ioc->shost) {
@@ -4030,7 +4101,8 @@ _scsih_ublock_io_device_wait(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,if (pcie_device)pcie_device_put (pcie_device); }while ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || - rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA )); + rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA ) + && count++ <= command_retry_count); sas_device_priv_data->block =0 ;if (rc !=DEVICE_READY )
@@ -7766,7 +7838,7 @@ _scsih_report_luns(struct MPT3SAS_ADAPTER *ioc, u16 handle, void *data,kfree (transfer_packet);if ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || - rc ==DEVICE_RETRY_UA )) + rc ==DEVICE_RETRY_UA ) && retry_count >= command_retry_count) rc =DEVICE_ERROR ;return rc;
@@ -8022,7 +8094,7 @@ _scsih_wait_for_device_to_become_ready(struct MPT3SAS_ADAPTER *ioc, u16 handle, }if ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || - rc ==DEVICE_RETRY_UA )) + rc ==DEVICE_RETRY_UA ) && retry_count >= command_retry_count) rc =DEVICE_ERROR ;return rc; }
Signature · 1 line
2.47.3