Skip to content

Commit e157102

Browse files
Merge patch series "smartpqi updates"
Don Brace <don.brace@microchip.com> says: These patches are based on Martin Petersen's 6.19/scsi-queue tree https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 6.19/scsi-queue This patch series includes four patches, with two main functional changes: 1. smartpqi-Add-timeout-value-to-RAID-path-requests-to-physical-devices Sets a timeout value for requests sent to physical devices via the RAID path. This prevents the controller firmware from waiting indefinitely and allows it to time out requests a few seconds before the OS issues Target Management Function (TMF) commands. The timeout value sent to the firmware is set to 3 seconds less than the OS timeout, which significantly reduces TMF invocations. 2. smartpqi-fix-Device-resources-accessed-after-device-removal Fixes a race condition during device removal by: * Checking for device removal in the reset handler and canceling any pending reset work if the device is no longer present. * Canceling outstanding TMF work items in the .sdev_destroy handler. Together, these changes eliminate races between reset operations and device removal. The other two patches: 3. smartpqi-add-new-Hurray-Data-pci-device Adds support for new Hurray Data PCI device. No functional changes. 4. smartpqi-update-driver-version-to-2.1.36-026 Updates the driver version string. No functional changes. Link: https://patch.msgid.link/20251106163823.786828-1-don.brace@microchip.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 02880c0 + 4cec99e commit e157102

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

drivers/scsi/smartpqi/smartpqi_init.c

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
#define BUILD_TIMESTAMP
3535
#endif
3636

37-
#define DRIVER_VERSION "2.1.34-035"
37+
#define DRIVER_VERSION "2.1.36-026"
3838
#define DRIVER_MAJOR 2
3939
#define DRIVER_MINOR 1
40-
#define DRIVER_RELEASE 34
41-
#define DRIVER_REVISION 35
40+
#define DRIVER_RELEASE 36
41+
#define DRIVER_REVISION 26
4242

4343
#define DRIVER_NAME "Microchip SmartPQI Driver (v" \
4444
DRIVER_VERSION BUILD_TIMESTAMP ")"
@@ -5555,14 +5555,25 @@ static void pqi_raid_io_complete(struct pqi_io_request *io_request,
55555555
pqi_scsi_done(scmd);
55565556
}
55575557

5558+
/*
5559+
* Adjust the timeout value for physical devices sent to the firmware
5560+
* by subtracting 3 seconds for timeouts greater than or equal to 8 seconds.
5561+
*
5562+
* This provides the firmware with additional time to attempt early recovery
5563+
* before the OS-level timeout occurs.
5564+
*/
5565+
#define ADJUST_SECS_TIMEOUT_VALUE(tv) (((tv) >= 8) ? ((tv) - 3) : (tv))
5566+
55585567
static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info,
55595568
struct pqi_scsi_dev *device, struct scsi_cmnd *scmd,
55605569
struct pqi_queue_group *queue_group, bool io_high_prio)
55615570
{
55625571
int rc;
5572+
u32 timeout;
55635573
size_t cdb_length;
55645574
struct pqi_io_request *io_request;
55655575
struct pqi_raid_path_request *request;
5576+
struct request *rq;
55665577

55675578
io_request = pqi_alloc_io_request(ctrl_info, scmd);
55685579
if (!io_request)
@@ -5634,6 +5645,12 @@ static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info,
56345645
return SCSI_MLQUEUE_HOST_BUSY;
56355646
}
56365647

5648+
if (device->is_physical_device) {
5649+
rq = scsi_cmd_to_rq(scmd);
5650+
timeout = rq->timeout / HZ;
5651+
put_unaligned_le32(ADJUST_SECS_TIMEOUT_VALUE(timeout), &request->timeout);
5652+
}
5653+
56375654
pqi_start_io(ctrl_info, queue_group, RAID_PATH, io_request);
56385655

56395656
return 0;
@@ -6410,10 +6427,22 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev
64106427

64116428
static int pqi_device_reset_handler(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev *device, u8 lun, struct scsi_cmnd *scmd, u8 scsi_opcode)
64126429
{
6430+
unsigned long flags;
64136431
int rc;
64146432

64156433
mutex_lock(&ctrl_info->lun_reset_mutex);
64166434

6435+
spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
6436+
if (pqi_find_scsi_dev(ctrl_info, device->bus, device->target, device->lun) == NULL) {
6437+
dev_warn(&ctrl_info->pci_dev->dev,
6438+
"skipping reset of scsi %d:%d:%d:%u, device has been removed\n",
6439+
ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun);
6440+
spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
6441+
mutex_unlock(&ctrl_info->lun_reset_mutex);
6442+
return 0;
6443+
}
6444+
spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
6445+
64176446
dev_err(&ctrl_info->pci_dev->dev,
64186447
"resetting scsi %d:%d:%d:%u SCSI cmd at %p due to cmd opcode 0x%02x\n",
64196448
ctrl_info->scsi_host->host_no, device->bus, device->target, lun, scmd, scsi_opcode);
@@ -6594,7 +6623,9 @@ static void pqi_sdev_destroy(struct scsi_device *sdev)
65946623
{
65956624
struct pqi_ctrl_info *ctrl_info;
65966625
struct pqi_scsi_dev *device;
6626+
struct pqi_tmf_work *tmf_work;
65976627
int mutex_acquired;
6628+
unsigned int lun;
65986629
unsigned long flags;
65996630

66006631
ctrl_info = shost_to_hba(sdev->host);
@@ -6621,8 +6652,13 @@ static void pqi_sdev_destroy(struct scsi_device *sdev)
66216652

66226653
mutex_unlock(&ctrl_info->scan_mutex);
66236654

6655+
for (lun = 0, tmf_work = device->tmf_work; lun < PQI_MAX_LUNS_PER_DEVICE; lun++, tmf_work++)
6656+
cancel_work_sync(&tmf_work->work_struct);
6657+
6658+
mutex_lock(&ctrl_info->lun_reset_mutex);
66246659
pqi_dev_info(ctrl_info, "removed", device);
66256660
pqi_free_device(device);
6661+
mutex_unlock(&ctrl_info->lun_reset_mutex);
66266662
}
66276663

66286664
static int pqi_getpciinfo_ioctl(struct pqi_ctrl_info *ctrl_info, void __user *arg)
@@ -10109,6 +10145,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {
1010910145
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
1011010146
0x207d, 0x4240)
1011110147
},
10148+
{
10149+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10150+
0x207d, 0x4840)
10151+
},
1011210152
{
1011310153
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
1011410154
PCI_VENDOR_ID_ADVANTECH, 0x8312)

0 commit comments

Comments
 (0)