Skip to content

Commit 299ee42

Browse files
cp890582martinkpetersen
authored andcommitted
scsi: megaraid_sas: Introduce various Aero performance modes
For Aero adapters, driver provides three different performance modes controlled through module parameter named 'perf_mode'. Below are those performance modes: 0: Balanced - Additional high IOPS reply queues will be enabled along with low latency queues. Interrupt coalescing will be enabled only for these high IOPS reply queues. 1: IOPS - No additional high IOPS queues are enabled. Interrupt coalescing will be enabled on all reply queues. 2: Latency - No additional high IOPS queues are enabled. Interrupt coalescing will be disabled on all reply queues. This is a legacy behavior similar to Ventura & Invader Series. Default performance mode settings: - Performance mode set to 'Balanced', if Aero controller is working in 16GT/s PCIe speed. - Performance mode will be set to 'Latency' mode for all other cases. Through module parameter 'perf_mode', user can override default performance mode to desired one. Captured some performance numbers with these performance modes. 4k Random Read IO performance numbers on 24 SAS SSD drives for above three performance modes. Performance data is from Intel Skylake and HGST SS300 (drive model SDLL1DLR400GCCA1). IOPS: ----------------------------------------------------------------------- |perf_mode | qd = 1 | qd = 64 | note | |-------------|--------|---------|------------------------------------- |balanced | 259K | 3061k | Provides max performance numbers | | | | | both on lower QD workload & | | | | | also on higher QD workload | |-------------|--------|---------|------------------------------------- |iops | 220K | 3100k | Provides max performance numbers | | | | | only on higher QD workload. | |-------------|--------|---------|------------------------------------- |latency | 246k | 2226k | Provides good performance numbers | | | | | only on lower QD worklaod. | ----------------------------------------------------------------------- Average Latency: ----------------------------------------------------- |perf_mode | qd = 1 | qd = 64 | |-------------|--------------|----------------------| |balanced | 92.05 usec | 501.12 usec | |-------------|--------------|----------------------| |iops | 108.40 usec | 498.10 usec | |-------------|--------------|----------------------| |latency | 97.10 usec | 689.26 usec | ----------------------------------------------------- Signed-off-by: Sumit Saxena <[email protected]> Signed-off-by: Chandrakanth Patil <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f39e5e5 commit 299ee42

File tree

3 files changed

+81
-15
lines changed

3 files changed

+81
-15
lines changed

drivers/scsi/megaraid/megaraid_sas.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,18 @@ enum MR_PD_TYPE {
22562256
#define MR_DEVICE_HIGH_IOPS_DEPTH 8
22572257
#define MR_HIGH_IOPS_BATCH_COUNT 16
22582258

2259+
enum MR_PERF_MODE {
2260+
MR_BALANCED_PERF_MODE = 0,
2261+
MR_IOPS_PERF_MODE = 1,
2262+
MR_LATENCY_PERF_MODE = 2,
2263+
};
2264+
2265+
#define MEGASAS_PERF_MODE_2STR(mode) \
2266+
((mode) == MR_BALANCED_PERF_MODE ? "Balanced" : \
2267+
(mode) == MR_IOPS_PERF_MODE ? "IOPS" : \
2268+
(mode) == MR_LATENCY_PERF_MODE ? "Latency" : \
2269+
"Unknown")
2270+
22592271
struct megasas_instance {
22602272

22612273
unsigned int *reply_map;
@@ -2441,7 +2453,7 @@ struct megasas_instance {
24412453
bool support_seqnum_jbod_fp;
24422454
bool support_pci_lane_margining;
24432455
u8 low_latency_index_start;
2444-
bool balanced_mode;
2456+
int perf_mode;
24452457
};
24462458

24472459
struct MR_LD_VF_MAP {

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;
105105
module_param(scmd_timeout, int, 0444);
106106
MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer.");
107107

108+
int perf_mode = -1;
109+
module_param(perf_mode, int, 0444);
110+
MODULE_PARM_DESC(perf_mode, "Performance mode (only for Aero adapters), options:\n\t\t"
111+
"0 - balanced: High iops and low latency queues are allocated &\n\t\t"
112+
"interrupt coalescing is enabled only on high iops queues\n\t\t"
113+
"1 - iops: High iops queues are not allocated &\n\t\t"
114+
"interrupt coalescing is enabled on all queues\n\t\t"
115+
"2 - latency: High iops queues are not allocated &\n\t\t"
116+
"interrupt coalescing is disabled on all queues\n\t\t"
117+
"default mode is 'balanced'"
118+
);
119+
108120
MODULE_LICENSE("GPL");
109121
MODULE_VERSION(MEGASAS_VERSION);
110122
MODULE_AUTHOR("[email protected]");
@@ -5472,7 +5484,7 @@ megasas_setup_irqs_ioapic(struct megasas_instance *instance)
54725484
__func__, __LINE__);
54735485
return -1;
54745486
}
5475-
instance->balanced_mode = false;
5487+
instance->perf_mode = MR_LATENCY_PERF_MODE;
54765488
instance->low_latency_index_start = 0;
54775489
return 0;
54785490
}
@@ -5683,7 +5695,7 @@ megasas_set_high_iops_queue_affinity_hint(struct megasas_instance *instance)
56835695
int i;
56845696
int local_numa_node;
56855697

5686-
if (instance->balanced_mode) {
5698+
if (instance->perf_mode == MR_BALANCED_PERF_MODE) {
56875699
local_numa_node = dev_to_node(&instance->pdev->dev);
56885700

56895701
for (i = 0; i < instance->low_latency_index_start; i++)
@@ -5726,11 +5738,12 @@ megasas_alloc_irq_vectors(struct megasas_instance *instance)
57265738

57275739
i = __megasas_alloc_irq_vectors(instance);
57285740

5729-
if (instance->balanced_mode && (i != instance->msix_vectors)) {
5741+
if ((instance->perf_mode == MR_BALANCED_PERF_MODE) &&
5742+
(i != instance->msix_vectors)) {
57305743
if (instance->msix_vectors)
57315744
pci_free_irq_vectors(instance->pdev);
57325745
/* Disable Balanced IOPS mode and try realloc vectors */
5733-
instance->balanced_mode = false;
5746+
instance->perf_mode = MR_LATENCY_PERF_MODE;
57345747
instance->low_latency_index_start = 1;
57355748
num_msix_req = num_online_cpus() + instance->low_latency_index_start;
57365749

@@ -5774,6 +5787,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
57745787
struct fusion_context *fusion;
57755788
bool intr_coalescing;
57765789
unsigned int num_msix_req;
5790+
u16 lnksta, speed;
57775791

57785792
fusion = instance->ctrl_context;
57795793

@@ -5983,11 +5997,43 @@ static int megasas_init_fw(struct megasas_instance *instance)
59835997
if (intr_coalescing &&
59845998
(num_online_cpus() >= MR_HIGH_IOPS_QUEUE_COUNT) &&
59855999
(instance->msix_vectors == MEGASAS_MAX_MSIX_QUEUES))
5986-
instance->balanced_mode = true;
6000+
instance->perf_mode = MR_BALANCED_PERF_MODE;
59876001
else
5988-
instance->balanced_mode = false;
6002+
instance->perf_mode = MR_LATENCY_PERF_MODE;
6003+
6004+
6005+
if (instance->adapter_type == AERO_SERIES) {
6006+
pcie_capability_read_word(instance->pdev, PCI_EXP_LNKSTA, &lnksta);
6007+
speed = lnksta & PCI_EXP_LNKSTA_CLS;
6008+
6009+
/*
6010+
* For Aero, if PCIe link speed is <16 GT/s, then driver should operate
6011+
* in latency perf mode and enable R1 PCI bandwidth algorithm
6012+
*/
6013+
if (speed < 0x4) {
6014+
instance->perf_mode = MR_LATENCY_PERF_MODE;
6015+
fusion->pcie_bw_limitation = true;
6016+
}
6017+
6018+
/*
6019+
* Performance mode settings provided through module parameter-perf_mode will
6020+
* take affect only for:
6021+
* 1. Aero family of adapters.
6022+
* 2. When user sets module parameter- perf_mode in range of 0-2.
6023+
*/
6024+
if ((perf_mode >= MR_BALANCED_PERF_MODE) &&
6025+
(perf_mode <= MR_LATENCY_PERF_MODE))
6026+
instance->perf_mode = perf_mode;
6027+
/*
6028+
* If intr coalescing is not supported by controller FW, then IOPS
6029+
* and Balanced modes are not feasible.
6030+
*/
6031+
if (!intr_coalescing)
6032+
instance->perf_mode = MR_LATENCY_PERF_MODE;
6033+
6034+
}
59896035

5990-
if (instance->balanced_mode)
6036+
if (instance->perf_mode == MR_BALANCED_PERF_MODE)
59916037
instance->low_latency_index_start =
59926038
MR_HIGH_IOPS_QUEUE_COUNT;
59936039
else

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,10 +1097,10 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
10971097

10981098
if ((instance->low_latency_index_start ==
10991099
MR_HIGH_IOPS_QUEUE_COUNT) && cur_intr_coalescing)
1100-
instance->balanced_mode = true;
1100+
instance->perf_mode = MR_BALANCED_PERF_MODE;
11011101

1102-
dev_info(&instance->pdev->dev, "Balanced mode :%s\n",
1103-
instance->balanced_mode ? "Yes" : "No");
1102+
dev_info(&instance->pdev->dev, "Performance mode :%s\n",
1103+
MEGASAS_PERF_MODE_2STR(instance->perf_mode));
11041104

11051105
instance->fw_sync_cache_support = (scratch_pad_1 &
11061106
MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 : 0;
@@ -1190,9 +1190,17 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
11901190
* Each bit in replyqueue_mask represents one group of MSI-x vectors
11911191
* (each group has 8 vectors)
11921192
*/
1193-
if (instance->balanced_mode)
1193+
switch (instance->perf_mode) {
1194+
case MR_BALANCED_PERF_MODE:
11941195
init_frame->replyqueue_mask =
1195-
cpu_to_le16(~(~0 << instance->low_latency_index_start / 8));
1196+
cpu_to_le16(~(~0 << instance->low_latency_index_start/8));
1197+
break;
1198+
case MR_IOPS_PERF_MODE:
1199+
init_frame->replyqueue_mask =
1200+
cpu_to_le16(~(~0 << instance->msix_vectors/8));
1201+
break;
1202+
}
1203+
11961204

11971205
req_desc.u.low = cpu_to_le32(lower_32_bits(cmd->frame_phys_addr));
11981206
req_desc.u.high = cpu_to_le32(upper_32_bits(cmd->frame_phys_addr));
@@ -2831,7 +2839,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
28312839
fp_possible = (io_info.fpOkForIo > 0) ? true : false;
28322840
}
28332841

2834-
if (instance->balanced_mode &&
2842+
if ((instance->perf_mode == MR_BALANCED_PERF_MODE) &&
28352843
atomic_read(&scp->device->device_busy) >
28362844
(io_info.data_arms * MR_DEVICE_HIGH_IOPS_DEPTH))
28372845
cmd->request_desc->SCSIIO.MSIxIndex =
@@ -3164,7 +3172,7 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
31643172

31653173
cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
31663174

3167-
if (instance->balanced_mode &&
3175+
if ((instance->perf_mode == MR_BALANCED_PERF_MODE) &&
31683176
atomic_read(&scmd->device->device_busy) > MR_DEVICE_HIGH_IOPS_DEPTH)
31693177
cmd->request_desc->SCSIIO.MSIxIndex =
31703178
mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) /

0 commit comments

Comments
 (0)