hpsa updates
Subsystems (2)
cover hpsa updates
These patches are based on Linus's tree
The changes are:
- Static checker issues reported by Dan Carpenter
- double unlock of a mutex
- correct decode sense data decision
- warnings on hpsa_init_one cleanup
- Update PMC copyright
- Cleanup update scsi devices
- New controller ids.
- Correct rmmod issue
- Add in new path_info to show box and bay info
- Driver supports mixed mode, RAID and HBA
- New offline mode
- Bug fix for multi lun devices from Shane Seymour
---
Don Brace (7):
hpsa: Correct double unlock of mutex
hpsa: correct decode sense data
hpsa: correct static checker warnings on driver init cleanup
hpsa: add PMC to copyright
hpsa: cleanup update scsi devices
hpsa: add in new controllers
hpsa: fix rmmod issues
Joe Handzik (1):
hpsa: add sysfs entry path_info to show box and bay information
Kevin Barnett (1):
Change how controllers in mixed mode are handled.
Scott Benesh (1):
hpsa: add in new offline mode
shane.seymour (1):
hpsa: fix issues with multilun devices
drivers/scsi/hpsa.c | 286 +++++++++++++++++++++++++++++------------------ drivers/scsi/hpsa.h | 16 +-- drivers/scsi/hpsa_cmd.h | 10 +- 3 files changed, 188 insertions(+), 124 deletions(-)
--
Signature
PATCH 1/11 hpsa: Correct double unlock of mutex
--- drivers/scsi/hpsa.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/scsi/hpsa.c +4 -5
@@ -2749,11 +2749,10 @@ static int hpsa_do_reset(struct ctlr_info *h, struct hpsa_scsi_dev_t *dev, lockup_detected(h));if (unlikely (lockup_detected (h))) { -dev_warn (&h->pdev->dev, -"Controller lockup detected during reset wait\n" ); -mutex_unlock (&h->reset_mutex); - rc = -ENODEV ; - } +dev_warn (&h->pdev->dev, +"Controller lockup detected during reset wait\n" ); + rc = -ENODEV ; + }if (unlikely (rc))atomic_set (&dev->reset_cmds_out,0 );
Re: [PATCH 01/11] hpsa: Correct double unlock of mutex
Quoted 4 lines · Don Brace
Reported-by Dan Carpenter <[email protected]>Reviewed-by Scott Teel <[email protected]>Reviewed-by Kevin Barnett <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 30 lines
--- drivers/scsi/hpsa.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/scsi/hpsa.c +4
-6@@ -2749,11 +2749,10 @@ static int hpsa_do_reset(struct ctlr_info *h, struct hpsa_scsi_dev_t *dev, lockup_detected(h));if (unlikely (lockup_detected (h))) { -dev_warn (&h->pdev->dev, -"Controller lockup detected during reset wait\n" ); -mutex_unlock (&h->reset_mutex); - rc = -ENODEV ; - } +dev_warn (&h->pdev->dev, +"Controller lockup detected during reset wait\n" ); + rc = -ENODEV ; + }if (unlikely (rc))atomic_set (&dev->reset_cmds_out,0 ); --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/11 hpsa: correct decode sense data
In reply to Don Brace--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -325,7 +325,7 @@ static int check_for_unit_attention(struct ctlr_info *h,decode_sense_data (c->err_info->SenseInfo, sense_len, &sense_key, &asc, &ascq); -if (sense_key !=UNIT_ATTENTION || asc ==-1 ) +if (sense_key !=UNIT_ATTENTION || asc ==0xff )return 0 ;switch (asc) {
Re: [PATCH 02/11] hpsa: correct decode sense data
Quoted 4 lines · Don Brace
Reported-by Dan Carpenter <[email protected]>Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 23 lines
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/hpsa.c +1
-2@@ -325,7 +325,7 @@ static int check_for_unit_attention(struct ctlr_info *h,decode_sense_data (c->err_info->SenseInfo, sense_len, &sense_key, &asc, &ascq); -if (sense_key !=UNIT_ATTENTION || asc ==-1 ) +if (sense_key !=UNIT_ATTENTION || asc ==0xff )return 0 ;switch (asc) { --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/11 hpsa: correct static checker warnings on driver init cleanup
In reply to Don Brace--- drivers/scsi/hpsa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/hpsa.c +1 -3
@@ -8053,7 +8053,7 @@ reinit_after_soft_reset: rc =hpsa_kdump_soft_reset (h);if (rc)/* Neither hard nor soft reset worked, we're hosed. */ - goto clean9; + goto clean7;dev_info (&h->pdev->dev,"Board READY.\n" ); dev_info(&h->pdev->dev,
@@ -8099,8 +8099,6 @@ reinit_after_soft_reset: h->heartbeat_sample_interval);return 0 ; -clean9:/* wq, sh, perf, sg, cmd, irq, shost, pci, lu, aer/h */ -kfree (h->hba_inquiry_data); clean7:/* perf, sg, cmd, irq, shost, pci, lu, aer/h */ hpsa_free_performant_mode (h); h->access.set_intr_mask (h,HPSA_INTR_OFF );
Re: [PATCH 03/11] hpsa: correct static checker warnings on driver init cleanup
Quoted 4 lines · Don Brace
Reported-by Dan Carpenter <[email protected]>Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 32 lines
--- drivers/scsi/hpsa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/scsi/hpsa.c +1
-4@@ -8053,7 +8053,7 @@ reinit_after_soft_reset: rc =hpsa_kdump_soft_reset (h);if (rc)/* Neither hard nor soft reset worked, we're hosed. */ - goto clean9; + goto clean7;dev_info (&h->pdev->dev,"Board READY.\n" ); dev_info(&h->pdev->dev,@@ -8099,8 +8099,6 @@ reinit_after_soft_reset: h->heartbeat_sample_interval);return 0 ; -clean9:/* wq, sh, perf, sg, cmd, irq, shost, pci, lu, aer/h */ -kfree (h->hba_inquiry_data); clean7:/* perf, sg, cmd, irq, shost, pci, lu, aer/h */ hpsa_free_performant_mode (h); h->access.set_intr_mask (h,HPSA_INTR_OFF ); --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/11 hpsa: add PMC to copyright
In reply to Don Braceneed to add PMC to copyright notice and update the Hewlett-Packard copyright notification.
--- drivers/scsi/hpsa.c | 9 +++------ drivers/scsi/hpsa.h | 9 +++------ drivers/scsi/hpsa_cmd.h | 9 +++------ 3 files changed, 9 insertions(+), 18 deletions(-)
drivers/scsi/hpsa.c +3 -6
@@ -1,6 +1,7 @@/* * Disk Array driver for HP Smart Array SAS controllers -* Copyright 2000, 2014 Hewlett-Packard Development Company, L.P. +* Copyright 2014-2015 PMC-Sierra, Inc. +* Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -11,11 +12,7 @@* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* -* Questions/Comments/Bugfixes to [email protected] +* Questions/Comments/Bugfixes to [email protected] * */
drivers/scsi/hpsa.h +3 -6
@@ -1,6 +1,7 @@/* * Disk Array driver for HP Smart Array SAS controllers -* Copyright 2000, 2014 Hewlett-Packard Development Company, L.P. +* Copyright 2014-2015 PMC-Sierra, Inc. +* Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -11,11 +12,7 @@* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* -* Questions/Comments/Bugfixes to [email protected] +* Questions/Comments/Bugfixes to [email protected] * */ #ifndef HPSA_H
drivers/scsi/hpsa_cmd.h +3 -6
@@ -1,6 +1,7 @@/* * Disk Array driver for HP Smart Array SAS controllers -* Copyright 2000, 2014 Hewlett-Packard Development Company, L.P. +* Copyright 2014-2015 PMC-Sierra, Inc. +* Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -11,11 +12,7 @@* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* -* Questions/Comments/Bugfixes to [email protected] +* Questions/Comments/Bugfixes to [email protected] * */ #ifndef HPSA_CMD_H
PATCH 5/11 hpsa: add sysfs entry path_info to show box and bay information
In reply to Don BraceFrom: Joe Handzik <[email protected]>
host no, bus, target, lun, scsi_device_type for hba mode add: box and bay information
report if the path is active/inactive
--- drivers/scsi/hpsa.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/hpsa.h | 5 ++ 2 files changed, 127 insertions(+)
drivers/scsi/hpsa.c +122 -0
@@ -264,6 +264,7 @@ static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h,static void hpsa_command_resubmit_worker (struct work_struct *work);static u32 lockup_detected (struct ctlr_info *h);static int detect_controller_lockup (struct ctlr_info *h); +static int is_ext_target (struct ctlr_info *h,struct hpsa_scsi_dev_t *device);static inline struct ctlr_info *sdev_to_hba (struct scsi_device *sdev) {
@@ -714,12 +715,106 @@ static ssize_t host_show_hp_ssd_smart_path_enabled(struct device *dev,return snprintf (buf,20 ,"%d\n" , offload_enabled); } +#define MAX_PATHS 8 +#define PATH_STRING_LEN 50 + +static ssize_t path_info_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct ctlr_info *h; +struct scsi_device *sdev; +struct hpsa_scsi_dev_t *hdev; +unsigned long flags; +int i; +int output_len =0 ; +u8 box; +u8 bay; +u8 path_map_index =0 ; +char *active; +unsigned char phys_connector[2 ]; +unsigned char path[MAX_PATHS ][PATH_STRING_LEN ]; + +memset (path,0 ,MAX_PATHS *PATH_STRING_LEN ); + sdev =to_scsi_device (dev); + h =sdev_to_hba (sdev); +spin_lock_irqsave (&h->devlock, flags); + hdev = sdev->hostdata; +if (!hdev) { +spin_unlock_irqrestore (&h->devlock, flags); +return -ENODEV ; + } + + bay = hdev->bay; +for (i =0 ; i <MAX_PATHS ; i++) { + path_map_index =1 <<i; +if (i == hdev->active_path_index) + active ="Active" ; +else if (hdev->path_map & path_map_index) + active ="Inactive" ; +else +continue ; + + output_len =snprintf (path[i], +PATH_STRING_LEN ,"[%d:%d:%d:%d] %20.20s " , + h->scsi_host->host_no, + hdev->bus, hdev->target, hdev->lun, +scsi_device_type (hdev->devtype)); + +if (is_ext_target (h, hdev) || + (hdev->devtype ==TYPE_RAID ) || +is_logical_dev_addr_mode (hdev->scsi3addr)) { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN ,"%s\n" , + active); +continue ; + } + + box = hdev->box[i]; +memcpy (&phys_connector, &hdev->phys_connector[i], +sizeof (phys_connector)); +if (phys_connector[0 ] <'0' ) + phys_connector[0 ] ='0' ; +if (phys_connector[1 ] <'0' ) + phys_connector[1 ] ='0' ; +if (hdev->phys_connector[i] >0 ) + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN , +"PORT: %.2s " , + phys_connector); +if (hdev->devtype ==TYPE_DISK && h->hba_mode_enabled) { +if (box ==0 || box ==0xFF ) { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN , +"BAY: %hhu %s\n" , + bay, active); + }else { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN , +"BOX: %hhu BAY: %hhu %s\n" , + box, bay, active); + } + }else if (box !=0 && box !=0xFF ) { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN ,"BOX: %hhu %s\n" , + box, active); + }else + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN ,"%s\n" , active); + } + +spin_unlock_irqrestore (&h->devlock, flags); +return snprintf (buf, output_len+1 ,"%s%s%s%s%s%s%s%s" , + path[0 ], path[1 ], path[2 ], path[3 ], + path[4 ], path[5 ], path[6 ], path[7 ]); +} + static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL); static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO, host_show_hp_ssd_smart_path_enabled, NULL); +static DEVICE_ATTR(path_info, S_IRUGO, path_info_show, NULL); static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH, host_show_hp_ssd_smart_path_status, host_store_hp_ssd_smart_path_status);
@@ -741,6 +836,7 @@ static struct device_attribute *hpsa_sdev_attrs[] = { &dev_attr_lunid, &dev_attr_unique_id, &dev_attr_hp_ssd_smart_path_enabled, + &dev_attr_path_info, &dev_attr_lockup_detected, NULL, };
@@ -3611,6 +3707,31 @@ static void hpsa_get_ioaccel_drive_info(struct ctlr_info *h,atomic_set (&dev->reset_cmds_out,0 ); } +static void hpsa_get_path_info (struct hpsa_scsi_dev_t *this_device, +u8 *lunaddrbytes, +struct bmic_identify_physical_device *id_phys) +{ +if (PHYS_IOACCEL (lunaddrbytes) + && this_device->ioaccel_handle) + this_device->hba_ioaccel_enabled =1 ; + +memcpy (&this_device->active_path_index, + &id_phys->active_path_number, +sizeof (this_device->active_path_index)); +memcpy (&this_device->path_map, + &id_phys->redundant_path_present_map, +sizeof (this_device->path_map)); +memcpy (&this_device->box, + &id_phys->alternate_paths_phys_box_on_port, +sizeof (this_device->box)); +memcpy (&this_device->phys_connector, + &id_phys->alternate_paths_phys_connector, +sizeof (this_device->phys_connector)); +memcpy (&this_device->bay, + &id_phys->phys_bay_in_box, +sizeof (this_device->bay)); +} +static void hpsa_update_scsi_devices (struct ctlr_info *h,int hostno) {/* the idea here is we could get notified
@@ -3771,6 +3892,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)hpsa_get_ioaccel_drive_info (h, this_device, lunaddrbytes, id_phys); +hpsa_get_path_info (this_device, lunaddrbytes, id_phys);atomic_set (&this_device->ioaccel_cmds_out,0 ); ncurrent++;break ;
drivers/scsi/hpsa.h +5 -0
@@ -50,6 +50,11 @@ struct hpsa_scsi_dev_t {* device via "ioaccel" path. */ u32 ioaccel_handle; +u8 active_path_index; +u8 path_map; +u8 bay; +u8 box[8 ]; +u16 phys_connector[8 ];int offload_config;/* I/O accel RAID offload configured */ int offload_enabled;/* I/O accel RAID offload enabled */ int offload_to_be_enabled;
Re: [PATCH 05/11] hpsa: add sysfs entry path_info to show box and bay information
Quoted 10 lines · Don Brace
From: Joe Handzik <[email protected]>
host no, bus, target, lun,
scsi_device_type
for hba mode add: box and bay informationreport if the path is active/inactive
Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 194 lines
--- drivers/scsi/hpsa.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/hpsa.h | 5 ++ 2 files changed, 127 insertions(+)drivers/scsi/hpsa.c +122
-0@@ -264,6 +264,7 @@ static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h,static void hpsa_command_resubmit_worker (struct work_struct *work);static u32 lockup_detected (struct ctlr_info *h);static int detect_controller_lockup (struct ctlr_info *h); +static int is_ext_target (struct ctlr_info *h,struct hpsa_scsi_dev_t *device);static inline struct ctlr_info *sdev_to_hba (struct scsi_device *sdev) {@@ -714,12 +715,106 @@ static ssize_t host_show_hp_ssd_smart_path_enabled(struct device *dev,return snprintf (buf,20 ,"%d\n" , offload_enabled); } +#define MAX_PATHS 8 +#define PATH_STRING_LEN 50 + +static ssize_t path_info_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct ctlr_info *h; +struct scsi_device *sdev; +struct hpsa_scsi_dev_t *hdev; +unsigned long flags; +int i; +int output_len =0 ; +u8 box; +u8 bay; +u8 path_map_index =0 ; +char *active; +unsigned char phys_connector[2 ]; +unsigned char path[MAX_PATHS ][PATH_STRING_LEN ]; + +memset (path,0 ,MAX_PATHS *PATH_STRING_LEN ); + sdev =to_scsi_device (dev); + h =sdev_to_hba (sdev); +spin_lock_irqsave (&h->devlock, flags); + hdev = sdev->hostdata; +if (!hdev) { +spin_unlock_irqrestore (&h->devlock, flags); +return -ENODEV ; + } + + bay = hdev->bay; +for (i =0 ; i <MAX_PATHS ; i++) { + path_map_index =1 <<i; +if (i == hdev->active_path_index) + active ="Active" ; +else if (hdev->path_map & path_map_index) + active ="Inactive" ; +else +continue ; + + output_len =snprintf (path[i], +PATH_STRING_LEN ,"[%d:%d:%d:%d] %20.20s " , + h->scsi_host->host_no, + hdev->bus, hdev->target, hdev->lun, +scsi_device_type (hdev->devtype)); + +if (is_ext_target (h, hdev) || + (hdev->devtype ==TYPE_RAID ) || +is_logical_dev_addr_mode (hdev->scsi3addr)) { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN ,"%s\n" , + active); +continue ; + } + + box = hdev->box[i]; +memcpy (&phys_connector, &hdev->phys_connector[i], +sizeof (phys_connector)); +if (phys_connector[0 ] <'0' ) + phys_connector[0 ] ='0' ; +if (phys_connector[1 ] <'0' ) + phys_connector[1 ] ='0' ; +if (hdev->phys_connector[i] >0 ) + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN , +"PORT: %.2s " , + phys_connector); +if (hdev->devtype ==TYPE_DISK && h->hba_mode_enabled) { +if (box ==0 || box ==0xFF ) { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN , +"BAY: %hhu %s\n" , + bay, active); + }else { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN , +"BOX: %hhu BAY: %hhu %s\n" , + box, bay, active); + } + }else if (box !=0 && box !=0xFF ) { + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN ,"BOX: %hhu %s\n" , + box, active); + }else + output_len +=snprintf (path[i] + output_len, +PATH_STRING_LEN ,"%s\n" , active); + } + +spin_unlock_irqrestore (&h->devlock, flags); +return snprintf (buf, output_len+1 ,"%s%s%s%s%s%s%s%s" , + path[0 ], path[1 ], path[2 ], path[3 ], + path[4 ], path[5 ], path[6 ], path[7 ]); +} + static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL); static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO, host_show_hp_ssd_smart_path_enabled, NULL); +static DEVICE_ATTR(path_info, S_IRUGO, path_info_show, NULL); static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH, host_show_hp_ssd_smart_path_status, host_store_hp_ssd_smart_path_status);@@ -741,6 +836,7 @@ static struct device_attribute *hpsa_sdev_attrs[] = { &dev_attr_lunid, &dev_attr_unique_id, &dev_attr_hp_ssd_smart_path_enabled, + &dev_attr_path_info, &dev_attr_lockup_detected, NULL, };@@ -3611,6 +3707,31 @@ static void hpsa_get_ioaccel_drive_info(struct ctlr_info *h,atomic_set (&dev->reset_cmds_out,0 ); } +static void hpsa_get_path_info (struct hpsa_scsi_dev_t *this_device, +u8 *lunaddrbytes, +struct bmic_identify_physical_device *id_phys) +{ +if (PHYS_IOACCEL (lunaddrbytes) + && this_device->ioaccel_handle) + this_device->hba_ioaccel_enabled =1 ; + +memcpy (&this_device->active_path_index, + &id_phys->active_path_number, +sizeof (this_device->active_path_index)); +memcpy (&this_device->path_map, + &id_phys->redundant_path_present_map, +sizeof (this_device->path_map)); +memcpy (&this_device->box, + &id_phys->alternate_paths_phys_box_on_port, +sizeof (this_device->box)); +memcpy (&this_device->phys_connector, + &id_phys->alternate_paths_phys_connector, +sizeof (this_device->phys_connector)); +memcpy (&this_device->bay, + &id_phys->phys_bay_in_box, +sizeof (this_device->bay)); +} +static void hpsa_update_scsi_devices (struct ctlr_info *h,int hostno) {/* the idea here is we could get notified @@ -3771,6 +3892,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)hpsa_get_ioaccel_drive_info (h, this_device, lunaddrbytes, id_phys); +hpsa_get_path_info (this_device, lunaddrbytes, id_phys);atomic_set (&this_device->ioaccel_cmds_out,0 ); ncurrent++;break ;drivers/scsi/hpsa.h +5
-1@@ -50,6 +50,11 @@ struct hpsa_scsi_dev_t {* device via "ioaccel" path. */ u32 ioaccel_handle; +u8 active_path_index; +u8 path_map; +u8 bay; +u8 box[8 ]; +u16 phys_connector[8 ];int offload_config;/* I/O accel RAID offload configured */ int offload_enabled;/* I/O accel RAID offload enabled */ int offload_to_be_enabled; --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/11 hpsa: cleanup update scsi devices
In reply to Don Braceshowing that tables have been updated unnecessarily.
--- drivers/scsi/hpsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/hpsa.c +3 -3
@@ -1379,8 +1379,9 @@ static inline int device_updated(struct hpsa_scsi_dev_t *dev1,return 1 ;if (dev1->offload_enabled != dev2->offload_enabled)return 1 ; -if (dev1->queue_depth != dev2->queue_depth) -return 1 ; +if (!is_logical_dev_addr_mode (dev1->scsi3addr)) +if (dev1->queue_depth != dev2->queue_depth) +return 1 ;return 0 ; }
@@ -3889,7 +3890,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)else if (!(h->transMethod & CFGTBL_Trans_io_accel1 || h->transMethod & CFGTBL_Trans_io_accel2))break ; -hpsa_get_ioaccel_drive_info (h, this_device, lunaddrbytes, id_phys);hpsa_get_path_info (this_device, lunaddrbytes, id_phys);
Re: [PATCH 06/11] hpsa: cleanup update scsi devices
Quoted 5 lines · Don Brace
showing that tables have been updated unnecessarily.
Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 34 lines
--- drivers/scsi/hpsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/scsi/hpsa.c +3
-4@@ -1379,8 +1379,9 @@ static inline int device_updated(struct hpsa_scsi_dev_t *dev1,return 1 ;if (dev1->offload_enabled != dev2->offload_enabled)return 1 ; -if (dev1->queue_depth != dev2->queue_depth) -return 1 ; +if (!is_logical_dev_addr_mode (dev1->scsi3addr)) +if (dev1->queue_depth != dev2->queue_depth) +return 1 ;return 0 ; }@@ -3889,7 +3890,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)else if (!(h->transMethod & CFGTBL_Trans_io_accel1 || h->transMethod & CFGTBL_Trans_io_accel2))break ; -hpsa_get_ioaccel_drive_info (h, this_device, lunaddrbytes, id_phys);hpsa_get_path_info (this_device, lunaddrbytes, id_phys); --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/11 hpsa: add in new controllers
In reply to Don Brace--- drivers/scsi/hpsa.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/scsi/hpsa.c +10 -0
@@ -129,6 +129,11 @@ static const struct pci_device_id hpsa_pci_device_id[] = { {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CD}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CE}, {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0580}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0581}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0582}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0583}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0584}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0585}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0076}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0087}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x007D},
@@ -187,6 +192,11 @@ static struct board_type products[] = { {0x21CD103C, "Smart Array", &SA5_access}, {0x21CE103C, "Smart HBA", &SA5_access}, {0x05809005, "SmartHBA-SA", &SA5_access}, + {0x05819005, "SmartHBA-SA 8i", &SA5_access}, + {0x05829005, "SmartHBA-SA 8i8e", &SA5_access}, + {0x05839005, "SmartHBA-SA 8e", &SA5_access}, + {0x05849005, "SmartHBA-SA 16i", &SA5_access}, + {0x05859005, "SmartHBA-SA 4i4e", &SA5_access}, {0x00761590, "HP Storage P1224 Array Controller", &SA5_access}, {0x00871590, "HP Storage P1224e Array Controller", &SA5_access}, {0x007D1590, "HP Storage P1228 Array Controller", &SA5_access},
Re: [PATCH 07/11] hpsa: add in new controllers
Quoted 3 lines · Don Brace
Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 38 lines
--- drivers/scsi/hpsa.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/scsi/hpsa.c +10
-1@@ -129,6 +129,11 @@ static const struct pci_device_id hpsa_pci_device_id[] = { {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CD}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CE}, {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0580}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0581}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0582}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0583}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0584}, + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0585}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0076}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0087}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x007D},@@ -187,6 +192,11 @@ static struct board_type products[] = { {0x21CD103C, "Smart Array", &SA5_access}, {0x21CE103C, "Smart HBA", &SA5_access}, {0x05809005, "SmartHBA-SA", &SA5_access}, + {0x05819005, "SmartHBA-SA 8i", &SA5_access}, + {0x05829005, "SmartHBA-SA 8i8e", &SA5_access}, + {0x05839005, "SmartHBA-SA 8e", &SA5_access}, + {0x05849005, "SmartHBA-SA 16i", &SA5_access}, + {0x05859005, "SmartHBA-SA 4i4e", &SA5_access}, {0x00761590, "HP Storage P1224 Array Controller", &SA5_access}, {0x00871590, "HP Storage P1224e Array Controller", &SA5_access}, {0x007D1590, "HP Storage P1228 Array Controller", &SA5_access}, --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/11 Change how controllers in mixed mode are handled.
In reply to Don BraceFrom: Kevin Barnett <[email protected]>
--- drivers/scsi/hpsa.c | 97 ++++++--------------------------------------------- drivers/scsi/hpsa.h | 2 - 2 files changed, 11 insertions(+), 88 deletions(-)
drivers/scsi/hpsa.c +11 -86
@@ -791,7 +791,8 @@ static ssize_t path_info_show(struct device *dev,PATH_STRING_LEN ,"PORT: %.2s " , phys_connector); -if (hdev->devtype ==TYPE_DISK && h->hba_mode_enabled) { +if (hdev->devtype ==TYPE_DISK && + hdev->expose_state !=HPSA_DO_NOT_EXPOSE ) {if (box ==0 || box ==0xFF ) { output_len += snprintf(path[i] + output_len, PATH_STRING_LEN,
@@ -2689,34 +2690,6 @@ out:return rc; } -static int hpsa_bmic_ctrl_mode_sense (struct ctlr_info *h, -unsigned char *scsi3addr,unsigned char page, -struct bmic_controller_parameters *buf,size_t bufsize) -{ -int rc =IO_OK ; -struct CommandList *c; -struct ErrorInfo *ei; - - c =cmd_alloc (h); -if (fill_cmd (c,BMIC_SENSE_CONTROLLER_PARAMETERS , h, buf, bufsize, - page, scsi3addr,TYPE_CMD )) { - rc =-1 ; - goto out; - } - rc =hpsa_scsi_do_simple_cmd_with_retry (h, c, -PCI_DMA_FROMDEVICE ,NO_TIMEOUT ); -if (rc) - goto out; - ei = c->err_info; -if (ei->CommandStatus !=0 && ei->CommandStatus !=CMD_DATA_UNDERRUN ) { -hpsa_scsi_interpret_error (h, c); - rc =-1 ; - } -out: -cmd_free (h, c); -return rc; -} -static int hpsa_send_reset (struct ctlr_info *h,unsigned char *scsi3addr,u8 reset_type,int reply_queue) {
@@ -3665,29 +3638,6 @@ static u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position,return NULL ; } -static int hpsa_hba_mode_enabled (struct ctlr_info *h) -{ -int rc; -int hba_mode_enabled; -struct bmic_controller_parameters *ctlr_params; - ctlr_params =kzalloc (sizeof (struct bmic_controller_parameters ), -GFP_KERNEL ); - -if (!ctlr_params) -return -ENOMEM ; - rc =hpsa_bmic_ctrl_mode_sense (h,RAID_CTLR_LUNID ,0 , ctlr_params, -sizeof (struct bmic_controller_parameters )); -if (rc) { -kfree (ctlr_params); -return rc; - } - - hba_mode_enabled = - ((ctlr_params->nvram_flags &HBA_MODE_ENABLED_FLAG ) !=0 ); -kfree (ctlr_params); -return hba_mode_enabled; -} -/* get physical drive ioaccel handle and queue depth */ static void hpsa_get_ioaccel_drive_info(struct ctlr_info *h, struct hpsa_scsi_dev_t *dev,
@@ -3765,7 +3715,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)int ncurrent =0 ;int i, n_ext_target_devs, ndevs_to_allocate;int raid_ctlr_position; -int rescan_hba_mode;DECLARE_BITMAP (lunzerobits,MAX_EXT_TARGETS ); currentsd =kzalloc (sizeof (*currentsd) *HPSA_MAX_DEVICES ,GFP_KERNEL );
@@ -3781,17 +3730,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) }memset (lunzerobits,0 ,sizeof (lunzerobits)); - rescan_hba_mode =hpsa_hba_mode_enabled (h); -if (rescan_hba_mode <0 ) - goto out; - -if (!h->hba_mode_enabled && rescan_hba_mode) -dev_warn (&h->pdev->dev,"HBA mode enabled\n" ); -else if (h->hba_mode_enabled && !rescan_hba_mode) -dev_warn (&h->pdev->dev,"HBA mode disabled\n" ); - - h->hba_mode_enabled = rescan_hba_mode; -if (hpsa_gather_lun_info (h, physdev_list, &nphysicals, logdev_list, &nlogicals)) goto out;
@@ -3867,9 +3805,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)/* do not expose masked devices */ if (MASKED_DEVICE (lunaddrbytes) && i < nphysicals + (raid_ctlr_position ==0 )) { -if (h->hba_mode_enabled) -dev_warn (&h->pdev->dev, -"Masked physical device detected\n" ); this_device->expose_state =HPSA_DO_NOT_EXPOSE ; }else { this_device->expose_state =
@@ -3889,30 +3824,21 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) ncurrent++;break ;case TYPE_DISK : -if (i >= nphysicals) { - ncurrent++; -break ; - } - -if (h->hba_mode_enabled) -/* never use raid mapper in HBA mode */ +if (i < nphysicals + (raid_ctlr_position ==0 )) { +/* The disk is in HBA mode. */ +/* Never use RAID mapper in HBA mode. */ this_device->offload_enabled =0 ; -else if (!(h->transMethod & CFGTBL_Trans_io_accel1 || - h->transMethod & CFGTBL_Trans_io_accel2)) -break ; -hpsa_get_ioaccel_drive_info (h, this_device, - lunaddrbytes, id_phys); -hpsa_get_path_info (this_device, lunaddrbytes, id_phys); -atomic_set (&this_device->ioaccel_cmds_out,0 ); +hpsa_get_ioaccel_drive_info (h, this_device, + lunaddrbytes, id_phys); +hpsa_get_path_info (this_device, lunaddrbytes, + id_phys); + } ncurrent++;break ;case TYPE_TAPE :case TYPE_MEDIUM_CHANGER : - ncurrent++; -break ;case TYPE_ENCLOSURE : -if (h->hba_mode_enabled) - ncurrent++; + ncurrent++;break ;case TYPE_RAID :/* Only present the Smartarray HBA as a RAID controller.
@@ -8117,7 +8043,6 @@ reinit_after_soft_reset:pci_set_drvdata (pdev, h); h->ndevices =0 ; - h->hba_mode_enabled =0 ;spin_lock_init (&h->devlock); rc =hpsa_put_ctlr_into_performant_mode (h);
drivers/scsi/hpsa.h +0 -2
@@ -116,7 +116,6 @@ struct bmic_controller_parameters {u8 automatic_drive_slamming;u8 reserved1;u8 nvram_flags; -#define HBA_MODE_ENABLED_FLAG (1 << 3)u8 cache_nvram_flags;u8 drive_config_flags;u16 reserved2;
@@ -155,7 +154,6 @@ struct ctlr_info {unsigned int msi_vector;int intr_mode;/* either PERF_MODE_INT or SIMPLE_MODE_INT */ struct access_method access; -char hba_mode_enabled;/* queue and queue Info */ unsigned int Qdepth;
PATCH 9/11 hpsa: add in new offline mode
In reply to Don BraceFrom: Scott Benesh <[email protected]>
prevent adding volumes that are not available.
--- drivers/scsi/hpsa.c | 15 +++++++++++---- drivers/scsi/hpsa_cmd.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/scsi/hpsa.c +11 -4
@@ -1481,17 +1481,23 @@ static void hpsa_show_volume_status(struct ctlr_info *h, h->scsi_host->host_no, sd->bus, sd->target, sd->lun);break ; +case HPSA_LV_NOT_AVAILABLE : +dev_info (&h->pdev->dev, +"C%d:B%d:T%d:L%d Volume is waiting for transforming volume.\n" , + h->scsi_host->host_no, + sd->bus, sd->target, sd->lun); +break ;case HPSA_LV_UNDERGOING_RPI :dev_info (&h->pdev->dev, -"C%d:B%d:T%d:L%d Volume is undergoing rapid parity initialization process.\n" , +"C%d:B%d:T%d:L%d Volume is undergoing rapid parity init.\n" , h->scsi_host->host_no, sd->bus, sd->target, sd->lun);break ;case HPSA_LV_PENDING_RPI :dev_info (&h->pdev->dev, -"C%d:B%d:T%d:L%d Volume is queued for rapid parity initialization process.\n" , - h->scsi_host->host_no, - sd->bus, sd->target, sd->lun); +"C%d:B%d:T%d:L%d Volume is queued for rapid parity initialization process.\n" , + h->scsi_host->host_no, + sd->bus, sd->target, sd->lun);break ;case HPSA_LV_ENCRYPTED_NO_KEY : dev_info(&h->pdev->dev,
@@ -3262,6 +3268,7 @@ static int hpsa_volume_offline(struct ctlr_info *h,/* Keep volume offline in certain cases: */ switch (ldstat) {case HPSA_LV_UNDERGOING_ERASE : +case HPSA_LV_NOT_AVAILABLE :case HPSA_LV_UNDERGOING_RPI :case HPSA_LV_PENDING_RPI :case HPSA_LV_ENCRYPTED_NO_KEY :
drivers/scsi/hpsa_cmd.h +1 -0
@@ -164,6 +164,7 @@/* Logical volume states */ #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff#define HPSA_LV_OK 0x0 +#define HPSA_LV_NOT_AVAILABLE 0x0b#define HPSA_LV_UNDERGOING_ERASE 0x0F#define HPSA_LV_UNDERGOING_RPI 0x12#define HPSA_LV_PENDING_RPI 0x13
Re: [PATCH 09/11] hpsa: add in new offline mode
Quoted 8 lines · Don Brace
From: Scott Benesh <[email protected]>
prevent adding volumes that are not available.
Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Reviewed-by Justin Lindley <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
Quoted 63 lines
--- drivers/scsi/hpsa.c | 15 +++++++++++---- drivers/scsi/hpsa_cmd.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-)drivers/scsi/hpsa.c +11
-4@@ -1481,17 +1481,23 @@ static void hpsa_show_volume_status(struct ctlr_info *h, h->scsi_host->host_no, sd->bus, sd->target, sd->lun);break ; +case HPSA_LV_NOT_AVAILABLE : +dev_info (&h->pdev->dev, +"C%d:B%d:T%d:L%d Volume is waiting for transforming volume.\n" , + h->scsi_host->host_no, + sd->bus, sd->target, sd->lun); +break ;case HPSA_LV_UNDERGOING_RPI :dev_info (&h->pdev->dev, -"C%d:B%d:T%d:L%d Volume is undergoing rapid parity initialization process.\n" , +"C%d:B%d:T%d:L%d Volume is undergoing rapid parity init.\n" , h->scsi_host->host_no, sd->bus, sd->target, sd->lun);break ;case HPSA_LV_PENDING_RPI :dev_info (&h->pdev->dev, -"C%d:B%d:T%d:L%d Volume is queued for rapid parity initialization process.\n" , - h->scsi_host->host_no, - sd->bus, sd->target, sd->lun); +"C%d:B%d:T%d:L%d Volume is queued for rapid parity initialization process.\n" , + h->scsi_host->host_no, + sd->bus, sd->target, sd->lun);break ;case HPSA_LV_ENCRYPTED_NO_KEY : dev_info(&h->pdev->dev,@@ -3262,6 +3268,7 @@ static int hpsa_volume_offline(struct ctlr_info *h,/* Keep volume offline in certain cases: */ switch (ldstat) {case HPSA_LV_UNDERGOING_ERASE : +case HPSA_LV_NOT_AVAILABLE :case HPSA_LV_UNDERGOING_RPI :case HPSA_LV_PENDING_RPI :case HPSA_LV_ENCRYPTED_NO_KEY :drivers/scsi/hpsa_cmd.h +1
-1@@ -164,6 +164,7 @@/* Logical volume states */ #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff#define HPSA_LV_OK 0x0 +#define HPSA_LV_NOT_AVAILABLE 0x0b#define HPSA_LV_UNDERGOING_ERASE 0x0F#define HPSA_LV_UNDERGOING_RPI 0x12#define HPSA_LV_PENDING_RPI 0x13 --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/11 hpsa: fix issues with multilun devices
In reply to Don BraceFrom: shane.seymour <[email protected]>
A regression was introduced into the hpsa driver a while back so non-zero LUNs of multi-LUN devices may no longer be presented via a SAS based Smart Array. I have not done a bisection to discover the change that caused it.
The CISS firmware specification (available on sourceforge) defines an 8 byte lunid that describes devices that the Smart Array can see/present to the system. The current code in the hpsa driver attempts to find matches for non-zero LUNs with LUN 0 for a bus/target by zeroing out byte 4 of the lunid and find a match.
This method is sufficient for SCSI based Smart Arrays because byte 5 is always 0. For SAS based Smart arrays byte 5 of the lunid contains the path number for a multipath device and either one or two bits (the documentation does not define how many bits are used but it appears it may be one only) that indicate if the given path number in byte 5 must always be used to access that device. Byte 5 may not always be zero.
The following are lunids (spaces added for clarity) for a MSL2024 single drive library connected via a H241 Smart Array:
00 00 00 00 01 00 00 01 (changer)
00 00 00 00 00 80 00 01 (tape)
In the 4th byte (counting from 0) you can see that the tape is LUN 0 and the changer is LUN 1. The 0x80 set in the 5th byte for the tape drive means the driver should force access to path 0 (the library in this case was connected to one path only anyway).
After the changes we can see the following in the dmesg output:
scsi 0:3:0:0: RAID HP H241 1.18 \
PQ: 0 ANSI: 5
scsi 0:2:0:0: Sequential-Access HP Ultrium 6-SCSI 354W \
PQ: 0 ANSI: 6
scsi 0:2:0:1: Medium Changer HP MSL G3 Series 8.70 \
PQ: 0 ANSI: 5
Showing that the changer is correctly identified as LUN 1 of bus 2 target 0. Before the change the changer device is not seen.
--- drivers/scsi/hpsa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +4 -2
@@ -1187,17 +1187,19 @@ static int hpsa_scsi_add_entry(struct ctlr_info *h, int hostno,/* This is a non-zero lun of a multi-lun device. * Search through our list and find the device which -* has the same 8 byte LUN address, excepting byte 4. +* has the same 8 byte LUN address, excepting byte 4 and 5. * Assign the same bus and target for this new LUN. * Use the logical unit number from the firmware. */ memcpy (addr1, device->scsi3addr,8 ); addr1[4 ] =0 ; + addr1[5 ] =0 ;for (i =0 ; i < n; i++) { sd = h->dev[i];memcpy (addr2, sd->scsi3addr,8 ); addr2[4 ] =0 ; -/* differ only in byte 4? */ + addr2[5 ] =0 ; +/* differ only in byte 4 and 5? */ if (memcmp (addr1, addr2,8 ) ==0 ) { device->bus = sd->bus; device->target = sd->target;
Re: [PATCH 10/11] hpsa: fix issues with multilun devices
Quoted 42 lines · Don Brace
From: shane.seymour <[email protected]>
A regression was introduced into the hpsa driver a while back so non-zero LUNs of multi-LUN devices may no longer be presented via a SAS based Smart Array. I have not done a bisection to discover the change that caused it.
The CISS firmware specification (available on sourceforge) defines an 8 byte lunid that describes devices that the Smart Array can see/present to the system. The current code in the hpsa driver attempts to find matches for non-zero LUNs with LUN 0 for a bus/target by zeroing out byte 4 of the lunid and find a match.
This method is sufficient for SCSI based Smart Arrays because byte 5 is always 0. For SAS based Smart arrays byte 5 of the lunid contains the path number for a multipath device and either one or two bits (the documentation does not define how many bits are used but it appears it may be one only) that indicate if the given path number in byte 5 must always be used to access that device. Byte 5 may not always be zero.
The following are lunids (spaces added for clarity) for a MSL2024 single drive library connected via a H241 Smart Array:
00 00 00 00 01 00 00 01 (changer)
00 00 00 00 00 80 00 01 (tape)In the 4th byte (counting from 0) you can see that the tape is LUN 0 and the changer is LUN 1. The
0x80set in the 5th byte for the tape drive means the driver should force access to path 0 (the library in this case was connected to one path only anyway).After the changes we can see the following in the dmesg output:
scsi 0:3:0:0: RAID HP H241 1.18 \
PQ: 0 ANSI: 5
scsi 0:2:0:0: Sequential-Access HP Ultrium 6-SCSI 354W \
PQ: 0 ANSI: 6
scsi 0:2:0:1: Medium Changer HP MSL G3 Series 8.70 \
PQ: 0 ANSI: 5
Quoted 7 lines
Showing that the changer is correctly identified as LUN 1 of bus 2 target 0. Before the change the changer device is not seen.
Suggested-by shane.seymour <[email protected]>Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas
PATCH 11/11 hpsa: fix rmmod issues
In reply to Don BraceThe driver is calling hpsa_shutdown before calling scsi_remove_host. hpsa_shutdown is disabling interrupts.
scsi_remove_host can trigger I/O operations, such as SYNCHRONIZE CACHE when multipath is enabled which hang the system.
Call scsi_remove_host before calling hpsa_shutdown.
--- drivers/scsi/hpsa.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +8 -2
@@ -8269,6 +8269,14 @@ static void hpsa_remove_one(struct pci_dev *pdev)destroy_workqueue (h->rescan_ctlr_wq);destroy_workqueue (h->resubmit_wq); +/* +* Call before disabling interrupts. +* scsi_remove_host can trigger I/O operations especially +* when multipath is enabled. There can be SYNCHRONIZE CACHE +* operations which cannot complete and will hang the system. +*/ +if (h->scsi_host) +scsi_remove_host (h->scsi_host);/* init_one 8 */ /* includes hpsa_free_irqs - init_one 4 */ /* includes hpsa_disable_interrupt_mode - pci_init 2 */ hpsa_shutdown (pdev);
@@ -8277,8 +8285,6 @@ static void hpsa_remove_one(struct pci_dev *pdev)kfree (h->hba_inquiry_data);/* init_one 10 */ h->hba_inquiry_data =NULL ;/* init_one 10 */ -if (h->scsi_host) -scsi_remove_host (h->scsi_host);/* init_one 8 */ hpsa_free_ioaccel2_sg_chain_blocks (h);hpsa_free_performant_mode (h);/* init_one 7 */ hpsa_free_sg_chain_blocks (h);/* init_one 6 */
Re: [PATCH 11/11] hpsa: fix rmmod issues
Quoted 11 lines · Don Brace
The driver is calling
hpsa_shutdownbefore callingscsi_remove_host.hpsa_shutdownis disabling interrupts.
scsi_remove_hostcan trigger I/O operations, such as SYNCHRONIZE CACHE when multipath is enabled which hang the system.Call
scsi_remove_hostbefore callinghpsa_shutdown.Reviewed-by Kevin Barnett <[email protected]>Reviewed-by Scott Teel <[email protected]>Signed-off-by Don Brace <[email protected]>
Tomas