Skip to content

Commit 81e7eb5

Browse files
Revert "Revert "scsi: megaraid_sas: Added support for shared host tagset for cpuhotplug""
This reverts commit 1a0e194. Commit b3c6a59 ("block: Fix a lockdep complaint triggered by request queue flushing") has been reverted and commit fb01a29 has been introduced in its place. Consequently, it is now safe to reinstate the megaraid_sas tagset changes that led to boot problems in 5.10. Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ac7ac46 commit 81e7eb5

File tree

2 files changed

+55
-13
lines changed

2 files changed

+55
-13
lines changed

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <linux/poll.h>
3838
#include <linux/vmalloc.h>
3939
#include <linux/irq_poll.h>
40+
#include <linux/blk-mq-pci.h>
4041

4142
#include <scsi/scsi.h>
4243
#include <scsi/scsi_cmnd.h>
@@ -113,6 +114,10 @@ unsigned int enable_sdev_max_qd;
113114
module_param(enable_sdev_max_qd, int, 0444);
114115
MODULE_PARM_DESC(enable_sdev_max_qd, "Enable sdev max qd as can_queue. Default: 0");
115116

117+
int host_tagset_enable = 1;
118+
module_param(host_tagset_enable, int, 0444);
119+
MODULE_PARM_DESC(host_tagset_enable, "Shared host tagset enable/disable Default: enable(1)");
120+
116121
MODULE_LICENSE("GPL");
117122
MODULE_VERSION(MEGASAS_VERSION);
118123
MODULE_AUTHOR("[email protected]");
@@ -3119,6 +3124,19 @@ megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
31193124
return 0;
31203125
}
31213126

3127+
static int megasas_map_queues(struct Scsi_Host *shost)
3128+
{
3129+
struct megasas_instance *instance;
3130+
3131+
instance = (struct megasas_instance *)shost->hostdata;
3132+
3133+
if (shost->nr_hw_queues == 1)
3134+
return 0;
3135+
3136+
return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
3137+
instance->pdev, instance->low_latency_index_start);
3138+
}
3139+
31223140
static void megasas_aen_polling(struct work_struct *work);
31233141

31243142
/**
@@ -3427,6 +3445,7 @@ static struct scsi_host_template megasas_template = {
34273445
.eh_timed_out = megasas_reset_timer,
34283446
.shost_attrs = megaraid_host_attrs,
34293447
.bios_param = megasas_bios_param,
3448+
.map_queues = megasas_map_queues,
34303449
.change_queue_depth = scsi_change_queue_depth,
34313450
.max_segment_size = 0xffffffff,
34323451
};
@@ -6808,6 +6827,26 @@ static int megasas_io_attach(struct megasas_instance *instance)
68086827
host->max_lun = MEGASAS_MAX_LUN;
68096828
host->max_cmd_len = 16;
68106829

6830+
/* Use shared host tagset only for fusion adaptors
6831+
* if there are managed interrupts (smp affinity enabled case).
6832+
* Single msix_vectors in kdump, so shared host tag is also disabled.
6833+
*/
6834+
6835+
host->host_tagset = 0;
6836+
host->nr_hw_queues = 1;
6837+
6838+
if ((instance->adapter_type != MFI_SERIES) &&
6839+
(instance->msix_vectors > instance->low_latency_index_start) &&
6840+
host_tagset_enable &&
6841+
instance->smp_affinity_enable) {
6842+
host->host_tagset = 1;
6843+
host->nr_hw_queues = instance->msix_vectors -
6844+
instance->low_latency_index_start;
6845+
}
6846+
6847+
dev_info(&instance->pdev->dev,
6848+
"Max firmware commands: %d shared with nr_hw_queues = %d\n",
6849+
instance->max_fw_cmds, host->nr_hw_queues);
68116850
/*
68126851
* Notify the mid-layer about the new controller
68136852
*/

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -359,24 +359,29 @@ megasas_get_msix_index(struct megasas_instance *instance,
359359
{
360360
int sdev_busy;
361361

362-
/* nr_hw_queue = 1 for MegaRAID */
363-
struct blk_mq_hw_ctx *hctx =
364-
scmd->device->request_queue->queue_hw_ctx[0];
365-
366-
sdev_busy = atomic_read(&hctx->nr_active);
362+
/* TBD - if sml remove device_busy in future, driver
363+
* should track counter in internal structure.
364+
*/
365+
sdev_busy = atomic_read(&scmd->device->device_busy);
367366

368367
if (instance->perf_mode == MR_BALANCED_PERF_MODE &&
369-
sdev_busy > (data_arms * MR_DEVICE_HIGH_IOPS_DEPTH))
368+
sdev_busy > (data_arms * MR_DEVICE_HIGH_IOPS_DEPTH)) {
370369
cmd->request_desc->SCSIIO.MSIxIndex =
371370
mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) /
372371
MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start);
373-
else if (instance->msix_load_balance)
372+
} else if (instance->msix_load_balance) {
374373
cmd->request_desc->SCSIIO.MSIxIndex =
375374
(mega_mod64(atomic64_add_return(1, &instance->total_io_count),
376375
instance->msix_vectors));
377-
else
376+
} else if (instance->host->nr_hw_queues > 1) {
377+
u32 tag = blk_mq_unique_tag(scmd->request);
378+
379+
cmd->request_desc->SCSIIO.MSIxIndex = blk_mq_unique_tag_to_hwq(tag) +
380+
instance->low_latency_index_start;
381+
} else {
378382
cmd->request_desc->SCSIIO.MSIxIndex =
379383
instance->reply_map[raw_smp_processor_id()];
384+
}
380385
}
381386

382387
/**
@@ -956,9 +961,6 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
956961
if (megasas_alloc_cmdlist_fusion(instance))
957962
goto fail_exit;
958963

959-
dev_info(&instance->pdev->dev, "Configured max firmware commands: %d\n",
960-
instance->max_fw_cmds);
961-
962964
/* The first 256 bytes (SMID 0) is not used. Don't add to the cmd list */
963965
io_req_base = fusion->io_request_frames + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE;
964966
io_req_base_phys = fusion->io_request_frames_phys + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE;
@@ -1102,8 +1104,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
11021104
MR_HIGH_IOPS_QUEUE_COUNT) && cur_intr_coalescing)
11031105
instance->perf_mode = MR_BALANCED_PERF_MODE;
11041106

1105-
dev_info(&instance->pdev->dev, "Performance mode :%s\n",
1106-
MEGASAS_PERF_MODE_2STR(instance->perf_mode));
1107+
dev_info(&instance->pdev->dev, "Performance mode :%s (latency index = %d)\n",
1108+
MEGASAS_PERF_MODE_2STR(instance->perf_mode),
1109+
instance->low_latency_index_start);
11071110

11081111
instance->fw_sync_cache_support = (scratch_pad_1 &
11091112
MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 : 0;

0 commit comments

Comments
 (0)