* [PATCH 1/4] smartpqi: Add timeout value to RAID path requests to physical devices
2025-11-06 16:38 [PATCH 0/4] smartpqi updates Don Brace
@ 2025-11-06 16:38 ` Don Brace
2025-11-06 16:38 ` [PATCH 2/4] smartpqi: Fix device resources accessed after device removal Don Brace
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Don Brace @ 2025-11-06 16:38 UTC (permalink / raw)
To: don.brace, scott.teel, scott.benesh, gerry.morong,
mahesh.rajashekhara, mike.mcgowen, murthy.bhat, kumar.meiyappan,
jeremy.reeves, david.strahan, hch, James.Bottomley,
martin.petersen, joseph.szczypek, POSWALD, cameron.cumberland,
Yi Zhang
Cc: linux-scsi
From: Mike McGowen <Mike.McGowen@microchip.com>
Add a timeout value to requests sent to physical devices via the RAID path.
A timeout value of zero means wait indefinitely, which may cause the OS to
issue Target Management Function (TMF) commands if the device does not
respond.
For input timeouts of 8 seconds or greater, the value sent to firmware
is reduced by 3 seconds to provide an earlier firmware timeout and allow
the OS additional time before timing out.
This change improves timeout handling between the driver, firmware,
and OS, helping to better manage device responsiveness and avoid
indefinite waits.
Reviewed-by: David Strahan <david.strahan@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Mike McGowen <Mike.McGowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
drivers/scsi/smartpqi/smartpqi_init.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b5e71ff26e8e..f5fb262e9c03 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -5555,14 +5555,25 @@ static void pqi_raid_io_complete(struct pqi_io_request *io_request,
pqi_scsi_done(scmd);
}
+/*
+ * Adjust the timeout value for physical devices sent to the firmware
+ * by subtracting 3 seconds for timeouts greater than or equal to 8 seconds.
+ *
+ * This provides the firmware with additional time to attempt early recovery
+ * before the OS-level timeout occurs.
+ */
+#define ADJUST_SECS_TIMEOUT_VALUE(tv) (((tv) >= 8) ? ((tv) - 3) : (tv))
+
static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info,
struct pqi_scsi_dev *device, struct scsi_cmnd *scmd,
struct pqi_queue_group *queue_group, bool io_high_prio)
{
int rc;
+ u32 timeout;
size_t cdb_length;
struct pqi_io_request *io_request;
struct pqi_raid_path_request *request;
+ struct request *rq;
io_request = pqi_alloc_io_request(ctrl_info, scmd);
if (!io_request)
@@ -5634,6 +5645,12 @@ static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info,
return SCSI_MLQUEUE_HOST_BUSY;
}
+ if (device->is_physical_device) {
+ rq = scsi_cmd_to_rq(scmd);
+ timeout = rq->timeout / HZ;
+ put_unaligned_le32(ADJUST_SECS_TIMEOUT_VALUE(timeout), &request->timeout);
+ }
+
pqi_start_io(ctrl_info, queue_group, RAID_PATH, io_request);
return 0;
--
2.52.0.rc0.28.g4cf919bd7b
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] smartpqi: Fix device resources accessed after device removal
2025-11-06 16:38 [PATCH 0/4] smartpqi updates Don Brace
2025-11-06 16:38 ` [PATCH 1/4] smartpqi: Add timeout value to RAID path requests to physical devices Don Brace
@ 2025-11-06 16:38 ` Don Brace
2025-11-06 16:38 ` [PATCH 3/4] smartpqi: add support for Hurray Data new controller PCI device Don Brace
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Don Brace @ 2025-11-06 16:38 UTC (permalink / raw)
To: don.brace, scott.teel, scott.benesh, gerry.morong,
mahesh.rajashekhara, mike.mcgowen, murthy.bhat, kumar.meiyappan,
jeremy.reeves, david.strahan, hch, James.Bottomley,
martin.petersen, joseph.szczypek, POSWALD, cameron.cumberland,
Yi Zhang
Cc: linux-scsi
From: Mike McGowen <mike.mcgowen@microchip.com>
Correct possible race conditions during device removal.
Previously, a scheduled work item to reset a LUN could still execute after
the device was removed, leading to use-after-free and other resource
access issues.
This race condition occurs because the abort handler may schedule a LUN
reset concurrently with device removal via sdev_destroy(), leading to
use-after-free and improper access to freed resources.
This patch:
- Checks in the device reset handler if the device is still present in
the controller's SCSI device list before running; if not, the reset
is skipped.
- Cancels any pending TMF work that has not started in sdev_destroy().
- Ensures device freeing in sdev_destroy() is done while holding the LUN
reset mutex to avoid races with ongoing resets.
Fixes: 2d80f4054f7f ("scsi: smartpqi: Update deleting a LUN via sysfs")
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Signed-off-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
drivers/scsi/smartpqi/smartpqi_init.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index f5fb262e9c03..8c4ea4dc5803 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6427,10 +6427,22 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev
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)
{
+ unsigned long flags;
int rc;
mutex_lock(&ctrl_info->lun_reset_mutex);
+ spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
+ if (pqi_find_scsi_dev(ctrl_info, device->bus, device->target, device->lun) == NULL) {
+ dev_warn(&ctrl_info->pci_dev->dev,
+ "skipping reset of scsi %d:%d:%d:%u, device has been removed\n",
+ ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun);
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
+ mutex_unlock(&ctrl_info->lun_reset_mutex);
+ return 0;
+ }
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
+
dev_err(&ctrl_info->pci_dev->dev,
"resetting scsi %d:%d:%d:%u SCSI cmd at %p due to cmd opcode 0x%02x\n",
ctrl_info->scsi_host->host_no, device->bus, device->target, lun, scmd, scsi_opcode);
@@ -6611,7 +6623,9 @@ static void pqi_sdev_destroy(struct scsi_device *sdev)
{
struct pqi_ctrl_info *ctrl_info;
struct pqi_scsi_dev *device;
+ struct pqi_tmf_work *tmf_work;
int mutex_acquired;
+ unsigned int lun;
unsigned long flags;
ctrl_info = shost_to_hba(sdev->host);
@@ -6638,8 +6652,13 @@ static void pqi_sdev_destroy(struct scsi_device *sdev)
mutex_unlock(&ctrl_info->scan_mutex);
+ for (lun = 0, tmf_work = device->tmf_work; lun < PQI_MAX_LUNS_PER_DEVICE; lun++, tmf_work++)
+ cancel_work_sync(&tmf_work->work_struct);
+
+ mutex_lock(&ctrl_info->lun_reset_mutex);
pqi_dev_info(ctrl_info, "removed", device);
pqi_free_device(device);
+ mutex_unlock(&ctrl_info->lun_reset_mutex);
}
static int pqi_getpciinfo_ioctl(struct pqi_ctrl_info *ctrl_info, void __user *arg)
--
2.52.0.rc0.28.g4cf919bd7b
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] smartpqi: add support for Hurray Data new controller PCI device
2025-11-06 16:38 [PATCH 0/4] smartpqi updates Don Brace
2025-11-06 16:38 ` [PATCH 1/4] smartpqi: Add timeout value to RAID path requests to physical devices Don Brace
2025-11-06 16:38 ` [PATCH 2/4] smartpqi: Fix device resources accessed after device removal Don Brace
@ 2025-11-06 16:38 ` Don Brace
2025-11-06 16:38 ` [PATCH 4/4] smartpqi: update version to 2.1.36-026 Don Brace
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Don Brace @ 2025-11-06 16:38 UTC (permalink / raw)
To: don.brace, scott.teel, scott.benesh, gerry.morong,
mahesh.rajashekhara, mike.mcgowen, murthy.bhat, kumar.meiyappan,
jeremy.reeves, david.strahan, hch, James.Bottomley,
martin.petersen, joseph.szczypek, POSWALD, cameron.cumberland,
Yi Zhang
Cc: linux-scsi
From: David Strahan <David.Strahan@microchip.com>
Add support for new Hurray Data controller.
All entries are in HEX.
Add PCI IDs for Hurray Data controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
9005 028f 207d 4840
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: David Strahan <David.Strahan@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
drivers/scsi/smartpqi/smartpqi_init.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 8c4ea4dc5803..3886559a5eaa 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -10145,6 +10145,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
0x207d, 0x4240)
},
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x207d, 0x4840)
+ },
{
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
PCI_VENDOR_ID_ADVANTECH, 0x8312)
--
2.52.0.rc0.28.g4cf919bd7b
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] smartpqi: update version to 2.1.36-026
2025-11-06 16:38 [PATCH 0/4] smartpqi updates Don Brace
` (2 preceding siblings ...)
2025-11-06 16:38 ` [PATCH 3/4] smartpqi: add support for Hurray Data new controller PCI device Don Brace
@ 2025-11-06 16:38 ` Don Brace
2025-11-08 18:09 ` [PATCH 0/4] smartpqi updates Martin K. Petersen
2025-11-13 2:46 ` Martin K. Petersen
5 siblings, 0 replies; 7+ messages in thread
From: Don Brace @ 2025-11-06 16:38 UTC (permalink / raw)
To: don.brace, scott.teel, scott.benesh, gerry.morong,
mahesh.rajashekhara, mike.mcgowen, murthy.bhat, kumar.meiyappan,
jeremy.reeves, david.strahan, hch, James.Bottomley,
martin.petersen, joseph.szczypek, POSWALD, cameron.cumberland,
Yi Zhang
Cc: linux-scsi
Update driver version to 2.1.36-026
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Gerry Morong <gerry.morong@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
drivers/scsi/smartpqi/smartpqi_init.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 3886559a5eaa..fe549e2b7c94 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -34,11 +34,11 @@
#define BUILD_TIMESTAMP
#endif
-#define DRIVER_VERSION "2.1.34-035"
+#define DRIVER_VERSION "2.1.36-026"
#define DRIVER_MAJOR 2
#define DRIVER_MINOR 1
-#define DRIVER_RELEASE 34
-#define DRIVER_REVISION 35
+#define DRIVER_RELEASE 36
+#define DRIVER_REVISION 26
#define DRIVER_NAME "Microchip SmartPQI Driver (v" \
DRIVER_VERSION BUILD_TIMESTAMP ")"
--
2.52.0.rc0.28.g4cf919bd7b
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] smartpqi updates
2025-11-06 16:38 [PATCH 0/4] smartpqi updates Don Brace
` (3 preceding siblings ...)
2025-11-06 16:38 ` [PATCH 4/4] smartpqi: update version to 2.1.36-026 Don Brace
@ 2025-11-08 18:09 ` Martin K. Petersen
2025-11-13 2:46 ` Martin K. Petersen
5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2025-11-08 18:09 UTC (permalink / raw)
To: Don Brace
Cc: scott.teel, scott.benesh, gerry.morong, mahesh.rajashekhara,
mike.mcgowen, murthy.bhat, kumar.meiyappan, jeremy.reeves,
david.strahan, hch, James.Bottomley, martin.petersen,
joseph.szczypek, POSWALD, cameron.cumberland, Yi Zhang,
linux-scsi
Don,
> David Strahan (1):
> smartpqi: add support for Hurray Data new controller PCI device
>
> Don Brace (1):
> smartpqi: update version to 2.1.36-026
>
> Mike McGowen (2):
> smartpqi: Add timeout value to RAID path requests to physical devices
> smartpqi: Fix device resources accessed after device removal
Applied to 6.19/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] smartpqi updates
2025-11-06 16:38 [PATCH 0/4] smartpqi updates Don Brace
` (4 preceding siblings ...)
2025-11-08 18:09 ` [PATCH 0/4] smartpqi updates Martin K. Petersen
@ 2025-11-13 2:46 ` Martin K. Petersen
5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2025-11-13 2:46 UTC (permalink / raw)
To: scott.teel, scott.benesh, gerry.morong, mahesh.rajashekhara,
mike.mcgowen, murthy.bhat, kumar.meiyappan, jeremy.reeves,
david.strahan, hch, James.Bottomley, joseph.szczypek, POSWALD,
cameron.cumberland, Yi Zhang, Don Brace
Cc: Martin K . Petersen, linux-scsi
On Thu, 06 Nov 2025 10:38:18 -0600, Don Brace wrote:
> 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
>
> [...]
Applied to 6.19/scsi-queue, thanks!
[1/4] smartpqi: Add timeout value to RAID path requests to physical devices
https://git.kernel.org/mkp/scsi/c/f3ecbba1aa71
[2/4] smartpqi: Fix device resources accessed after device removal
https://git.kernel.org/mkp/scsi/c/b518e86d1a70
[3/4] smartpqi: add support for Hurray Data new controller PCI device
https://git.kernel.org/mkp/scsi/c/48e6b7e70802
[4/4] smartpqi: update version to 2.1.36-026
https://git.kernel.org/mkp/scsi/c/4cec99e83d92
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 7+ messages in thread