* [PATCH 1/3] smartpqi: Add new controller PCI IDs
2023-12-19 19:36 [PATCH 0/3] smartpqi updates Don Brace
@ 2023-12-19 19:36 ` Don Brace
2023-12-19 19:36 ` [PATCH 2/3] smartpqi: fix logical volume rescan race condition Don Brace
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Don Brace @ 2023-12-19 19:36 UTC (permalink / raw)
To: don.brace, Kevin.Barnett, scott.teel, Justin.Lindley,
scott.benesh, gerry.morong, mahesh.rajashekhara, mike.mcgowen,
murthy.bhat, kumar.meiyappan, jeremy.reeves, david.strahan, hch,
jejb, joseph.szczypek, POSWALD
Cc: linux-scsi
From: David Strahan <david.strahan@microchip.com>
All PCI ID entries in Hex.
Add PCI IDs for Cisco controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
Cisco 24G TriMode M1 RAID 4GB FBWC 32D 9005 / 028f / 1137 / 02f8
Cisco 24G TriMode M1 RAID 4GB FBWC 16D 9005 / 028f / 1137 / 02f9
Cisco 24G TriMode M1 HBA 16D 9005 / 028f / 1137 / 02fa
Add PCI IDs for CloudNine controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
SmartRAID P7604N-16i 9005 / 028f / 1f51 / 100e
SmartRAID P7604N-8i 9005 / 028f / 1f51 / 100f
SmartRAID P7504N-16i 9005 / 028f / 1f51 / 1010
SmartRAID P7504N-8i 9005 / 028f / 1f51 / 1011
SmartRAID P7504N-8i 9005 / 028f / 1f51 / 1043
SmartHBA P6500-8i 9005 / 028f / 1f51 / 1044
SmartRAID P7504-8i 9005 / 028f / 1f51 / 1045
Reviewed-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@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 | 40 +++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 9a58df9312fa..d56201120087 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -10142,6 +10142,18 @@ static const struct pci_device_id pqi_pci_id_table[] = {
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
0x1014, 0x0718)
},
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1137, 0x02f8)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1137, 0x02f9)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1137, 0x02fa)
+ },
{
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
0x1e93, 0x1000)
@@ -10198,6 +10210,34 @@ static const struct pci_device_id pqi_pci_id_table[] = {
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
0x1f51, 0x100a)
},
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x100e)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x100f)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x1010)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x1011)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x1043)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x1044)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+ 0x1f51, 0x1045)
+ },
{
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
PCI_ANY_ID, PCI_ANY_ID)
--
2.43.0.76.g1a87c842ec
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] smartpqi: fix logical volume rescan race condition
2023-12-19 19:36 [PATCH 0/3] smartpqi updates Don Brace
2023-12-19 19:36 ` [PATCH 1/3] smartpqi: Add new controller PCI IDs Don Brace
@ 2023-12-19 19:36 ` Don Brace
2023-12-19 19:36 ` [PATCH 3/3] smartpqi: bump driver version to 2.1.26-030 Don Brace
2024-01-04 4:11 ` [PATCH 0/3] smartpqi updates Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Don Brace @ 2023-12-19 19:36 UTC (permalink / raw)
To: don.brace, Kevin.Barnett, scott.teel, Justin.Lindley,
scott.benesh, gerry.morong, mahesh.rajashekhara, mike.mcgowen,
murthy.bhat, kumar.meiyappan, jeremy.reeves, david.strahan, hch,
jejb, joseph.szczypek, POSWALD
Cc: linux-scsi
From: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Correct rescan flag race condition.
Multiple conditions are being evaluated before notifying OS
to do a rescan.
Driver will skip re-scanning the device if any one of the following
conditions are met:
- Devices that have not yet been added to the OS or devices
that have been removed.
- Devices which are already marked for removal or in the phase
of removal.
Under very rare conditions, after logical volume size expansion, the OS
still sees the size of the logical volume which was before expansion.
The rescan flag in the driver is used to signal the need for a logical
volume rescan. A race condition can occur in the driver, and it leads
to one thread overwriting the flag inadvertently. As a result, driver
is not notifying the OS SML to rescan the logical volume.
Move device->rescan update into new function
pqi_mark_volumes_for_rescan() and protect with a spin lock.
Move check for device->rescan into new function
pqi_volume_rescan_needed() and protect function call with
a spin_lock.
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Co-developed-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
drivers/scsi/smartpqi/smartpqi.h | 1 -
drivers/scsi/smartpqi/smartpqi_init.c | 43 ++++++++++++++++++++++-----
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index 041940183516..cdedc271857a 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -1347,7 +1347,6 @@ struct pqi_ctrl_info {
bool controller_online;
bool block_requests;
bool scan_blocked;
- u8 logical_volume_rescan_needed : 1;
u8 inbound_spanning_supported : 1;
u8 outbound_spanning_supported : 1;
u8 pqi_mode_enabled : 1;
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index d56201120087..081bb2c09806 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -2093,8 +2093,6 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
if (existing_device->devtype == TYPE_DISK) {
existing_device->raid_level = new_device->raid_level;
existing_device->volume_status = new_device->volume_status;
- if (ctrl_info->logical_volume_rescan_needed)
- existing_device->rescan = true;
memset(existing_device->next_bypass_group, 0, sizeof(existing_device->next_bypass_group));
if (!pqi_raid_maps_equal(existing_device->raid_map, new_device->raid_map)) {
kfree(existing_device->raid_map);
@@ -2164,6 +2162,20 @@ static inline void pqi_init_device_tmf_work(struct pqi_scsi_dev *device)
INIT_WORK(&tmf_work->work_struct, pqi_tmf_worker);
}
+static inline bool pqi_volume_rescan_needed(struct pqi_scsi_dev *device)
+{
+ if (pqi_device_in_remove(device))
+ return false;
+
+ if (device->sdev == NULL)
+ return false;
+
+ if (!scsi_device_online(device->sdev))
+ return false;
+
+ return device->rescan;
+}
+
static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
struct pqi_scsi_dev *new_device_list[], unsigned int num_new_devices)
{
@@ -2284,9 +2296,13 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
if (device->sdev && device->queue_depth != device->advertised_queue_depth) {
device->advertised_queue_depth = device->queue_depth;
scsi_change_queue_depth(device->sdev, device->advertised_queue_depth);
- if (device->rescan) {
- scsi_rescan_device(device->sdev);
+ spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
+ if (pqi_volume_rescan_needed(device)) {
device->rescan = false;
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
+ scsi_rescan_device(device->sdev);
+ } else {
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
}
}
}
@@ -2308,8 +2324,6 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
}
}
- ctrl_info->logical_volume_rescan_needed = false;
-
}
static inline bool pqi_is_supported_device(struct pqi_scsi_dev *device)
@@ -3702,6 +3716,21 @@ static bool pqi_ofa_process_event(struct pqi_ctrl_info *ctrl_info,
return ack_event;
}
+static void pqi_mark_volumes_for_rescan(struct pqi_ctrl_info *ctrl_info)
+{
+ unsigned long flags;
+ struct pqi_scsi_dev *device;
+
+ spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
+
+ list_for_each_entry(device, &ctrl_info->scsi_device_list, scsi_device_list_entry) {
+ if (pqi_is_logical_device(device) && device->devtype == TYPE_DISK)
+ device->rescan = true;
+ }
+
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
+}
+
static void pqi_disable_raid_bypass(struct pqi_ctrl_info *ctrl_info)
{
unsigned long flags;
@@ -3742,7 +3771,7 @@ static void pqi_event_worker(struct work_struct *work)
ack_event = true;
rescan_needed = true;
if (event->event_type == PQI_EVENT_TYPE_LOGICAL_DEVICE)
- ctrl_info->logical_volume_rescan_needed = true;
+ pqi_mark_volumes_for_rescan(ctrl_info);
else if (event->event_type == PQI_EVENT_TYPE_AIO_STATE_CHANGE)
pqi_disable_raid_bypass(ctrl_info);
}
--
2.43.0.76.g1a87c842ec
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] smartpqi: bump driver version to 2.1.26-030
2023-12-19 19:36 [PATCH 0/3] smartpqi updates Don Brace
2023-12-19 19:36 ` [PATCH 1/3] smartpqi: Add new controller PCI IDs Don Brace
2023-12-19 19:36 ` [PATCH 2/3] smartpqi: fix logical volume rescan race condition Don Brace
@ 2023-12-19 19:36 ` Don Brace
2024-01-04 4:11 ` [PATCH 0/3] smartpqi updates Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Don Brace @ 2023-12-19 19:36 UTC (permalink / raw)
To: don.brace, Kevin.Barnett, scott.teel, Justin.Lindley,
scott.benesh, gerry.morong, mahesh.rajashekhara, mike.mcgowen,
murthy.bhat, kumar.meiyappan, jeremy.reeves, david.strahan, hch,
jejb, joseph.szczypek, POSWALD
Cc: linux-scsi
Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Reviewed-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@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 081bb2c09806..ceff1ec13f9e 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -33,11 +33,11 @@
#define BUILD_TIMESTAMP
#endif
-#define DRIVER_VERSION "2.1.24-046"
+#define DRIVER_VERSION "2.1.26-030"
#define DRIVER_MAJOR 2
#define DRIVER_MINOR 1
-#define DRIVER_RELEASE 24
-#define DRIVER_REVISION 46
+#define DRIVER_RELEASE 26
+#define DRIVER_REVISION 30
#define DRIVER_NAME "Microchip SmartPQI Driver (v" \
DRIVER_VERSION BUILD_TIMESTAMP ")"
--
2.43.0.76.g1a87c842ec
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] smartpqi updates
2023-12-19 19:36 [PATCH 0/3] smartpqi updates Don Brace
` (2 preceding siblings ...)
2023-12-19 19:36 ` [PATCH 3/3] smartpqi: bump driver version to 2.1.26-030 Don Brace
@ 2024-01-04 4:11 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-01-04 4:11 UTC (permalink / raw)
To: Don Brace
Cc: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
kumar.meiyappan, jeremy.reeves, david.strahan, hch, jejb,
joseph.szczypek, POSWALD, linux-scsi
Don,
> The only functional change to smartpqi is correction of a race
> condition during a scan/rescan operation. The device->rescan flag can
> be updated by multiple threads causing issues.
Applied to 6.8/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread