hisi_sas: Misc patches
Subsystems (2)
cover hisi_sas: Misc patches
This series introduces some misc patches for the driver for the v5.6 cycle.
Nothing especially interesting, but maybe the change to switch the v2 driver to use reply map also, which improves performance.
There is also a change to switch the driver to use threaded interrupt handling over tasklets.
John Garry (2):
scsi: hisi_sas: Rename hisi_sas_cq.pci_irq_mask
scsi: hisi_sas: Use reply map for v2 hw
Luo Jiaxing (3):
scsi: hisi_sas: Replace magic number when handle channel interrupt
scsi: hisi_sas: Modify the file permissions of trigger_dump to write
only
scsi: hisi_sas: Add prints for v3 hw interrupt converge and automatic
affinity
Xiang Chen (2):
scsi: hisi_sas: use threaded irq to process CQ interrupts
scsi: hisi_sas: replace spin_lock_irqsave/spin_unlock_restore with
spin_lock/spin_unlock
drivers/scsi/hisi_sas/hisi_sas.h | 9 ++- drivers/scsi/hisi_sas/hisi_sas_main.c | 74 ++++++++++----------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 90 +++++++++++++++++++------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 54 +++++++++------- 4 files changed, 139 insertions(+), 88 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/7 scsi: hisi_sas: use threaded irq to process CQ interrupts
From: Xiang Chen <[email protected]>
Currently IRQ_EFFECTIVE_AFF_MASK is enabled for ARM_GIC and ARM_GIC3, so it only allows a single target CPU in the affinity mask to process interrupts and also interrupt thread, and the performance of using threaded irq is almost the same as tasklet. But if the config is not enabled, the interrupt thread will be allowed all the CPUs in the affinity mask. At that situation it promotes much on the performance (about 20%).
Note: IRQ_EFFECTIVE_AFF_MASK is configured differently for different architecture chip, and it seems to be better to make it be configured easily.
--- drivers/scsi/hisi_sas/hisi_sas.h | 4 ++-- drivers/scsi/hisi_sas/hisi_sas_main.c | 22 +++++++++---------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 26 +++++++++------------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 30 ++++++++++++-------------- 4 files changed, 37 insertions(+), 45 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +2 -2
@@ -181,9 +181,9 @@ struct hisi_sas_port {struct hisi_sas_cq {struct hisi_hba *hisi_hba;const struct cpumask *pci_irq_mask; -struct tasklet_struct tasklet;int rd_point;int id; +int irq_no; };struct hisi_sas_dq {
@@ -627,7 +627,7 @@ extern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba,extern void hisi_sas_init_mem (struct hisi_hba *hisi_hba);extern void hisi_sas_rst_work_handler (struct work_struct *work);extern void hisi_sas_sync_rst_work_handler (struct work_struct *work); -extern void hisi_sas_kill_tasklets (struct hisi_hba *hisi_hba); +extern void hisi_sas_sync_irqs (struct hisi_hba *hisi_hba);extern void hisi_sas_phy_oob_ready (struct hisi_hba *hisi_hba,int phy_no);extern bool hisi_sas_notify_phy_event (struct hisi_sas_phy *phy,enum hisi_sas_phy_event event);
drivers/scsi/hisi_sas/hisi_sas_main.c +11 -11
@@ -1233,10 +1233,10 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device,struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue];/* -* flush tasklet to avoid free'ing task +* sync irq to avoid free'ing task * before using task in IO completion */ -tasklet_kill (&cq->tasklet); +synchronize_irq (cq->irq_no); slot->task =NULL ; }
@@ -1626,11 +1626,11 @@ static int hisi_sas_abort_task(struct sas_task *task)if (slot) {/* -* flush tasklet to avoid free'ing task +* sync irq to avoid free'ing task * before using task in IO completion */ cq = &hisi_hba->cq[slot->dlvry_queue]; -tasklet_kill (&cq->tasklet); +synchronize_irq (cq->irq_no); }spin_unlock_irqrestore (&task->task_state_lock, flags); rc =TMF_RESP_FUNC_COMPLETE ;
@@ -1694,10 +1694,10 @@ static int hisi_sas_abort_task(struct sas_task *task)if (((rc <0 ) || (rc ==TMF_RESP_FUNC_FAILED )) && task->lldd_task) {/* -* flush tasklet to avoid free'ing task +* sync irq to avoid free'ing task * before using task in IO completion */ -tasklet_kill (&cq->tasklet); +synchronize_irq (cq->irq_no); slot->task =NULL ; } }
@@ -2076,10 +2076,10 @@ _hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue];/* -* flush tasklet to avoid free'ing task +* sync irq to avoid free'ing task * before using task in IO completion */ -tasklet_kill (&cq->tasklet); +synchronize_irq (cq->irq_no); slot->task =NULL ; }dev_err (dev,"internal task abort: timeout and not done.\n" );
@@ -2225,17 +2225,17 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy) }EXPORT_SYMBOL_GPL (hisi_sas_phy_down); -void hisi_sas_kill_tasklets (struct hisi_hba *hisi_hba) +void hisi_sas_sync_irqs (struct hisi_hba *hisi_hba) {int i;for (i =0 ; i < hisi_hba->cq_nvecs; i++) {struct hisi_sas_cq *cq = &hisi_hba->cq[i]; -tasklet_kill (&cq->tasklet); +synchronize_irq (cq->irq_no); } } -EXPORT_SYMBOL_GPL (hisi_sas_kill_tasklets); +EXPORT_SYMBOL_GPL (hisi_sas_sync_irqs);int hisi_sas_host_reset (struct Scsi_Host *shost,int reset_type) {
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +10 -16
@@ -3111,9 +3111,9 @@ static irqreturn_t fatal_axi_int_v2_hw(int irq_no, void *p)return IRQ_HANDLED ; } -static void cq_tasklet_v2_hw (unsigned long val) +static irqreturn_t cq_thread_v2_hw (int irq_no,void *p) { -struct hisi_sas_cq *cq = (struct hisi_sas_cq *)val; +struct hisi_sas_cq *cq = p;struct hisi_hba *hisi_hba = cq->hisi_hba;struct hisi_sas_slot *slot;struct hisi_sas_itct *itct;
@@ -3181,6 +3181,8 @@ static void cq_tasklet_v2_hw(unsigned long val)/* update rd_point */ cq->rd_point = rd_point;hisi_sas_write32 (hisi_hba,COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); + +return IRQ_HANDLED ; }static irqreturn_t cq_interrupt_v2_hw (int irq_no,void *p)
@@ -3191,9 +3193,7 @@ static irqreturn_t cq_interrupt_v2_hw(int irq_no, void *p)hisi_sas_write32 (hisi_hba,OQ_INT_SRC ,1 << queue); -tasklet_schedule (&cq->tasklet); - -return IRQ_HANDLED ; +return IRQ_WAKE_THREAD ; }static irqreturn_t sata_int_v2_hw (int irq_no,void *p)
@@ -3360,18 +3360,18 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)for (queue_no =0 ; queue_no < hisi_hba->queue_count; queue_no++) {struct hisi_sas_cq *cq = &hisi_hba->cq[queue_no]; -struct tasklet_struct *t = &cq->tasklet; - irq = irq_map[queue_no +96 ]; - rc =devm_request_irq (dev, irq, cq_interrupt_v2_hw,0 , -DRV_NAME " cq" , cq); + cq->irq_no = irq_map[queue_no +96 ]; + rc =devm_request_threaded_irq (dev, cq->irq_no, + cq_interrupt_v2_hw, + cq_thread_v2_hw,IRQF_ONESHOT , +DRV_NAME " cq" , cq);if (rc) {dev_err (dev,"irq init: could not request cq interrupt %d, rc=%d\n" , irq, rc); rc = -ENOENT ; goto err_out; } -tasklet_init (t, cq_tasklet_v2_hw, (unsigned long )cq); } hisi_hba->cq_nvecs = hisi_hba->queue_count;
@@ -3432,7 +3432,6 @@ static int soft_reset_v2_hw(struct hisi_hba *hisi_hba)interrupt_disable_v2_hw (hisi_hba);hisi_sas_write32 (hisi_hba,DLVRY_QUEUE_ENABLE ,0x0 ); -hisi_sas_kill_tasklets (hisi_hba);hisi_sas_stop_phys (hisi_hba);
@@ -3606,11 +3605,6 @@ static int hisi_sas_v2_probe(struct platform_device *pdev)static int hisi_sas_v2_remove (struct platform_device *pdev) { -struct sas_ha_struct *sha =platform_get_drvdata (pdev); -struct hisi_hba *hisi_hba = sha->lldd_ha; - -hisi_sas_kill_tasklets (hisi_hba); -return hisi_sas_remove (pdev); }
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +14 -16
@@ -2299,9 +2299,9 @@ slot_complete_v3_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot)return sts; } -static void cq_tasklet_v3_hw (unsigned long val) +static irqreturn_t cq_thread_v3_hw (int irq_no,void *p) { -struct hisi_sas_cq *cq = (struct hisi_sas_cq *)val; +struct hisi_sas_cq *cq = p;struct hisi_hba *hisi_hba = cq->hisi_hba;struct hisi_sas_slot *slot;struct hisi_sas_complete_v3_hdr *complete_queue;
@@ -2338,6 +2338,8 @@ static void cq_tasklet_v3_hw(unsigned long val)/* update rd_point */ cq->rd_point = rd_point;hisi_sas_write32 (hisi_hba,COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); + +return IRQ_HANDLED ; }static irqreturn_t cq_interrupt_v3_hw (int irq_no,void *p)
@@ -2348,9 +2350,7 @@ static irqreturn_t cq_interrupt_v3_hw(int irq_no, void *p)hisi_sas_write32 (hisi_hba,OQ_INT_SRC ,1 << queue); -tasklet_schedule (&cq->tasklet); - -return IRQ_HANDLED ; +return IRQ_WAKE_THREAD ; }static void setup_reply_map_v3_hw (struct hisi_hba *hisi_hba,int nvecs)
@@ -2441,15 +2441,17 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) goto free_irq_vectors; } -/* Init tasklets for cq only */ for (i =0 ; i < hisi_hba->cq_nvecs; i++) {struct hisi_sas_cq *cq = &hisi_hba->cq[i]; -struct tasklet_struct *t = &cq->tasklet;int nr = hisi_sas_intr_conv ?16 :16 + i; -unsigned long irqflags = hisi_sas_intr_conv ?IRQF_SHARED :0 ; - - rc =devm_request_irq (dev,pci_irq_vector (pdev, nr), - cq_interrupt_v3_hw, irqflags, +unsigned long irqflags = hisi_sas_intr_conv ?IRQF_SHARED : +IRQF_ONESHOT ; + + cq->irq_no =pci_irq_vector (pdev, nr); + rc =devm_request_threaded_irq (dev, cq->irq_no, + cq_interrupt_v3_hw, + cq_thread_v3_hw, + irqflags,DRV_NAME " cq" , cq);if (rc) { dev_err(dev, "could not request cq%d interrupt, rc=%d\n",
@@ -2457,8 +2459,6 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) rc = -ENOENT ; goto free_irq_vectors; } - -tasklet_init (t, cq_tasklet_v3_hw, (unsigned long )cq); }return 0 ;
@@ -2534,7 +2534,6 @@ static int disable_host_v3_hw(struct hisi_hba *hisi_hba)interrupt_disable_v3_hw (hisi_hba);hisi_sas_write32 (hisi_hba,DLVRY_QUEUE_ENABLE ,0x0 ); -hisi_sas_kill_tasklets (hisi_hba);hisi_sas_stop_phys (hisi_hba);
@@ -2910,7 +2909,7 @@ static void debugfs_snapshot_prepare_v3_hw(struct hisi_hba *hisi_hba)wait_cmds_complete_timeout_v3_hw (hisi_hba,100 ,5000 ); -hisi_sas_kill_tasklets (hisi_hba); +hisi_sas_sync_irqs (hisi_hba); }static void debugfs_snapshot_restore_v3_hw (struct hisi_hba *hisi_hba)
@@ -3312,7 +3311,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)sas_remove_host (sha->core.shost);hisi_sas_v3_destroy_irqs (pdev, hisi_hba); -hisi_sas_kill_tasklets (hisi_hba);pci_release_regions (pdev);pci_disable_device (pdev);hisi_sas_free (hisi_hba);
Signature · 1 line
2.17.1
PATCH 2/7 scsi: hisi_sas: replace spin_lock_irqsave/spin_unlock_restore with spin_lock/spin_unlock
In reply to John GarryFrom: Xiang Chen <[email protected]>
After changed tasklet to workqueue or threaded irq, some critical resources are only used on threads (not in interrupt or bottom half of interrupt), so replace spin_lock_irqsave/spin_unlock_restore with spin_lock/spin_unlock to protect those critical resources.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 48 +++++++++++--------------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 12 +++---- 2 files changed, 26 insertions(+), 34 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +21 -27
@@ -163,13 +163,11 @@ static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx)static void hisi_sas_slot_index_free (struct hisi_hba *hisi_hba,int slot_idx) { -unsigned long flags; -if (hisi_hba->hw->slot_index_alloc || slot_idx >=HISI_SAS_UNRESERVED_IPTT ) { -spin_lock_irqsave (&hisi_hba->lock, flags); +spin_lock (&hisi_hba->lock);hisi_sas_slot_index_clear (hisi_hba, slot_idx); -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock); } }
@@ -185,12 +183,11 @@ static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, {int index;void *bitmap = hisi_hba->slot_index_tags; -unsigned long flags;if (scsi_cmnd)return scsi_cmnd->request->tag; -spin_lock_irqsave (&hisi_hba->lock, flags); +spin_lock (&hisi_hba->lock); index =find_next_zero_bit (bitmap, hisi_hba->slot_index_count, hisi_hba->last_slot_index +1 );if (index >= hisi_hba->slot_index_count) {
@@ -198,13 +195,13 @@ static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, hisi_hba->slot_index_count, HISI_SAS_UNRESERVED_IPTT);if (index >= hisi_hba->slot_index_count) { -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock);return -SAS_QUEUE_FULL ; } }hisi_sas_slot_index_set (hisi_hba, index); hisi_hba->last_slot_index = index; -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock);return index; }
@@ -220,7 +217,6 @@ static void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba)void hisi_sas_slot_task_free (struct hisi_hba *hisi_hba,struct sas_task *task,struct hisi_sas_slot *slot) { -unsigned long flags;int device_id = slot->device_id;struct hisi_sas_device *sas_dev = &hisi_hba->devices[device_id];
@@ -247,9 +243,9 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, } } -spin_lock_irqsave (&sas_dev->lock, flags); +spin_lock (&sas_dev->lock);list_del_init (&slot->entry); -spin_unlock_irqrestore (&sas_dev->lock, flags); +spin_unlock (&sas_dev->lock);memset (slot,0 , offsetof(struct hisi_sas_slot , buf));
@@ -489,14 +485,14 @@ static int hisi_sas_task_prep(struct sas_task *task, slot_idx = rc; slot = &hisi_hba->slot_info[slot_idx]; -spin_lock_irqsave (&dq->lock, flags); +spin_lock (&dq->lock); wr_q_index = dq->wr_point; dq->wr_point = (dq->wr_point +1 ) %HISI_SAS_QUEUE_SLOTS ;list_add_tail (&slot->delivery, &dq->list); -spin_unlock_irqrestore (&dq->lock, flags); -spin_lock_irqsave (&sas_dev->lock, flags); +spin_unlock (&dq->lock); +spin_lock (&sas_dev->lock);list_add_tail (&slot->entry, &sas_dev->list); -spin_unlock_irqrestore (&sas_dev->lock, flags); +spin_unlock (&sas_dev->lock); dlvry_queue = dq->id; dlvry_queue_slot = wr_q_index;
@@ -562,7 +558,6 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, {u32 rc;u32 pass =0 ; -unsigned long flags;struct hisi_hba *hisi_hba;struct device *dev;struct domain_device *device = task->dev;
@@ -606,9 +601,9 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,dev_err (dev,"task exec: failed[%d]!\n" , rc);if (likely (pass)) { -spin_lock_irqsave (&dq->lock, flags); +spin_lock (&dq->lock); hisi_hba->hw->start_delivery (dq); -spin_unlock_irqrestore (&dq->lock, flags); +spin_unlock (&dq->lock); }return rc;
@@ -659,12 +654,11 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) {struct hisi_hba *hisi_hba =dev_to_hisi_hba (device);struct hisi_sas_device *sas_dev =NULL ; -unsigned long flags;int last = hisi_hba->last_dev_id;int first = (hisi_hba->last_dev_id +1 ) %HISI_SAS_MAX_DEVICES ;int i; -spin_lock_irqsave (&hisi_hba->lock, flags); +spin_lock (&hisi_hba->lock);for (i = first; i != last; i %=HISI_SAS_MAX_DEVICES ) {if (hisi_hba->devices[i].dev_type ==SAS_PHY_UNUSED ) {int queue = i % hisi_hba->queue_count;
@@ -684,7 +678,7 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) i++; } hisi_hba->last_dev_id = i; -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock);return sas_dev; }
@@ -1965,14 +1959,14 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, slot_idx = rc; slot = &hisi_hba->slot_info[slot_idx]; -spin_lock_irqsave (&dq->lock, flags); +spin_lock (&dq->lock); wr_q_index = dq->wr_point; dq->wr_point = (dq->wr_point +1 ) %HISI_SAS_QUEUE_SLOTS ;list_add_tail (&slot->delivery, &dq->list); -spin_unlock_irqrestore (&dq->lock, flags); -spin_lock_irqsave (&sas_dev->lock, flags); +spin_unlock (&dq->lock); +spin_lock (&sas_dev->lock);list_add_tail (&slot->entry, &sas_dev->list); -spin_unlock_irqrestore (&sas_dev->lock, flags); +spin_unlock (&sas_dev->lock); dlvry_queue = dq->id; dlvry_queue_slot = wr_q_index;
@@ -2001,9 +1995,9 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,spin_unlock_irqrestore (&task->task_state_lock, flags);WRITE_ONCE (slot->ready,1 );/* send abort command to the chip */ -spin_lock_irqsave (&dq->lock, flags); +spin_lock (&dq->lock); hisi_hba->hw->start_delivery (dq); -spin_unlock_irqrestore (&dq->lock, flags); +spin_unlock (&dq->lock);return 0 ;
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +5 -7
@@ -773,7 +773,6 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba,struct hisi_sas_device *sas_dev = device->lldd_dev;int sata_idx = sas_dev->sata_idx;int start, end; -unsigned long flags;if (!sata_dev) {/*
@@ -797,12 +796,12 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, end =64 * (sata_idx +2 ); } -spin_lock_irqsave (&hisi_hba->lock, flags); +spin_lock (&hisi_hba->lock);while (1 ) { start =find_next_zero_bit (bitmap, hisi_hba->slot_index_count, start);if (start >= end) { -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock);return -SAS_QUEUE_FULL ; }/*
@@ -814,7 +813,7 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, }set_bit (start, bitmap); -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock);return start; }
@@ -843,9 +842,8 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device)struct hisi_sas_device *sas_dev =NULL ;int i, sata_dev =dev_is_sata (device);int sata_idx =-1 ; -unsigned long flags; -spin_lock_irqsave (&hisi_hba->lock, flags); +spin_lock (&hisi_hba->lock);if (sata_dev)if (!sata_index_alloc_v2_hw (hisi_hba, &sata_idx))
@@ -876,7 +874,7 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device) } out: -spin_unlock_irqrestore (&hisi_hba->lock, flags); +spin_unlock (&hisi_hba->lock);return sas_dev; }
Signature · 1 line
2.17.1
PATCH 3/7 scsi: hisi_sas: Replace magic number when handle channel interrupt
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
We use magic number as offset and mask when handle channel interrupt, so use marco to replace it.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +12 -5
@@ -495,6 +495,13 @@ struct hisi_sas_err_record_v3 {#define BASE_VECTORS_V3_HW 16#define MIN_AFFINE_VECTORS_V3_HW (BASE_VECTORS_V3_HW + 1) +#define CHNL_INT_STS_MSK 0xeeeeeeee +#define CHNL_INT_STS_PHY_MSK 0xe +#define CHNL_INT_STS_INT0_MSK BIT(1) +#define CHNL_INT_STS_INT1_MSK BIT(2) +#define CHNL_INT_STS_INT2_MSK BIT(3) +#define CHNL_WIDTH 4 +enum {DSM_FUNC_ERR_HANDLE_MSI =0 , };
@@ -1819,19 +1826,19 @@ static irqreturn_t int_chnl_int_v3_hw(int irq_no, void *p)int phy_no =0 ; irq_msk =hisi_sas_read32 (hisi_hba,CHNL_INT_STATUS ) - &0xeeeeeeee ; + &CHNL_INT_STS_MSK ;while (irq_msk) { -if (irq_msk & (2 << (phy_no *4 ))) +if (irq_msk & (CHNL_INT_STS_INT0_MSK << (phy_no *CHNL_WIDTH )))handle_chl_int0_v3_hw (hisi_hba, phy_no); -if (irq_msk & (4 << (phy_no *4 ))) +if (irq_msk & (CHNL_INT_STS_INT1_MSK << (phy_no *CHNL_WIDTH )))handle_chl_int1_v3_hw (hisi_hba, phy_no); -if (irq_msk & (8 << (phy_no *4 ))) +if (irq_msk & (CHNL_INT_STS_INT2_MSK << (phy_no *CHNL_WIDTH )))handle_chl_int2_v3_hw (hisi_hba, phy_no); - irq_msk &= ~(0xe << (phy_no *4 )); + irq_msk &= ~(CHNL_INT_STS_PHY_MSK << (phy_no *CHNL_WIDTH )); phy_no++; }
Signature · 1 line
2.17.1
PATCH 4/7 scsi: hisi_sas: Modify the file permissions of trigger_dump to write only
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
The trigger_dump file is only used to manually trigger the dump, and did not provide a read callback function for it, so it's file permission setting to 600 is wrong, and should be changed to 200.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -3930,7 +3930,7 @@ void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba) hisi_hba->debugfs_dir =debugfs_create_dir (dev_name (dev), hisi_sas_debugfs_dir); -debugfs_create_file ("trigger_dump" ,0600 , +debugfs_create_file ("trigger_dump" ,0200 , hisi_hba->debugfs_dir, hisi_hba, &hisi_sas_debugfs_trigger_dump_fops);
Signature · 1 line
2.17.1
PATCH 5/7 scsi: hisi_sas: Add prints for v3 hw interrupt converge and automatic affinity
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
Add prints to inform the user of enabled features.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +5 -0
@@ -2396,6 +2396,8 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) .pre_vectors = BASE_VECTORS_V3_HW, }; +dev_info (dev,"Enable MSI auto-affinity\n" ); + min_msi =MIN_AFFINE_VECTORS_V3_HW ; hisi_hba->reply_map = devm_kcalloc(dev, nr_cpu_ids,
@@ -2448,6 +2450,9 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) goto free_irq_vectors; } +if (hisi_sas_intr_conv) +dev_info (dev,"Enable interrupt converge\n" ); +for (i =0 ; i < hisi_hba->cq_nvecs; i++) {struct hisi_sas_cq *cq = &hisi_hba->cq[i];int nr = hisi_sas_intr_conv ?16 :16 + i;
Signature · 1 line
2.17.1
PATCH 6/7 scsi: hisi_sas: Rename hisi_sas_cq.pci_irq_mask
In reply to John GarryIn future we will want to use hisi_sas_cq.pci_irq_mask for non-pci interrupt masks, so rename to be more general.
--- drivers/scsi/hisi_sas/hisi_sas.h | 2 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +1 -1
@@ -180,7 +180,7 @@ struct hisi_sas_port {struct hisi_sas_cq {struct hisi_hba *hisi_hba; -const struct cpumask *pci_irq_mask; +const struct cpumask *irq_mask;int rd_point;int id;int irq_no;
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -2125,7 +2125,7 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,case HISI_SAS_INT_ABT_DEV :for (i =0 ; i < hisi_hba->cq_nvecs; i++) {struct hisi_sas_cq *cq = &hisi_hba->cq[i]; -const struct cpumask *mask = cq->pci_irq_mask; +const struct cpumask *mask = cq->irq_mask;if (mask && !cpumask_intersects (cpu_online_mask, mask))continue ;
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -1
@@ -2372,7 +2372,7 @@ static void setup_reply_map_v3_hw(struct hisi_hba *hisi_hba, int nvecs) BASE_VECTORS_V3_HW);if (!mask) goto fallback; - cq->pci_irq_mask = mask; + cq->irq_mask = mask;for_each_cpu (cpu, mask) hisi_hba->reply_map[cpu] = queue; }
Signature · 1 line
2.17.1
PATCH 7/7 scsi: hisi_sas: Use reply map for v2 hw
In reply to John GarryWith the aim of boosting performance, switch v2 hw to using reply map, i.e. pseudo blk-mq.
This really when we're running a distro with irqbalance running. The reason being that the irqbalance can fiddle with the completion queue affinity, such that we random cpus servicing the CQs. It's not much better without irqbalance, where it is always cpu0.
Distro read fio performance for 6x SAS SSDs goes from ~450K IOPS -> 650K IOPS.
To continuing support manually setting the irq affinity, introduce module parameter auto_affine_interrupts, which is default off.
--- drivers/scsi/hisi_sas/hisi_sas.h | 3 ++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 54 +++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas.h +3 -0
@@ -10,6 +10,7 @@#include <linux/acpi.h> #include <linux/clk.h> #include <linux/debugfs.h> +#include <linux/device.h> #include <linux/dmapool.h> #include <linux/iopoll.h> #include <linux/lcm.h>
@@ -385,6 +386,8 @@ struct hisi_hba {spinlock_t lock;struct semaphore sem; +struct irq_affinity_desc affinity_masks[HISI_SAS_MAX_QUEUES ]; +struct timer_list timer;struct workqueue_struct *wq;
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +53 -1
88 lines not on this page · raw message
Signature · 1 line
2.17.1
Martin K. Petersen
AppliedJohn,
Quoted 2 lines
This series introduces some misc patches for the driver for the v5.6 cycle.
Applied to 5.6/scsi-queue, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering