scsi: megaraid_sas: Use high IOPS queues based on IO workload
authorChandrakanth Patil <chandrakanth.patil@broadcom.com>
Tue, 25 Jun 2019 11:04:34 +0000 (16:34 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 27 Jun 2019 04:07:36 +0000 (00:07 -0400)
The driver will use round-robin method for IO submission in batches within
the high IOPS queues when the number of in-flight ios on the target device
is larger than 8. Otherwise the driver will use low latency reply queues.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_fp.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/megaraid/megaraid_sas_fusion.h

index 02e6e15..3f4cb52 100644 (file)
@@ -2253,6 +2253,8 @@ enum MR_PD_TYPE {
 
 /*Aero performance parameters*/
 #define MR_HIGH_IOPS_QUEUE_COUNT       8
+#define MR_DEVICE_HIGH_IOPS_DEPTH      8
+#define MR_HIGH_IOPS_BATCH_COUNT       16
 
 struct megasas_instance {
 
@@ -2362,6 +2364,7 @@ struct megasas_instance {
        atomic_t ldio_outstanding;
        atomic_t fw_reset_no_pci_access;
        atomic64_t total_io_count;
+       atomic64_t high_iops_outstanding;
 
        struct megasas_instance_template *instancet;
        struct tasklet_struct isr_tasklet;
index 43a2e49..f9f7c34 100644 (file)
@@ -1038,6 +1038,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
        stripSize = 1 << raid->stripeShift;
        stripe_mask = stripSize-1;
 
+       io_info->data_arms = raid->rowDataSize;
 
        /*
         * calculate starting row and stripe, and number of strips and rows
index 845ca2f..90dced4 100644 (file)
@@ -2811,6 +2811,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
        io_info.r1_alt_dev_handle = MR_DEVHANDLE_INVALID;
        scsi_buff_len = scsi_bufflen(scp);
        io_request->DataLength = cpu_to_le32(scsi_buff_len);
+       io_info.data_arms = 1;
 
        if (scp->sc_data_direction == DMA_FROM_DEVICE)
                io_info.isRead = 1;
@@ -2830,7 +2831,13 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
                        fp_possible = (io_info.fpOkForIo > 0) ? true : false;
        }
 
-       if (instance->msix_load_balance)
+       if (instance->balanced_mode &&
+               atomic_read(&scp->device->device_busy) >
+               (io_info.data_arms * MR_DEVICE_HIGH_IOPS_DEPTH))
+               cmd->request_desc->SCSIIO.MSIxIndex =
+                       mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) /
+                               MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start);
+       else if (instance->msix_load_balance)
                cmd->request_desc->SCSIIO.MSIxIndex =
                        (mega_mod64(atomic64_add_return(1, &instance->total_io_count),
                                    instance->msix_vectors));
@@ -3157,7 +3164,12 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
 
        cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
 
-       if (instance->msix_load_balance)
+       if (instance->balanced_mode &&
+               atomic_read(&scmd->device->device_busy) > MR_DEVICE_HIGH_IOPS_DEPTH)
+               cmd->request_desc->SCSIIO.MSIxIndex =
+                       mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) /
+                               MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start);
+       else if (instance->msix_load_balance)
                cmd->request_desc->SCSIIO.MSIxIndex =
                        (mega_mod64(atomic64_add_return(1, &instance->total_io_count),
                                    instance->msix_vectors));
index ca32b2b..6fe3343 100644 (file)
@@ -962,6 +962,7 @@ struct IO_REQUEST_INFO {
        u8  pd_after_lb;
        u16 r1_alt_dev_handle; /* raid 1/10 only */
        bool ra_capable;
+       u8 data_arms;
 };
 
 struct MR_LD_TARGET_SYNC {