hpsa driver updates May 8, 2014
Subsystems (2)
PATCH 1/19 hpsa: add new Smart Array PCI IDs (May 2014)
In reply to Stephen M. CameronFrom: Joe Handzik <[email protected]>
--- drivers/scsi/hpsa.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +12 -0
@@ -115,9 +115,15 @@ static const struct pci_device_id hpsa_pci_device_id[] = { {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C3}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C4}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C5}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C6}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C7}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C8}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C9}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CA}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CB}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CC}, + {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_HP_3PAR, 0x0075, 0x1590, 0x0076}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0087}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x007D},
@@ -165,9 +171,15 @@ static struct board_type products[] = { {0x21C3103C, "Smart Array", &SA5_access}, {0x21C4103C, "Smart Array", &SA5_access}, {0x21C5103C, "Smart Array", &SA5_access}, + {0x21C6103C, "Smart Array", &SA5_access}, {0x21C7103C, "Smart Array", &SA5_access}, {0x21C8103C, "Smart Array", &SA5_access}, {0x21C9103C, "Smart Array", &SA5_access}, + {0x21CA103C, "Smart Array", &SA5_access}, + {0x21CB103C, "Smart Array", &SA5_access}, + {0x21CC103C, "Smart Array", &SA5_access}, + {0x21CD103C, "Smart Array", &SA5_access}, + {0x21CE103C, "Smart Array", &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},
PATCH 2/19 Checking for a NULL return from a kzalloc call in hpsa_get_pdisk_of_ioaccel2.
In reply to Stephen M. CameronFrom: Joe Handzik <[email protected]>
--- drivers/scsi/hpsa.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +2 -0
@@ -2848,6 +2848,8 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,/* Get the list of physical devices */ physicals =kzalloc (reportsize,GFP_KERNEL ); +if (physicals ==NULL ) +return 0 ;if (hpsa_scsi_do_report_phys_luns (h, (struct ReportLUNdata *) physicals, reportsize, extended)) { dev_err(&h->pdev->dev,
PATCH 3/19 hpsa: remove unused fields from struct ctlr_info
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
The fields "major", "max_outstanding", and "usage_count" of struct ctlr_info were not used for anything.
--- drivers/scsi/hpsa.c | 2 -- drivers/scsi/hpsa.h | 3 --- 2 files changed, 0 insertions(+), 5 deletions(-)
drivers/scsi/hpsa.c +0 -2
@@ -5481,8 +5481,6 @@ static void start_io(struct ctlr_info *h)* condition. */ h->commands_outstanding++; -if (h->commands_outstanding > h->max_outstanding) - h->max_outstanding = h->commands_outstanding;/* Tell the controller execute command */ spin_unlock_irqrestore (&h->lock, flags);
drivers/scsi/hpsa.h +0 -3
@@ -115,11 +115,8 @@ struct ctlr_info {int nr_cmds;/* Number of commands allowed on this controller */ struct CfgTable __iomem *cfgtable;int interrupts_enabled; -int major;int max_commands;int commands_outstanding; -int max_outstanding;/* Debug */ -int usage_count;/* number of opens all all minor devices */ # define PERF_MODE_INT 0# define DOORBELL_INT 1# define SIMPLE_MODE_INT 2
PATCH 12/19 hpsa: avoid unnecessary readl on every command submission
In reply to Stephen M. CameronFrom: root <[email protected]>
for controllers which support either of the ioaccel transport methods.
--- drivers/scsi/hpsa.c | 7 +++++++ drivers/scsi/hpsa.h | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +7 -0
@@ -7323,6 +7323,13 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)* 10 = 6 s/g entry or 24k */ +/* If the controller supports either ioaccel method then +* we can also use the RAID stack submit path that does not +* perform the superfluous readl() after each command submission. +*/ +if (trans_support & (CFGTBL_Trans_io_accel1 | CFGTBL_Trans_io_accel2)) + access = SA5_performant_access_no_read; +/* Controller spec: zero out this buffer. */ for (i =0 ; i < h->nreply_queues; i++)memset (h->reply_queue[i].head,0 , h->reply_queue_size);
drivers/scsi/hpsa.h +14 -1
@@ -345,6 +345,12 @@ static void SA5_submit_command(struct ctlr_info *h, (void )readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); } +static void SA5_submit_command_no_read (struct ctlr_info *h, +struct CommandList *c) +{ +writel (c->busaddr, h->vaddr +SA5_REQUEST_PORT_OFFSET ); +} +static void SA5_submit_command_ioaccel2 (struct ctlr_info *h,struct CommandList *c) {
@@ -352,7 +358,6 @@ static void SA5_submit_command_ioaccel2(struct ctlr_info *h,writel (c->busaddr, h->vaddr +IOACCEL2_INBOUND_POSTQ_32 ); else writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET); - (void )readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); }/*
@@ -563,6 +568,14 @@ static struct access_method SA5_performant_access = { SA5_performant_completed, }; +static struct access_method SA5_performant_access_no_read = { + SA5_submit_command_no_read, + SA5_performant_intr_mask, + SA5_fifo_full, + SA5_performant_intr_pending, + SA5_performant_completed, +}; +struct board_type {u32 board_id;char *product_name;
PATCH 11/19 hpsa: use per-cpu variable for lockup_detected
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
Avoid excessive locking by using per-cpu variable for lockup_detected
--- drivers/scsi/hpsa.c | 80 ++++++++++++++++++++++++++++++++++----------------- drivers/scsi/hpsa.h | 2 + 2 files changed, 54 insertions(+), 28 deletions(-)
drivers/scsi/hpsa.c +53 -27
@@ -48,6 +48,7 @@#include <linux/bitmap.h> #include <linux/atomic.h> #include <linux/jiffies.h> +#include <linux/percpu.h> #include <asm/div64.h> #include "hpsa_cmd.h" #include "hpsa.h"
@@ -1991,20 +1992,26 @@ static inline void hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,wait_for_completion (&wait); } +static u32 lockup_detected (struct ctlr_info *h) +{ +int cpu; +u32 rc, *lockup_detected; + + cpu =get_cpu (); + lockup_detected =per_cpu_ptr (h->lockup_detected, cpu); + rc = *lockup_detected; +put_cpu (); +return rc; +} +static void hpsa_scsi_do_simple_cmd_core_if_no_lockup (struct ctlr_info *h,struct CommandList *c) { -unsigned long flags; -/* If controller lockup detected, fake a hardware error. */ -spin_lock_irqsave (&h->lock, flags); -if (unlikely (h->lockup_detected)) { -spin_unlock_irqrestore (&h->lock, flags); +if (unlikely (lockup_detected (h))) c->err_info->CommandStatus =CMD_HARDWARE_ERR ; - }else { -spin_unlock_irqrestore (&h->lock, flags); +else hpsa_scsi_do_simple_cmd_core (h, c); - } }#define MAX_DRIVER_CMD_RETRIES 25
@@ -3964,7 +3971,6 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,struct hpsa_scsi_dev_t *dev;unsigned char scsi3addr[8 ];struct CommandList *c; -unsigned long flags;int rc =0 ;/* Get the ptr to our adapter structure out of cmd->host. */
@@ -3977,14 +3983,11 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd, }memcpy (scsi3addr, dev->scsi3addr,sizeof (scsi3addr)); -spin_lock_irqsave (&h->lock, flags); -if (unlikely (h->lockup_detected)) { -spin_unlock_irqrestore (&h->lock, flags); +if (unlikely (lockup_detected (h))) { cmd->result =DID_ERROR <<16 ;done (cmd);return 0 ; } -spin_unlock_irqrestore (&h->lock, flags); c =cmd_alloc (h);if (c ==NULL ) {/* trouble... */ dev_err (&h->pdev->dev,"cmd_alloc returned NULL!\n" );
@@ -4096,16 +4099,13 @@ static int do_not_scan_if_controller_locked_up(struct ctlr_info *h)* we can prevent new rescan threads from piling up on a * locked up controller. */ -spin_lock_irqsave (&h->lock, flags); -if (unlikely (h->lockup_detected)) { -spin_unlock_irqrestore (&h->lock, flags); +if (unlikely (lockup_detected (h))) {spin_lock_irqsave (&h->scan_lock, flags); h->scan_finished =1 ;wake_up_all (&h->scan_wait_queue);spin_unlock_irqrestore (&h->scan_lock, flags);return 1 ; } -spin_unlock_irqrestore (&h->lock, flags);return 0 ; }
@@ -6761,16 +6761,38 @@ static void fail_all_cmds_on_list(struct ctlr_info *h, struct list_head *list) } } +static void set_lockup_detected_for_all_cpus (struct ctlr_info *h,u32 value) +{ +int i, cpu; + + cpu =cpumask_first (cpu_online_mask); +for (i =0 ; i <num_online_cpus (); i++) { +u32 *lockup_detected; + lockup_detected =per_cpu_ptr (h->lockup_detected, cpu); + *lockup_detected = value; + cpu =cpumask_next (cpu, cpu_online_mask); + } +wmb ();/* be sure the per-cpu variables are out to memory */ +} +static void controller_lockup_detected (struct ctlr_info *h) {unsigned long flags; +u32 lockup_detected; h->access.set_intr_mask (h,HPSA_INTR_OFF );spin_lock_irqsave (&h->lock, flags); - h->lockup_detected =readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); + lockup_detected =readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); +if (!lockup_detected) { +/* no heartbeat, but controller gave us a zero. */ +dev_warn (&h->pdev->dev, +"lockup detected but scratchpad register is zero\n" ); + lockup_detected =0xffffffff ; + } +set_lockup_detected_for_all_cpus (h, lockup_detected);spin_unlock_irqrestore (&h->lock, flags);dev_warn (&h->pdev->dev,"Controller lockup detected: 0x%08x\n" , - h->lockup_detected); + lockup_detected);pci_disable_device (h->pdev);spin_lock_irqsave (&h->lock, flags);fail_all_cmds_on_list (h, &h->cmpQ);
@@ -6905,7 +6927,7 @@ static void hpsa_monitor_ctlr_worker(struct work_struct *work)struct ctlr_info *h =container_of (to_delayed_work (work), struct ctlr_info, monitor_ctlr_work);detect_controller_lockup (h); -if (h->lockup_detected) +if (lockup_detected (h))return ;if (hpsa_ctlr_needs_rescan (h) ||hpsa_offline_devices_ready (h)) {
@@ -6969,6 +6991,13 @@ reinit_after_soft_reset:spin_lock_init (&h->offline_device_lock);spin_lock_init (&h->scan_lock);spin_lock_init (&h->passthru_count_lock); + +/* Allocate and clear per-cpu variable lockup_detected */ + h->lockup_detected =alloc_percpu (u32); +if (!h->lockup_detected) + goto clean1; +set_lockup_detected_for_all_cpus (h,0 ); + rc =hpsa_pci_init (h);if (rc !=0 ) goto clean1;
@@ -7092,6 +7121,8 @@ clean4:free_irqs (h); clean2: clean1: +if (h->lockup_detected) +free_percpu (h->lockup_detected);kfree (h);return rc; }
@@ -7100,16 +7131,10 @@ static void hpsa_flush_cache(struct ctlr_info *h) {char *flush_buf;struct CommandList *c; -unsigned long flags;/* Don't bother trying to flush the cache if locked up */ -spin_lock_irqsave (&h->lock, flags); -if (unlikely (h->lockup_detected)) { -spin_unlock_irqrestore (&h->lock, flags); +if (unlikely (lockup_detected (h)))return ; - } -spin_unlock_irqrestore (&h->lock, flags); - flush_buf =kzalloc (4 ,GFP_KERNEL );if (!flush_buf)return ;
@@ -7193,6 +7218,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)kfree (h->hba_inquiry_data);pci_disable_device (pdev);pci_release_regions (pdev); +free_percpu (h->lockup_detected);kfree (h); }
drivers/scsi/hpsa.h +1 -1
@@ -191,7 +191,7 @@ struct ctlr_info {u64 last_heartbeat_timestamp;u32 heartbeat_sample_interval;atomic_t firmware_flash_in_progress; -u32 lockup_detected; +u32 *lockup_detected;struct delayed_work monitor_ctlr_work;int remove_in_progress;u32 fifo_recently_full;
PATCH 13/19 hpsa: Rearrange start_io to avoid one unlock/lock sequence in main io path
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
--- drivers/scsi/hpsa.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
drivers/scsi/hpsa.c +16 -8
@@ -194,7 +194,8 @@ static int number_of_controllers;static irqreturn_t do_hpsa_intr_intx (int irq,void *dev_id);static irqreturn_t do_hpsa_intr_msi (int irq,void *dev_id);static int hpsa_ioctl (struct scsi_device *dev,int cmd,void *arg); -static void start_io (struct ctlr_info *h); +static void lock_and_start_io (struct ctlr_info *h); +static void start_io (struct ctlr_info *h,unsigned long *flags);#ifdef CONFIG_COMPAT static int hpsa_compat_ioctl (struct scsi_device *dev,int cmd,void *arg);
@@ -845,8 +846,8 @@ static void enqueue_cmd_and_start_io(struct ctlr_info *h,spin_lock_irqsave (&h->lock, flags);addQ (&h->reqQ, c); h->Qdepth++; +start_io (h, &flags);spin_unlock_irqrestore (&h->lock, flags); -start_io (h); }static inline void removeQ (struct CommandList *c)
@@ -5452,13 +5453,12 @@ static void __iomem *remap_pci_mem(ulong base, ulong size)/* Takes cmds off the submission queue and sends them to the hardware, * then puts them on the queue of cmds waiting for completion. +* Assumes h->lock is held */ -static void start_io (struct ctlr_info *h) +static void start_io (struct ctlr_info *h,unsigned long *flags) {struct CommandList *c; -unsigned long flags; -spin_lock_irqsave (&h->lock, flags);while (!list_empty (&h->reqQ)) { c = list_entry(h->reqQ.next, struct CommandList, list);/* can't do anything if fifo is full */
@@ -5483,10 +5483,18 @@ static void start_io(struct ctlr_info *h) h->commands_outstanding++;/* Tell the controller execute command */ -spin_unlock_irqrestore (&h->lock, flags); +spin_unlock_irqrestore (&h->lock, *flags); h->access.submit_command (h, c); -spin_lock_irqsave (&h->lock, flags); +spin_lock_irqsave (&h->lock, *flags); } +} + +static void lock_and_start_io (struct ctlr_info *h) +{ +unsigned long flags; + +spin_lock_irqsave (&h->lock, flags); +start_io (h, &flags);spin_unlock_irqrestore (&h->lock, flags); }
@@ -5554,7 +5562,7 @@ static inline void finish_cmd(struct CommandList *c)else if (c->cmd_type ==CMD_IOCTL_PEND )complete (c->waiting);if (unlikely (io_may_be_stalled)) -start_io (h); +lock_and_start_io (h); }static inline u32 hpsa_tag_contains_index (u32 tag)
PATCH 14/19 hpsa: define extended_report_lun_entry data structure
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
--- drivers/scsi/hpsa.c | 21 ++++++++------------- drivers/scsi/hpsa_cmd.h | 12 +++++++++++- 2 files changed, 19 insertions(+), 14 deletions(-)
drivers/scsi/hpsa.c +8 -13
@@ -2869,26 +2869,20 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h, nphysicals =be32_to_cpu (*((__be32 *)physicals->LUNListLength)) / responsesize; -/* find ioaccel2 handle in list of physicals: */ for (i =0 ; i < nphysicals; i++) { +struct ext_report_lun_entry *entry = &physicals->LUN[i]; +/* handle is in bytes 28-31 of each lun */ -if (memcmp (&((struct ReportExtendedLUNdata *) - physicals)->LUN[i][20 ], &find,4 ) !=0 ) { +if (entry->ioaccel_handle != find)continue ;/* didn't match */ - } found =1 ; -memcpy (scsi3addr, &((struct ReportExtendedLUNdata *) - physicals)->LUN[i][0 ],8 ); +memcpy (scsi3addr, entry->lunid,8 );if (h->raid_offload_debug >0 )dev_info (&h->pdev->dev, -"%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n" , +"%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%8phN\n" , __func__, find, - ((struct ReportExtendedLUNdata *) - physicals)->LUN[i][20 ], - scsi3addr[0 ], scsi3addr[1 ], scsi3addr[2 ], - scsi3addr[3 ], scsi3addr[4 ], scsi3addr[5 ], - scsi3addr[6 ], scsi3addr[7 ]); + entry->ioaccel_handle, scsi3addr);break ;/* found it */ }
@@ -2973,7 +2967,8 @@ u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,return RAID_CTLR_LUNID ;if (i < logicals_start) -return &physdev_list->LUN[i - (raid_ctlr_position ==0 )][0 ]; +return &physdev_list->LUN[i - + (raid_ctlr_position ==0 )].lunid[0 ];if (i < last_device) return &logdev_list->LUN[i - nphysicals -
drivers/scsi/hpsa_cmd.h +11 -1
@@ -238,11 +238,21 @@ struct ReportLUNdata {u8 LUN [HPSA_MAX_LUN ][8 ]; }; +struct ext_report_lun_entry { +u8 lunid[8 ]; +u8 wwid[8 ]; +u8 device_type; +u8 device_flags; +u8 lun_count;/* multi-lun device, how many luns */ +u8 redundant_paths; +u32 ioaccel_handle;/* ioaccel1 only uses lower 16 bits */ +}; +struct ReportExtendedLUNdata {u8 LUNListLength[4 ];u8 extended_response_flag;u8 reserved[3 ]; -u8 LUN[HPSA_MAX_LUN ][24 ]; +struct ext_report_lun_entry LUN[HPSA_MAX_LUN ]; };struct SenseSubsystem_info {
PATCH 15/19 hpsa: kill annoying messages about SSD Smart Path retries
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
There's nothing the user can or should do about these messages, the commands are retried down the normal RAID path, and the messages just flood the logs and sap performance.
--- drivers/scsi/hpsa.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
drivers/scsi/hpsa.c +0 -10
@@ -1653,16 +1653,6 @@ static void process_ioaccel2_completion(struct ctlr_info *h,if (is_logical_dev_addr_mode (dev->scsi3addr) && c2->error_data.serv_response ==IOACCEL2_SERV_RESPONSE_FAILURE ) { -if (c2->error_data.status == -IOACCEL2_STATUS_SR_IOACCEL_DISABLED ) -dev_warn (&h->pdev->dev, -"%s: Path is unavailable, retrying on standard path.\n" , -"HP SSD Smart Path" ); -else -dev_warn (&h->pdev->dev, -"%s: Error 0x%02x, retrying on standard path.\n" , -"HP SSD Smart Path" , c2->error_data.status); - dev->offload_enabled =0 ; h->drv_req_rescan =1 ;/* schedule controller for a rescan */ cmd->result =DID_SOFT_ERROR <<16 ;
PATCH 9/19 hpsa: allocate reply queues individually
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
Now that we can allocate more than 4 reply queues (up to 64) we shouldn't try to make them share the same allocation but should allocate them separately.
--- drivers/scsi/hpsa.c | 53 +++++++++++++++++++++++++++++++-------------------- drivers/scsi/hpsa.h | 13 ++++++------- 2 files changed, 38 insertions(+), 28 deletions(-)
drivers/scsi/hpsa.c +32 -21
@@ -695,7 +695,7 @@ static inline void addQ(struct list_head *list, struct CommandList *c)static inline u32 next_command (struct ctlr_info *h,u8 q) {u32 a; -struct reply_pool *rq = &h->reply_queue[q]; +struct reply_queue_buffer *rq = &h->reply_queue[q];unsigned long flags;if (h->transMethod & CFGTBL_Trans_io_accel1)
@@ -6700,6 +6700,20 @@ static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h)#endif /* CONFIG_PCI_MSI */ } +static void hpsa_free_reply_queues (struct ctlr_info *h) +{ +int i; + +for (i =0 ; i < h->nreply_queues; i++) { +if (!h->reply_queue[i].head) +continue ; +pci_free_consistent (h->pdev, h->reply_queue_size, + h->reply_queue[i].head, h->reply_queue[i].busaddr); + h->reply_queue[i].head =NULL ; + h->reply_queue[i].busaddr =0 ; + } +} +static void hpsa_undo_allocations_after_kdump_soft_reset (struct ctlr_info *h) {hpsa_free_irqs_and_disable_msix (h);
@@ -6707,8 +6721,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)hpsa_free_cmd_pool (h);kfree (h->ioaccel1_blockFetchTable);kfree (h->blockFetchTable); -pci_free_consistent (h->pdev, h->reply_pool_size, - h->reply_pool, h->reply_pool_dhandle); +hpsa_free_reply_queues (h);if (h->vaddr)iounmap (h->vaddr);if (h->transtable)
@@ -7157,8 +7170,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)pci_free_consistent (h->pdev, h->nr_cmds *sizeof (struct ErrorInfo ), h->errinfo_pool, h->errinfo_pool_dhandle); -pci_free_consistent (h->pdev, h->reply_pool_size, - h->reply_pool, h->reply_pool_dhandle); +hpsa_free_reply_queues (h);kfree (h->cmd_pool_bits);kfree (h->blockFetchTable);kfree (h->ioaccel1_blockFetchTable);
@@ -7271,7 +7283,8 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)*/ /* Controller spec: zero out this buffer. */ -memset (h->reply_pool,0 , h->reply_pool_size); +for (i =0 ; i < h->nreply_queues; i++) +memset (h->reply_queue[i].head,0 , h->reply_queue_size); bft[7 ] =SG_ENTRIES_IN_CMD +4 ; calc_bucket_map(bft, ARRAY_SIZE(bft),
@@ -7287,8 +7300,7 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)for (i =0 ; i < h->nreply_queues; i++) {writel (0 , &h->transtable->RepQAddr[i].upper); -writel (h->reply_pool_dhandle + - (h->max_commands *sizeof (u64) * i), +writel (h->reply_queue[i].busaddr, &h->transtable->RepQAddr[i].lower); }
@@ -7336,8 +7348,10 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support) h->ioaccel1_blockFetchTable);/* initialize all reply queue entries to unused */ -memset (h->reply_pool, (u8 )IOACCEL_MODE1_REPLY_UNUSED , - h->reply_pool_size); +for (i =0 ; i < h->nreply_queues; i++) +memset (h->reply_queue[i].head, + (u8 )IOACCEL_MODE1_REPLY_UNUSED , + h->reply_queue_size);/* set all the constant fields in the accelerator command * frames once at init time to save CPU cycles later.
@@ -7493,16 +7507,17 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) } } -/* TODO, check that this next line h->nreply_queues is correct */ h->nreply_queues = h->msix_vector >0 ? h->msix_vector :1 ;hpsa_get_max_perf_mode_cmds (h);/* Performant mode ring buffer and supporting data structures */ - h->reply_pool_size = h->max_commands *sizeof (u64) * h->nreply_queues; - h->reply_pool =pci_alloc_consistent (h->pdev, h->reply_pool_size, - &(h->reply_pool_dhandle)); + h->reply_queue_size = h->max_commands *sizeof (u64);for (i =0 ; i < h->nreply_queues; i++) { - h->reply_queue[i].head = &h->reply_pool[h->max_commands * i]; + h->reply_queue[i].head =pci_alloc_consistent (h->pdev, + h->reply_queue_size, + &(h->reply_queue[i].busaddr)); +if (!h->reply_queue[i].head) + goto clean_up; h->reply_queue[i].size = h->max_commands; h->reply_queue[i].wraparound =1 ;/* spec: init to 1 */ h->reply_queue[i].current_entry =0 ;
@@ -7511,18 +7526,14 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)/* Need a block fetch table for performant mode */ h->blockFetchTable =kmalloc (((SG_ENTRIES_IN_CMD +1 ) *sizeof (u32)),GFP_KERNEL ); - -if ((h->reply_pool ==NULL ) - || (h->blockFetchTable ==NULL )) +if (!h->blockFetchTable) goto clean_up;hpsa_enter_performant_mode (h, trans_support);return ; clean_up: -if (h->reply_pool) -pci_free_consistent (h->pdev, h->reply_pool_size, - h->reply_pool, h->reply_pool_dhandle); +hpsa_free_reply_queues (h);kfree (h->blockFetchTable); }
drivers/scsi/hpsa.h +6 -7
@@ -57,11 +57,12 @@ struct hpsa_scsi_dev_t { }; -struct reply_pool { +struct reply_queue_buffer {u64 *head;size_t size;u8 wraparound;u32 current_entry; +dma_addr_t busaddr; };#pragma pack(1)
@@ -173,11 +174,9 @@ struct ctlr_info {/* * Performant mode completion buffers */ -u64 *reply_pool; -size_t reply_pool_size; -struct reply_pool reply_queue[MAX_REPLY_QUEUES ]; +size_t reply_queue_size; +struct reply_queue_buffer reply_queue[MAX_REPLY_QUEUES ];u8 nreply_queues; -dma_addr_t reply_pool_dhandle;u32 *blockFetchTable;u32 *ioaccel1_blockFetchTable;u32 *ioaccel2_blockFetchTable;
@@ -391,7 +390,7 @@ static void SA5_performant_intr_mask(struct ctlr_info *h, unsigned long val)static unsigned long SA5_performant_completed (struct ctlr_info *h,u8 q) { -struct reply_pool *rq = &h->reply_queue[q]; +struct reply_queue_buffer *rq = &h->reply_queue[q];unsigned long flags, register_value =FIFO_EMPTY ;/* msi auto clears the interrupt pending bit. */
@@ -506,7 +505,7 @@ static bool SA5_ioaccel_mode1_intr_pending(struct ctlr_info *h)static unsigned long SA5_ioaccel_mode1_completed (struct ctlr_info *h,u8 q) {u64 register_value; -struct reply_pool *rq = &h->reply_queue[q]; +struct reply_queue_buffer *rq = &h->reply_queue[q];unsigned long flags;BUG_ON (q >= h->nreply_queues);
PATCH 16/19 hpsa: fix event filtering to prevent excessive rescans with old firmware
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
CTLR_STATE_CHANGE_EVENT and CTLR_STATE_CHANGE_EVENT_REDUNDANT_CNTRL do not require rescans to be initiated. Current firmware filters out these events already, but some out of date firmware doesn't, so the driver needs to filter them out too. Without this change and with out of date firmware you may see the driver spending a lot of time scanning devices unnecessarily on some Smart Arrays.
--- drivers/scsi/hpsa.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/scsi/hpsa.h +1 -3
@@ -228,11 +228,9 @@ struct ctlr_info {#define CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE (1 << 31)#define RESCAN_REQUIRED_EVENT_BITS \ - (CTLR_STATE_CHANGE_EVENT | \ - CTLR_ENCLOSURE_HOT_PLUG_EVENT | \ + (CTLR_ENCLOSURE_HOT_PLUG_EVENT | \ CTLR_STATE_CHANGE_EVENT_PHYSICAL_DRV | \ CTLR_STATE_CHANGE_EVENT_LOGICAL_DRV | \ - CTLR_STATE_CHANGE_EVENT_REDUNDANT_CNTRL | \ CTLR_STATE_CHANGE_EVENT_AIO_ENABLED_DISABLED | \ CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE)spinlock_t offline_device_lock;
PATCH 7/19 hpsa: remove dev_dbg() calls from hot paths
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
They are not completely free of cost when disabled and when enabled emitting debug output for every command submitted produces far too much output to be useful.
--- drivers/scsi/hpsa.h | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/scsi/hpsa.h +0 -5
@@ -342,8 +342,6 @@ struct offline_device_entry {static void SA5_submit_command (struct ctlr_info *h,struct CommandList *c) { -dev_dbg (&h->pdev->dev,"Sending %x, tag = %x\n" , c->busaddr, - c->Header.Tag.lower);writel (c->busaddr, h->vaddr +SA5_REQUEST_PORT_OFFSET ); (void )readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); }
@@ -351,8 +349,6 @@ static void SA5_submit_command(struct ctlr_info *h,static void SA5_submit_command_ioaccel2 (struct ctlr_info *h,struct CommandList *c) { -dev_dbg (&h->pdev->dev,"Sending %x, tag = %x\n" , c->busaddr, - c->Header.Tag.lower);if (c->cmd_type ==CMD_IOACCEL2 )writel (c->busaddr, h->vaddr +IOACCEL2_INBOUND_POSTQ_32 );else
@@ -474,7 +470,6 @@ static bool SA5_intr_pending(struct ctlr_info *h) {unsigned long register_value =readl (h->vaddr +SA5_INTR_STATUS ); -dev_dbg (&h->pdev->dev,"intr_pending %lx\n" , register_value);return register_value &SA5_INTR_PENDING ; }
PATCH 10/19 hpsa: set irq affinity hints to route MSI-X vectors across CPUs
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
--- drivers/scsi/hpsa.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +16 -1
@@ -6608,6 +6608,17 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) h->ioaccel_cmd_pool, h->ioaccel_cmd_pool_dhandle); } +static void hpsa_irq_affinity_hints (struct ctlr_info *h) +{ +int i, cpu, rc; + + cpu =cpumask_first (cpu_online_mask); +for (i =0 ; i < h->msix_vector; i++) { + rc =irq_set_affinity_hint (h->intr[i],get_cpu_mask (cpu)); + cpu =cpumask_next (cpu, cpu_online_mask); + } +} +static int hpsa_request_irq (struct ctlr_info *h,irqreturn_t (*msixhandler)(int ,void *),irqreturn_t (*intxhandler)(int ,void *))
@@ -6627,6 +6638,7 @@ static int hpsa_request_irq(struct ctlr_info *h, rc =request_irq (h->intr[i], msixhandler,0 , h->devname, &h->q[i]); +hpsa_irq_affinity_hints (h); }else {/* Use single reply pool */ if (h->msix_vector >0 || h->msi_vector) {
@@ -6678,12 +6690,15 @@ static void free_irqs(struct ctlr_info *h)if (!h->msix_vector || h->intr_mode !=PERF_MODE_INT ) {/* Single reply queue, only one irq to free */ i = h->intr_mode; +irq_set_affinity_hint (h->intr[i],NULL );free_irq (h->intr[i], &h->q[i]);return ; } -for (i =0 ; i < h->msix_vector; i++) +for (i =0 ; i < h->msix_vector; i++) { +irq_set_affinity_hint (h->intr[i],NULL );free_irq (h->intr[i], &h->q[i]); + } }static void hpsa_free_irqs_and_disable_msix (struct ctlr_info *h)
PATCH 17/19 hpsa: remove bad unlikely annotation from device list updating code
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
--- drivers/scsi/hpsa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +1 -1
@@ -3060,7 +3060,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) ndev_allocated++; } -if (unlikely (is_scsi_rev_5 (h))) +if (is_scsi_rev_5 (h)) raid_ctlr_position =0 ;else raid_ctlr_position = nphysicals + nlogicals;
PATCH 4/19 hpsa: allow passthru ioctls to work with bidirectional commands
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
Treat the the data direction bits as a bit mask allowing both READ and WRITE at the same time instead of testing for equality to see if it's a exclusively a READ or a WRITE.
--- drivers/scsi/hpsa.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/hpsa.c +4 -4
@@ -4956,7 +4956,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) buff =kmalloc (iocommand.buf_size,GFP_KERNEL );if (buff ==NULL )return -EFAULT ; -if (iocommand.Request.Type.Direction ==XFER_WRITE ) { +if (iocommand.Request.Type.Direction &XFER_WRITE ) {/* Copy the data into the buffer we created */ if (copy_from_user (buff, iocommand.buf, iocommand.buf_size)) {
@@ -5019,7 +5019,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) rc = -EFAULT ; goto out; } -if (iocommand.Request.Type.Direction ==XFER_READ && +if ((iocommand.Request.Type.Direction &XFER_READ ) && iocommand.buf_size >0 ) {/* Copy the data out of the buffer we created */ if (copy_to_user (iocommand.buf, buff, iocommand.buf_size)) {
@@ -5096,7 +5096,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) status = -ENOMEM ; goto cleanup1; } -if (ioc->Request.Type.Direction ==XFER_WRITE ) { +if (ioc->Request.Type.Direction &XFER_WRITE ) {if (copy_from_user (buff[sg_used], data_ptr, sz)) { status = -ENOMEM ; goto cleanup1;
@@ -5148,7 +5148,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) status = -EFAULT ; goto cleanup0; } -if (ioc->Request.Type.Direction ==XFER_READ && ioc->buf_size >0 ) { +if ((ioc->Request.Type.Direction &XFER_READ ) && ioc->buf_size >0 ) {/* Copy the data out of the buffer we created */ BYTE __user *ptr = ioc->buf;for (i =0 ; i < sg_used; i++) {
cover hpsa driver updates May 8, 2014
Not a lot of extensive changes in this set, some new PCI IDs, some small bug fixes, quieting some noisy messages, allowing more reply queues, setting irq affinity hints, and some minor locking improvments.
drivers/scsi/hpsa.c | 266 +++++++++++++++++++++++++++++------------------ drivers/scsi/hpsa.h | 42 ++++--- drivers/scsi/hpsa_cmd.h | 47 +++----- 3 files changed, 203 insertions(+), 152 deletions(-)
Signature · 1 line
-- steve
PATCH 18/19 hpsa: report check condition even if no sense data present for ioaccel2 mode
From: Stephen M. Cameron <[email protected]>
It shouldn't happen that we get a check condition with no sense data, but if it does, we shouldn't just drop the check condition on the floor.
--- drivers/scsi/hpsa.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +5 -2
@@ -1556,9 +1556,13 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,dev_warn (&h->pdev->dev,"%s: task complete with check condition.\n" ,"HP SSD Smart Path" ); + cmd->result |=SAM_STAT_CHECK_CONDITION ;if (c2->error_data.data_present != -IOACCEL2_SENSE_DATA_PRESENT ) +IOACCEL2_SENSE_DATA_PRESENT ) { +memset (cmd->sense_buffer,0 , +SCSI_SENSE_BUFFERSIZE );break ; + }/* copy the sense data */ data_len = c2->error_data.sense_data_len;if (data_len >SCSI_SENSE_BUFFERSIZE )
@@ -1568,7 +1572,6 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,sizeof (c2->error_data.sense_data_buff);memcpy (cmd->sense_buffer, c2->error_data.sense_data_buff, data_len); - cmd->result |=SAM_STAT_CHECK_CONDITION ; retry =1 ;break ;case IOACCEL2_STATUS_SR_TASK_COMP_BUSY :
PATCH 6/19 hpsa: use gcc aligned attribute instead of manually padding structs
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
--- drivers/scsi/hpsa.c | 3 --- drivers/scsi/hpsa_cmd.h | 33 ++++++--------------------------- 2 files changed, 6 insertions(+), 30 deletions(-)
drivers/scsi/hpsa.c +0 -3
@@ -6925,7 +6925,6 @@ reinit_after_soft_reset:* the 5 lower bits of the address are used by the hardware. and by * the driver. See comments in hpsa.h for more info. */ -#define COMMANDLIST_ALIGNMENT 128BUILD_BUG_ON (sizeof (struct CommandList ) %COMMANDLIST_ALIGNMENT ); h =kzalloc (sizeof (*h),GFP_KERNEL );if (!h)
@@ -7398,7 +7397,6 @@ static int hpsa_alloc_ioaccel_cmd_and_bft(struct ctlr_info *h)* because the 7 lower bits of the address are used by the * hardware. */ -#define IOACCEL1_COMMANDLIST_ALIGNMENT 128BUILD_BUG_ON (sizeof (struct io_accel1_cmd ) %IOACCEL1_COMMANDLIST_ALIGNMENT ); h->ioaccel_cmd_pool =
@@ -7436,7 +7434,6 @@ static int ioaccel2_alloc_cmds_and_bft(struct ctlr_info *h)if (h->ioaccel_maxsg >IOACCEL2_MAXSGENTRIES ) h->ioaccel_maxsg =IOACCEL2_MAXSGENTRIES ; -#define IOACCEL2_COMMANDLIST_ALIGNMENT 128BUILD_BUG_ON (sizeof (struct io_accel2_cmd ) %IOACCEL2_COMMANDLIST_ALIGNMENT ); h->ioaccel2_cmd_pool =
drivers/scsi/hpsa_cmd.h +6 -27
@@ -375,6 +375,7 @@ struct ctlr_info; /* defined in hpsa.h */* or a bus address. */ +#define COMMANDLIST_ALIGNMENT 128struct CommandList {struct CommandListHeader Header;struct RequestBlock Request;
@@ -389,21 +390,7 @@ struct CommandList {struct list_head list;struct completion *waiting;void *scsi_cmd; - -/* on 64 bit architectures, to get this to be 32-byte-aligned -* it so happens we need PAD_64 bytes of padding, on 32 bit systems, -* we need PAD_32 bytes of padding (see below). This does that. -* If it happens that 64 bit and 32 bit systems need different -* padding, PAD_32 and PAD_64 can be set independently, and. -* the code below will do the right thing. -*/ -#define IS_32_BIT ((8 - sizeof(long))/4) -#define IS_64_BIT (!IS_32_BIT) -#define PAD_32 (40) -#define PAD_64 (12) -#define COMMANDLIST_PAD (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64) -u8 pad[COMMANDLIST_PAD ]; -}; +} __attribute__((aligned(COMMANDLIST_ALIGNMENT)));/* Max S/G elements in I/O accelerator command */ #define IOACCEL1_MAXSGENTRIES 24
@@ -413,6 +400,7 @@ struct CommandList {* Structure for I/O accelerator (mode 1) commands. * Note that this structure must be 128-byte aligned in size. */ +#define IOACCEL1_COMMANDLIST_ALIGNMENT 128struct io_accel1_cmd {u16 dev_handle;/* 0x00 - 0x01 */ u8 reserved1;/* 0x02 */
@@ -440,12 +428,7 @@ struct io_accel1_cmd {struct vals32 host_addr;/* 0x70 - 0x77 */ u8 CISS_LUN [8 ];/* 0x78 - 0x7F */ struct SGDescriptor SG [IOACCEL1_MAXSGENTRIES ]; -#define IOACCEL1_PAD_64 0 -#define IOACCEL1_PAD_32 0 -#define IOACCEL1_PAD (IS_32_BIT * IOACCEL1_PAD_32 + \ - IS_64_BIT * IOACCEL1_PAD_64) -u8 pad[IOACCEL1_PAD ]; -}; +} __attribute__((aligned(IOACCEL1_COMMANDLIST_ALIGNMENT)));#define IOACCEL1_FUNCTION_SCSIIO 0x00#define IOACCEL1_SGLOFFSET 32
@@ -510,14 +493,11 @@ struct io_accel2_scsi_response {u8 sense_data_buff[32 ];/* sense/response data buffer */ }; -#define IOACCEL2_64_PAD 76 -#define IOACCEL2_32_PAD 76 -#define IOACCEL2_PAD (IS_32_BIT * IOACCEL2_32_PAD + \ - IS_64_BIT * IOACCEL2_64_PAD)/* * Structure for I/O accelerator (mode 2 or m2) commands. * Note that this structure must be 128-byte aligned in size. */ +#define IOACCEL2_COMMANDLIST_ALIGNMENT 128struct io_accel2_cmd {u8 IU_type;/* IU Type */ u8 direction;/* direction, memtype, and encryption */
@@ -544,8 +524,7 @@ struct io_accel2_cmd {u32 tweak_upper;/* Encryption tweak, upper 4 bytes */ struct ioaccel2_sg_element sg[IOACCEL2_MAXSGENTRIES ];struct io_accel2_scsi_response error_data; -u8 pad[IOACCEL2_PAD ]; -}; +} __attribute__((aligned(IOACCEL2_COMMANDLIST_ALIGNMENT)));/* * defines for Mode 2 command struct
PATCH 8/19 hpsa: choose number of reply queues more intelligently.
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
No sense having 8 or 16 reply queues if you only have 4 cpus, and likewise no sense limiting to 8 reply queues if you have many more cpus.
--- drivers/scsi/hpsa.c | 2 ++ drivers/scsi/hpsa_cmd.h | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +2 -0
@@ -6157,6 +6157,8 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)if (pci_find_capability (h->pdev,PCI_CAP_ID_MSIX )) {dev_info (&h->pdev->dev,"MSIX\n" ); h->msix_vector =MAX_REPLY_QUEUES ; +if (h->msix_vector >num_online_cpus ()) + h->msix_vector =num_online_cpus (); err =pci_enable_msix (h->pdev, hpsa_msix_entries, h->msix_vector);if (err >0 ) {
drivers/scsi/hpsa_cmd.h +1 -1
@@ -615,7 +615,7 @@ struct TransTable_struct {u32 RepQCount;u32 RepQCtrAddrLow32;u32 RepQCtrAddrHigh32; -#define MAX_REPLY_QUEUES 8 +#define MAX_REPLY_QUEUES 64struct vals32 RepQAddr[MAX_REPLY_QUEUES ]; };
PATCH 5/19 hpsa: change doorbell reset delay to ten seconds
In reply to Stephen M. CameronFrom: Justin Lindley <[email protected]>
After 3.22 firmware, PMC firmware guys tell us the previous 5 second delay after a reset now needs to be 10 secs to avoid a PCIe error due to the driver looking at the controller too soon after the reset.
--- drivers/scsi/hpsa.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +2 -2
@@ -5831,12 +5831,12 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,dev_info (&pdev->dev,"using doorbell to reset controller\n" );writel (use_doorbell, vaddr +SA5_DOORBELL ); -/* PMC hardware guys tell us we need a 5 second delay after +/* PMC hardware guys tell us we need a 10 second delay after * doorbell reset and before any attempt to talk to the board * at all to ensure that this actually works and doesn't fall * over in some weird corner cases. */ -msleep (5000 ); +msleep (10000 ); }else {/* Try to do it the PCI power state way */ /* Quoting from the Open CISS Specification: "The Power
PATCH 19/19 hpsa: remove messages about volume status VPD inquiry page not supported
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
They are annoying and do not help anyone.
--- drivers/scsi/hpsa.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)
drivers/scsi/hpsa.c +3 -9
@@ -2516,27 +2516,21 @@ static int hpsa_get_volume_status(struct ctlr_info *h,return HPSA_VPD_LV_STATUS_UNSUPPORTED ;/* Does controller have VPD for logical volume status? */ -if (!hpsa_vpd_page_supported (h, scsi3addr,HPSA_VPD_LV_STATUS )) { -dev_warn (&h->pdev->dev,"Logical volume status VPD page is unsupported.\n" ); +if (!hpsa_vpd_page_supported (h, scsi3addr,HPSA_VPD_LV_STATUS )) goto exit_failed; - }/* Get the size of the VPD return buffer */ rc =hpsa_scsi_do_inquiry (h, scsi3addr,VPD_PAGE |HPSA_VPD_LV_STATUS , buf,HPSA_VPD_HEADER_SZ ); -if (rc !=0 ) { -dev_warn (&h->pdev->dev,"Logical volume status VPD inquiry failed.\n" ); +if (rc !=0 ) goto exit_failed; - } size = buf[3 ];/* Now get the whole VPD buffer */ rc =hpsa_scsi_do_inquiry (h, scsi3addr,VPD_PAGE |HPSA_VPD_LV_STATUS , buf, size +HPSA_VPD_HEADER_SZ ); -if (rc !=0 ) { -dev_warn (&h->pdev->dev,"Logical volume status VPD inquiry failed.\n" ); +if (rc !=0 ) goto exit_failed; - } status = buf[4 ];/* status byte */ kfree (buf);
Re: [PATCH 10/19] hpsa: set irq affinity hints to route MSI-X vectors across CPUs
In reply to Stephen M. CameronQuoted 12 lines · Stephen M. Cameron
From: Stephen M. Cameron <[email protected]>
Signed-off-by Stephen M. Cameron <[email protected]>---
drivers/scsi/hpsa.c| 17 ++++++++++++++++-1 files changed, 16 insertions(+), 1 deletions(-)drivers/scsi/hpsa.c +0
-0
drivers/scsi/hpsa.c static void hpsa_free_cmd_pool(struct ctlr_info *h) · line 6615
Quoted 8 lines
drivers/scsi/hpsa.c +5
-0@@ -6608,6 +6608,17 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) h->ioaccel_cmd_pool, h->ioaccel_cmd_pool_dhandle); } +static void hpsa_irq_affinity_hints (struct ctlr_info *h) +{ +int i, cpu, rc; + + cpu =cpumask_first (cpu_online_mask);
May be consider setting cpu affinity hint based on numa locality of pcie device and cpu? Instead of blindly assigning all online cpu in order.
Some thing like
cpu = cpumask_first(cpumask_of_node(numa_node))
drivers/scsi/hpsa.c static void hpsa_free_cmd_pool(struct ctlr_info *h) · line 6617
Quoted 2 lines
drivers/scsi/hpsa.c +2
-0+for (i =0 ; i < h->msix_vector; i++) { + rc =irq_set_affinity_hint (h->intr[i],get_cpu_mask (cpu));
You are not using return value rc. Why declare it?
Thanks
Govind
Quoted 38 lines
drivers/scsi/hpsa.c +9
-2+ cpu =cpumask_next (cpu, cpu_online_mask); + } +} +static int hpsa_request_irq (struct ctlr_info *h,irqreturn_t (*msixhandler)(int ,void *),irqreturn_t (*intxhandler)(int ,void *))@@ -6627,6 +6638,7 @@ static int hpsa_request_irq(struct ctlr_info *h, rc =request_irq (h->intr[i], msixhandler,0 , h->devname, &h->q[i]); +hpsa_irq_affinity_hints (h); }else {/* Use single reply pool */ if (h->msix_vector >0 || h->msi_vector) {@@ -6678,12 +6690,15 @@ static void free_irqs(struct ctlr_info *h)if (!h->msix_vector || h->intr_mode !=PERF_MODE_INT ) {/* Single reply queue, only one irq to free */ i = h->intr_mode; +irq_set_affinity_hint (h->intr[i],NULL );free_irq (h->intr[i], &h->q[i]);return ; } -for (i =0 ; i < h->msix_vector; i++) +for (i =0 ; i < h->msix_vector; i++) { +irq_set_affinity_hint (h->intr[i],NULL );free_irq (h->intr[i], &h->q[i]); + } }static void hpsa_free_irqs_and_disable_msix (struct ctlr_info *h) --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
RE: [PATCH 10/19] hpsa: set irq affinity hints to route MSI-X vectors across CPUs
Quoted 52 lines
-----Original Message-----
From: Govindarajulu Varadarajan [mailto:[email protected]]
Sent: Thursday, 08 May, 2014 4:12 PM
To: Stephen M. Cameron
Cc: [email protected]; Lindley, Justin; [email protected]; [email protected]; [email protected]; Handzik, Joe; [email protected]; [email protected]; Elliott, Robert (Server Storage); Teel, Scott Stacy
Subject: Re: [PATCH 10/19] hpsa: set irq affinity hints to route MSI-X vectors across CPUsQuoted 12 lines · Stephen M. Cameron
From: Stephen M. Cameron <[email protected]>
Signed-off-by Stephen M. Cameron <[email protected]>---
drivers/scsi/hpsa.c| 17 ++++++++++++++++-1 files changed, 16 insertions(+), 1 deletions(-)drivers/scsi/hpsa.c +0
-0drivers/scsi/hpsa.c static void hpsa_free_cmd_pool(struct ctlr_info *h) · line 6615
Quoted 8 lines
drivers/scsi/hpsa.c +5
-0@@ -6608,6 +6608,17 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) h->ioaccel_cmd_pool, h->ioaccel_cmd_pool_dhandle); } +static void hpsa_irq_affinity_hints (struct ctlr_info *h) +{ +int i, cpu, rc; + + cpu =cpumask_first (cpu_online_mask);Maybe consider setting cpu affinity hint based on numa locality of pcie device and cpu? Instead of blindly assigning all online cpu in order.
Something like
cpu = cpumask_first(cpumask_of_node(numa_node))
drivers/scsi/hpsa.c static void hpsa_free_cmd_pool(struct ctlr_info *h) · line 6617
Quoted 2 lines
drivers/scsi/hpsa.c +2
-0+for (i =0 ; i < h->msix_vector; i++) { + rc =irq_set_affinity_hint (h->intr[i],get_cpu_mask (cpu));You are not using return value rc. Why declare it?
Quoted 6 lines
Thanks
Govinddrivers/scsi/hpsa.c static void hpsa_free_cmd_pool(struct ctlr_info *h) · line 6621
Quoted 4 lines
drivers/scsi/hpsa.c +4
-0+ cpu =cpumask_next (cpu, cpu_online_mask); + } +} +
We think matching the locality of the application is more important - delivering the message write carrying the MSI-X interrupt across the CPU-to-CPU interconnect is less expensive than delivering it to the closest CPU and doing hardirq processing there, which causes cache traffic between that CPU and the CPU used for:
a) submission by the application and driver stack;
b) softirq processing; and
c) completion processing by the application.
That presumes the application thread is not wandering to a different CPU after submission before completion. If so, any choice is bound to be wrong sometimes.
If the block layer queue has rq_affinity=2, the softirq is handled on the submitting CPU core; if rq_affinity=1, it is handled on any core sharing the L3 cache (i.e., the same physical CPU socket).
With hyperthreading, the hyperthreaded sibling of the submitting CPU core should be equally good at hardirq and softirq processing. Is there an architecture-independent call in linux to report the CPUs sharing the same L1 (and L2) cache (i.e., the siblings)? cpus_share_cache(), used by the block layer for rq_affinity=1, just reports CPUs sharing the same last level (L3) cache domain. That still results in L2 traffic between cores inside a socket.
---
Rob Elliott HP Server Storage
The whole series looks good to me,