Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: mpt3sas: Use high iops queues under some circumstances

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: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Suganath Prabu S and committed by
Martin K. Petersen
5dd48a55 02136516

+48 -2
+35 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 3323 3323 } 3324 3324 3325 3325 /** 3326 + * _base_get_high_iops_msix_index - get the msix index of 3327 + * high iops queues 3328 + * @ioc: per adapter object 3329 + * @scmd: scsi_cmnd object 3330 + * 3331 + * Returns: msix index of high iops reply queues. 3332 + * i.e. high iops reply queue on which IO request's 3333 + * reply should be posted by the HBA firmware. 3334 + */ 3335 + static inline u8 3336 + _base_get_high_iops_msix_index(struct MPT3SAS_ADAPTER *ioc, 3337 + struct scsi_cmnd *scmd) 3338 + { 3339 + /** 3340 + * Round robin the IO interrupts among the high iops 3341 + * reply queues in terms of batch count 16 when outstanding 3342 + * IOs on the target device is >=8. 3343 + */ 3344 + if (atomic_read(&scmd->device->device_busy) > 3345 + MPT3SAS_DEVICE_HIGH_IOPS_DEPTH) 3346 + return base_mod64(( 3347 + atomic64_add_return(1, &ioc->high_iops_outstanding) / 3348 + MPT3SAS_HIGH_IOPS_BATCH_COUNT), 3349 + MPT3SAS_HIGH_IOPS_REPLY_QUEUES); 3350 + 3351 + return _base_get_msix_index(ioc, scmd); 3352 + } 3353 + 3354 + /** 3326 3355 * mpt3sas_base_get_smid - obtain a free smid from internal queue 3327 3356 * @ioc: per adapter object 3328 3357 * @cb_idx: callback index ··· 6736 6707 ioc->build_sg_scmd = &_base_build_sg_scmd; 6737 6708 ioc->build_sg = &_base_build_sg; 6738 6709 ioc->build_zero_len_sge = &_base_build_zero_len_sge; 6710 + ioc->get_msix_index_for_smlio = &_base_get_msix_index; 6739 6711 break; 6740 6712 case MPI25_VERSION: 6741 6713 case MPI26_VERSION: ··· 6751 6721 ioc->build_nvme_prp = &_base_build_nvme_prp; 6752 6722 ioc->build_zero_len_sge = &_base_build_zero_len_sge_ieee; 6753 6723 ioc->sge_size_ieee = sizeof(Mpi2IeeeSgeSimple64_t); 6754 - 6724 + if (ioc->high_iops_queues) 6725 + ioc->get_msix_index_for_smlio = 6726 + &_base_get_high_iops_msix_index; 6727 + else 6728 + ioc->get_msix_index_for_smlio = &_base_get_msix_index; 6755 6729 break; 6756 6730 } 6757 6731 if (ioc->atomic_desc_capable) {
+13 -1
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 356 356 #define VIRTUAL_IO_FAILED_RETRY (0x32010081) 357 357 358 358 /* High IOPs definitions */ 359 + #define MPT3SAS_DEVICE_HIGH_IOPS_DEPTH 8 359 360 #define MPT3SAS_HIGH_IOPS_REPLY_QUEUES 8 361 + #define MPT3SAS_HIGH_IOPS_BATCH_COUNT 16 360 362 #define MPT3SAS_GEN35_MAX_MSIX_QUEUES 128 361 363 362 364 /* OEM Specific Flags will come from OEM specific header files */ ··· 930 928 u16 funcdep); 931 929 typedef void (*PUT_SMID_DEFAULT) (struct MPT3SAS_ADAPTER *ioc, u16 smid); 932 930 typedef u32 (*BASE_READ_REG) (const volatile void __iomem *addr); 931 + /* 932 + * To get high iops reply queue's msix index when high iops mode is enabled 933 + * else get the msix index of general reply queues. 934 + */ 935 + typedef u8 (*GET_MSIX_INDEX) (struct MPT3SAS_ADAPTER *ioc, 936 + struct scsi_cmnd *scmd); 933 937 934 938 /* IOC Facts and Port Facts converted from little endian to cpu */ 935 939 union mpi3_version_union { ··· 1037 1029 * @cpu_msix_table: table for mapping cpus to msix index 1038 1030 * @cpu_msix_table_sz: table size 1039 1031 * @total_io_cnt: Gives total IO count, used to load balance the interrupts 1032 + * @high_iops_outstanding: used to load balance the interrupts 1033 + * within high iops reply queues 1040 1034 * @msix_load_balance: Enables load balancing of interrupts across 1041 1035 * the multiple MSIXs 1042 1036 * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands ··· 1162 1152 * crash. To avoid the above race condition we use mutex syncrhonization 1163 1153 * which ensures the syncrhonization between cli/sysfs_show path. 1164 1154 * @atomic_desc_capable: Atomic Request Descriptor support. 1155 + * @GET_MSIX_INDEX: Get the msix index of high iops queues. 1165 1156 */ 1166 1157 struct MPT3SAS_ADAPTER { 1167 1158 struct list_head list; ··· 1222 1211 MPT3SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds; 1223 1212 u32 non_operational_loop; 1224 1213 atomic64_t total_io_cnt; 1214 + atomic64_t high_iops_outstanding; 1225 1215 bool msix_load_balance; 1226 1216 u16 thresh_hold; 1227 1217 u8 high_iops_queues; ··· 1444 1432 PUT_SMID_IO_FP_HIP put_smid_fast_path; 1445 1433 PUT_SMID_IO_FP_HIP put_smid_hi_priority; 1446 1434 PUT_SMID_DEFAULT put_smid_default; 1447 - 1435 + GET_MSIX_INDEX get_msix_index_for_smlio; 1448 1436 }; 1449 1437 1450 1438 typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,