Revert "Revert "scsi: megaraid_sas: Added support for shared host tagset for cpuhotplug""

This reverts commit 1a0e1943d8798cb3241fb5edb9a836af1611b60a.

Commit b3c6a5997541 ("block: Fix a lockdep complaint triggered by
request queue flushing") has been reverted and commit fb01a2932e81 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 <martin.petersen@oracle.com>

+55 -13
+39
drivers/scsi/megaraid/megaraid_sas_base.c
··· 37 37 #include <linux/poll.h> 38 38 #include <linux/vmalloc.h> 39 39 #include <linux/irq_poll.h> 40 + #include <linux/blk-mq-pci.h> 40 41 41 42 #include <scsi/scsi.h> 42 43 #include <scsi/scsi_cmnd.h> ··· 113 112 unsigned int enable_sdev_max_qd; 114 113 module_param(enable_sdev_max_qd, int, 0444); 115 114 MODULE_PARM_DESC(enable_sdev_max_qd, "Enable sdev max qd as can_queue. Default: 0"); 115 + 116 + int host_tagset_enable = 1; 117 + module_param(host_tagset_enable, int, 0444); 118 + MODULE_PARM_DESC(host_tagset_enable, "Shared host tagset enable/disable Default: enable(1)"); 116 119 117 120 MODULE_LICENSE("GPL"); 118 121 MODULE_VERSION(MEGASAS_VERSION); ··· 3124 3119 return 0; 3125 3120 } 3126 3121 3122 + static int megasas_map_queues(struct Scsi_Host *shost) 3123 + { 3124 + struct megasas_instance *instance; 3125 + 3126 + instance = (struct megasas_instance *)shost->hostdata; 3127 + 3128 + if (shost->nr_hw_queues == 1) 3129 + return 0; 3130 + 3131 + return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT], 3132 + instance->pdev, instance->low_latency_index_start); 3133 + } 3134 + 3127 3135 static void megasas_aen_polling(struct work_struct *work); 3128 3136 3129 3137 /** ··· 3445 3427 .eh_timed_out = megasas_reset_timer, 3446 3428 .shost_attrs = megaraid_host_attrs, 3447 3429 .bios_param = megasas_bios_param, 3430 + .map_queues = megasas_map_queues, 3448 3431 .change_queue_depth = scsi_change_queue_depth, 3449 3432 .max_segment_size = 0xffffffff, 3450 3433 }; ··· 6827 6808 host->max_lun = MEGASAS_MAX_LUN; 6828 6809 host->max_cmd_len = 16; 6829 6810 6811 + /* Use shared host tagset only for fusion adaptors 6812 + * if there are managed interrupts (smp affinity enabled case). 6813 + * Single msix_vectors in kdump, so shared host tag is also disabled. 6814 + */ 6815 + 6816 + host->host_tagset = 0; 6817 + host->nr_hw_queues = 1; 6818 + 6819 + if ((instance->adapter_type != MFI_SERIES) && 6820 + (instance->msix_vectors > instance->low_latency_index_start) && 6821 + host_tagset_enable && 6822 + instance->smp_affinity_enable) { 6823 + host->host_tagset = 1; 6824 + host->nr_hw_queues = instance->msix_vectors - 6825 + instance->low_latency_index_start; 6826 + } 6827 + 6828 + dev_info(&instance->pdev->dev, 6829 + "Max firmware commands: %d shared with nr_hw_queues = %d\n", 6830 + instance->max_fw_cmds, host->nr_hw_queues); 6830 6831 /* 6831 6832 * Notify the mid-layer about the new controller 6832 6833 */
+16 -13
drivers/scsi/megaraid/megaraid_sas_fusion.c
··· 359 359 { 360 360 int sdev_busy; 361 361 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); 367 366 368 367 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)) { 370 369 cmd->request_desc->SCSIIO.MSIxIndex = 371 370 mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) / 372 371 MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start); 373 - else if (instance->msix_load_balance) 372 + } else if (instance->msix_load_balance) { 374 373 cmd->request_desc->SCSIIO.MSIxIndex = 375 374 (mega_mod64(atomic64_add_return(1, &instance->total_io_count), 376 375 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 { 378 382 cmd->request_desc->SCSIIO.MSIxIndex = 379 383 instance->reply_map[raw_smp_processor_id()]; 384 + } 380 385 } 381 386 382 387 /** ··· 961 956 if (megasas_alloc_cmdlist_fusion(instance)) 962 957 goto fail_exit; 963 958 964 - dev_info(&instance->pdev->dev, "Configured max firmware commands: %d\n", 965 - instance->max_fw_cmds); 966 - 967 959 /* The first 256 bytes (SMID 0) is not used. Don't add to the cmd list */ 968 960 io_req_base = fusion->io_request_frames + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE; 969 961 io_req_base_phys = fusion->io_request_frames_phys + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE; ··· 1104 1102 MR_HIGH_IOPS_QUEUE_COUNT) && cur_intr_coalescing) 1105 1103 instance->perf_mode = MR_BALANCED_PERF_MODE; 1106 1104 1107 - dev_info(&instance->pdev->dev, "Performance mode :%s\n", 1108 - MEGASAS_PERF_MODE_2STR(instance->perf_mode)); 1105 + dev_info(&instance->pdev->dev, "Performance mode :%s (latency index = %d)\n", 1106 + MEGASAS_PERF_MODE_2STR(instance->perf_mode), 1107 + instance->low_latency_index_start); 1109 1108 1110 1109 instance->fw_sync_cache_support = (scratch_pad_1 & 1111 1110 MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 : 0;