Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+43 -3
+43 -3
drivers/scsi/smartpqi/smartpqi_init.c
··· 34 34 #define BUILD_TIMESTAMP 35 35 #endif 36 36 37 - #define DRIVER_VERSION "2.1.34-035" 37 + #define DRIVER_VERSION "2.1.36-026" 38 38 #define DRIVER_MAJOR 2 39 39 #define DRIVER_MINOR 1 40 - #define DRIVER_RELEASE 34 41 - #define DRIVER_REVISION 35 40 + #define DRIVER_RELEASE 36 41 + #define DRIVER_REVISION 26 42 42 43 43 #define DRIVER_NAME "Microchip SmartPQI Driver (v" \ 44 44 DRIVER_VERSION BUILD_TIMESTAMP ")" ··· 5555 5555 pqi_scsi_done(scmd); 5556 5556 } 5557 5557 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 + 5558 5567 static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info, 5559 5568 struct pqi_scsi_dev *device, struct scsi_cmnd *scmd, 5560 5569 struct pqi_queue_group *queue_group, bool io_high_prio) 5561 5570 { 5562 5571 int rc; 5572 + u32 timeout; 5563 5573 size_t cdb_length; 5564 5574 struct pqi_io_request *io_request; 5565 5575 struct pqi_raid_path_request *request; 5576 + struct request *rq; 5566 5577 5567 5578 io_request = pqi_alloc_io_request(ctrl_info, scmd); 5568 5579 if (!io_request) ··· 5643 5632 if (rc) { 5644 5633 pqi_free_io_request(io_request); 5645 5634 return SCSI_MLQUEUE_HOST_BUSY; 5635 + } 5636 + 5637 + if (device->is_physical_device) { 5638 + rq = scsi_cmd_to_rq(scmd); 5639 + timeout = rq->timeout / HZ; 5640 + put_unaligned_le32(ADJUST_SECS_TIMEOUT_VALUE(timeout), &request->timeout); 5646 5641 } 5647 5642 5648 5643 pqi_start_io(ctrl_info, queue_group, RAID_PATH, io_request); ··· 6427 6410 6428 6411 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) 6429 6412 { 6413 + unsigned long flags; 6430 6414 int rc; 6431 6415 6432 6416 mutex_lock(&ctrl_info->lun_reset_mutex); 6417 + 6418 + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); 6419 + if (pqi_find_scsi_dev(ctrl_info, device->bus, device->target, device->lun) == NULL) { 6420 + dev_warn(&ctrl_info->pci_dev->dev, 6421 + "skipping reset of scsi %d:%d:%d:%u, device has been removed\n", 6422 + ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); 6423 + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 6424 + mutex_unlock(&ctrl_info->lun_reset_mutex); 6425 + return 0; 6426 + } 6427 + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 6433 6428 6434 6429 dev_err(&ctrl_info->pci_dev->dev, 6435 6430 "resetting scsi %d:%d:%d:%u SCSI cmd at %p due to cmd opcode 0x%02x\n", ··· 6623 6594 { 6624 6595 struct pqi_ctrl_info *ctrl_info; 6625 6596 struct pqi_scsi_dev *device; 6597 + struct pqi_tmf_work *tmf_work; 6626 6598 int mutex_acquired; 6599 + unsigned int lun; 6627 6600 unsigned long flags; 6628 6601 6629 6602 ctrl_info = shost_to_hba(sdev->host); ··· 6652 6621 6653 6622 mutex_unlock(&ctrl_info->scan_mutex); 6654 6623 6624 + for (lun = 0, tmf_work = device->tmf_work; lun < PQI_MAX_LUNS_PER_DEVICE; lun++, tmf_work++) 6625 + cancel_work_sync(&tmf_work->work_struct); 6626 + 6627 + mutex_lock(&ctrl_info->lun_reset_mutex); 6655 6628 pqi_dev_info(ctrl_info, "removed", device); 6656 6629 pqi_free_device(device); 6630 + mutex_unlock(&ctrl_info->lun_reset_mutex); 6657 6631 } 6658 6632 6659 6633 static int pqi_getpciinfo_ioctl(struct pqi_ctrl_info *ctrl_info, void __user *arg) ··· 10144 10108 { 10145 10109 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10146 10110 0x207d, 0x4240) 10111 + }, 10112 + { 10113 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10114 + 0x207d, 0x4840) 10147 10115 }, 10148 10116 { 10149 10117 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,