Re: [PATCH V5 04/11] megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing
On 14.12.2016 23:13, Sasikumar Chandrasekaran wrote: > Detect sequential IO streams and pass those IOs directly to FW. > > This patch is depending on patch 3 > This patch is same as V4 and there is no specific update for V5 That is not correct, I'm glad to see several whitespace changes (for example a non-ascii char has been removed). Other then the indentation is still not correct - see in text. I haven't found any other important issues so ok. > > Signed-off-by: Sasikumar Chandrasekaran> Reviewed-by: Tomas Henzl > --- > drivers/scsi/megaraid/megaraid_sas.h| 1 + > drivers/scsi/megaraid/megaraid_sas_base.c | 43 +++- > drivers/scsi/megaraid/megaraid_sas_fp.c | 2 + > drivers/scsi/megaraid/megaraid_sas_fusion.c | 163 > +++- > drivers/scsi/megaraid/megaraid_sas_fusion.h | 117 +++- > 5 files changed, 295 insertions(+), 31 deletions(-) > > diff --git a/drivers/scsi/megaraid/megaraid_sas.h > b/drivers/scsi/megaraid/megaraid_sas.h > index 36aac88..3d86bc6 100644 > --- a/drivers/scsi/megaraid/megaraid_sas.h > +++ b/drivers/scsi/megaraid/megaraid_sas.h > @@ -2070,6 +2070,7 @@ struct megasas_instance { > /* used to sync fire the cmd to fw */ > spinlock_t hba_lock; > /* used to synch producer, consumer ptrs in dpc */ > + spinlock_t stream_lock; > spinlock_t completion_lock; > struct dma_pool *frame_dma_pool; > struct dma_pool *sense_dma_pool; > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c > b/drivers/scsi/megaraid/megaraid_sas_base.c > index 5a1a53b..8e20992 100644 > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > @@ -5001,7 +5001,7 @@ static int megasas_init_fw(struct megasas_instance > *instance) > struct megasas_register_set __iomem *reg_set; > struct megasas_ctrl_info *ctrl_info = NULL; > unsigned long bar_list; > - int i, loop, fw_msix_count = 0; > + int i, j, loop, fw_msix_count = 0; > struct IOV_111 *iovPtr; > struct fusion_context *fusion; > > @@ -5194,6 +5194,36 @@ static int megasas_init_fw(struct megasas_instance > *instance) > } > > memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); > + > + /* stream detection initialization */ > + if (instance->is_ventura) { > + fusion->stream_detect_by_ld = > + kzalloc(sizeof(struct LD_STREAM_DETECT *) > + * MAX_LOGICAL_DRIVES_EXT, > + GFP_KERNEL); > + if (!fusion->stream_detect_by_ld) { > + dev_err(>pdev->dev, > + "unable to allocate stream detection > for pool of LDs\n"); > + goto fail_get_ld_pd_list; > + } > + for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i) { > + fusion->stream_detect_by_ld[i] = > + kmalloc(sizeof(struct LD_STREAM_DETECT), > + GFP_KERNEL); > + if (!fusion->stream_detect_by_ld[i]) { > + dev_err(>pdev->dev, > + "unable to allocate stream detect by > LD\n "); > + for (j = 0; j < i; ++j) > + kfree(fusion->stream_detect_by_ld[j]); > + kfree(fusion->stream_detect_by_ld); > + fusion->stream_detect_by_ld = NULL; > + goto fail_get_ld_pd_list; > + } > + fusion->stream_detect_by_ld[i]->mru_bit_map > + = MR_STREAM_BITMAP; > + } > + } > + > if (megasas_ld_list_query(instance, > MR_LD_QUERY_TYPE_EXPOSED_TO_HOST)) > megasas_get_ld_list(instance); > @@ -5313,6 +5343,8 @@ static int megasas_init_fw(struct megasas_instance > *instance) > > return 0; > > +fail_get_ld_pd_list: > + instance->instancet->disable_intr(instance); > fail_get_pd_list: > instance->instancet->disable_intr(instance); > fail_init_adapter: > @@ -5846,6 +5878,7 @@ static int megasas_probe_one(struct pci_dev *pdev, > > spin_lock_init(>mfi_pool_lock); > spin_lock_init(>hba_lock); > + spin_lock_init(>stream_lock); > spin_lock_init(>completion_lock); > > mutex_init(>reset_mutex); > @@ -6353,6 +6386,14 @@ static void megasas_detach_one(struct pci_dev *pdev) > if (instance->msix_vectors) > pci_free_irq_vectors(instance->pdev); > > + if (instance->is_ventura) { > + for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i) > + kfree(fusion->stream_detect_by_ld[i]); > + kfree(fusion->stream_detect_by_ld); > + fusion->stream_detect_by_ld = NULL; > + } > + > + > if (instance->ctrl_context) { >
[PATCH V5 04/11] megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing
Detect sequential IO streams and pass those IOs directly to FW. This patch is depending on patch 3 This patch is same as V4 and there is no specific update for V5 Signed-off-by: Sasikumar ChandrasekaranReviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas.h| 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 43 +++- drivers/scsi/megaraid/megaraid_sas_fp.c | 2 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 163 +++- drivers/scsi/megaraid/megaraid_sas_fusion.h | 117 +++- 5 files changed, 295 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 36aac88..3d86bc6 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2070,6 +2070,7 @@ struct megasas_instance { /* used to sync fire the cmd to fw */ spinlock_t hba_lock; /* used to synch producer, consumer ptrs in dpc */ + spinlock_t stream_lock; spinlock_t completion_lock; struct dma_pool *frame_dma_pool; struct dma_pool *sense_dma_pool; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5a1a53b..8e20992 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5001,7 +5001,7 @@ static int megasas_init_fw(struct megasas_instance *instance) struct megasas_register_set __iomem *reg_set; struct megasas_ctrl_info *ctrl_info = NULL; unsigned long bar_list; - int i, loop, fw_msix_count = 0; + int i, j, loop, fw_msix_count = 0; struct IOV_111 *iovPtr; struct fusion_context *fusion; @@ -5194,6 +5194,36 @@ static int megasas_init_fw(struct megasas_instance *instance) } memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); + + /* stream detection initialization */ + if (instance->is_ventura) { + fusion->stream_detect_by_ld = + kzalloc(sizeof(struct LD_STREAM_DETECT *) + * MAX_LOGICAL_DRIVES_EXT, + GFP_KERNEL); + if (!fusion->stream_detect_by_ld) { + dev_err(>pdev->dev, + "unable to allocate stream detection for pool of LDs\n"); + goto fail_get_ld_pd_list; + } + for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i) { + fusion->stream_detect_by_ld[i] = + kmalloc(sizeof(struct LD_STREAM_DETECT), + GFP_KERNEL); + if (!fusion->stream_detect_by_ld[i]) { + dev_err(>pdev->dev, + "unable to allocate stream detect by LD\n "); +for (j = 0; j < i; ++j) + kfree(fusion->stream_detect_by_ld[j]); + kfree(fusion->stream_detect_by_ld); + fusion->stream_detect_by_ld = NULL; + goto fail_get_ld_pd_list; + } + fusion->stream_detect_by_ld[i]->mru_bit_map + = MR_STREAM_BITMAP; + } + } + if (megasas_ld_list_query(instance, MR_LD_QUERY_TYPE_EXPOSED_TO_HOST)) megasas_get_ld_list(instance); @@ -5313,6 +5343,8 @@ static int megasas_init_fw(struct megasas_instance *instance) return 0; +fail_get_ld_pd_list: + instance->instancet->disable_intr(instance); fail_get_pd_list: instance->instancet->disable_intr(instance); fail_init_adapter: @@ -5846,6 +5878,7 @@ static int megasas_probe_one(struct pci_dev *pdev, spin_lock_init(>mfi_pool_lock); spin_lock_init(>hba_lock); + spin_lock_init(>stream_lock); spin_lock_init(>completion_lock); mutex_init(>reset_mutex); @@ -6353,6 +6386,14 @@ static void megasas_detach_one(struct pci_dev *pdev) if (instance->msix_vectors) pci_free_irq_vectors(instance->pdev); + if (instance->is_ventura) { + for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i) + kfree(fusion->stream_detect_by_ld[i]); + kfree(fusion->stream_detect_by_ld); + fusion->stream_detect_by_ld = NULL; + } + + if (instance->ctrl_context) { megasas_release_fusion(instance); pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index f237d00..a4e213b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -935,6 +935,8 @@ u8