Skip to contentSkip to conversation

megaraid_sas: Update driver version to 07.717.01.00-rc1

PATCH Superseded Chandrakanth Patil 2 participants 9 messages Mar 17, 2021

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chandrakanth Patil

author maintainer
#0 lore raw

cover megaraid_sas: Update driver version to 07.717.01.00-rc1

This patchset contains few critical fixes and enhancements.

Chandrakanth Patil (5):
megaraid_sas: Send all non-RW IOs for TYPE_ENCLOSURE device through
firmware
megaraid_sas: Fix the resource leak in case of probe failure
megaraid_sas: Early detection of VD deletion through RaidMap update
megaraid_sas: Handle missing interrupts while re-enabling IRQs
megaraid_sas: Update driver version to 07.717.01.00-rc1

 drivers/scsi/megaraid/megaraid_sas.h        |  8 ++-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 76 ++++++++++++++++++++-
 drivers/scsi/megaraid/megaraid_sas_fp.c     |  6 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 33 ++++++---
 4 files changed, 110 insertions(+), 13 deletions(-)
Signature · 1 line
2.18.1
author maintainer
#1 lore raw

PATCH 1/5 megaraid_sas: Send all non-RW IOs for TYPE_ENCLOSURE device through firmware

Driver issues all non-ReadWrite IOs for TYPE_ENCLOSURE devices through the fast path with invalid dev handle and fast path inturn directs all the IOs to the firmware. As firmware stopped handling those IOs from SAS3.5 generation of controllers (Ventura and its onward generations) lead to IOs failure.

The driver will issue all the non-ReadWrite IOs for TYPE_ENCLOSURE devices directly to firmware from SAS3.5 generation of controllers.

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +8 -2
index 38fc9467c625..73295cf74cbe 100644
@@ -3167,6 +3167,8 @@ megasas_build_io_fusion(struct megasas_instance *instance,
 {
 	int sge_count;
 	u8  cmd_type;
+	u16 pd_index = 0;
+	u8 drive_type = 0;
 	struct MPI2_RAID_SCSI_IO_REQUEST *io_request = cmd->io_request;
 	struct MR_PRIV_DEVICE *mr_device_priv_data;
 	mr_device_priv_data = scp->device->hostdata;
@@ -3201,8 +3203,12 @@ megasas_build_io_fusion(struct megasas_instance *instance,
 		megasas_build_syspd_fusion(instance, scp, cmd, true);
 		break;
 	case NON_READ_WRITE_SYSPDIO:
-		if (instance->secure_jbod_support ||
-		    mr_device_priv_data->is_tm_capable)
+		pd_index = MEGASAS_PD_INDEX(scp);
+		drive_type = instance->pd_list[pd_index].driveType;
+		if ((instance->secure_jbod_support ||
+		     mr_device_priv_data->is_tm_capable) ||
+		     (instance->adapter_type >= VENTURA_SERIES &&
+		     drive_type == TYPE_ENCLOSURE))
 			megasas_build_syspd_fusion(instance, scp, cmd, false);
 		else
 			megasas_build_syspd_fusion(instance, scp, cmd, true);
Signature · 1 line
2.18.1
author maintainer
#2 lore raw

PATCH 2/5 megaraid_sas: Fix the resource leak in case of probe failure

In reply to Chandrakanth Patil

Driver doesn't cleanup all the allocated resources properly when scsi_add_host(),megasas_start_aen() function fails during the PCI device probe.
This patch will cleanup all those resources.

---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 13 +++++++++++++
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  1 +
 2 files changed, 14 insertions(+)
drivers/scsi/megaraid/megaraid_sas_base.c +13 -0
index 63a4f48bdc75..7ab741f03b84 100644
@@ -7478,11 +7478,16 @@ static int megasas_probe_one(struct pci_dev *pdev,
 	return 0;
 
 fail_start_aen:
+	instance->unload = 1;
+	scsi_remove_host(instance->host);
 fail_io_attach:
 	megasas_mgmt_info.count--;
 	megasas_mgmt_info.max_index--;
 	megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
 
+	if (instance->requestorId && !instance->skip_heartbeat_timer_del)
+		del_timer_sync(&instance->sriov_heartbeat_timer);
+
 	instance->instancet->disable_intr(instance);
 	megasas_destroy_irqs(instance);
 
@@ -7490,8 +7495,16 @@ static int megasas_probe_one(struct pci_dev *pdev,
 		megasas_release_fusion(instance);
 	else
 		megasas_release_mfi(instance);
+
 	if (instance->msix_vectors)
 		pci_free_irq_vectors(instance->pdev);
+	instance->msix_vectors = 0;
+
+	if (instance->fw_crash_state != UNAVAILABLE)
+		megasas_free_host_crash_buffer(instance);
+
+	if (instance->adapter_type != MFI_SERIES)
+		megasas_fusion_stop_watchdog(instance);
 fail_init_mfi:
 	scsi_host_put(host);
 fail_alloc_instance:
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -0
index 73295cf74cbe..54f8a8073ca0 100644
@@ -5201,6 +5201,7 @@ megasas_alloc_fusion_context(struct megasas_instance *instance)
 		if (!fusion->log_to_span) {
 			dev_err(&instance->pdev->dev, "Failed from %s %d\n",
 				__func__, __LINE__);
+			kfree(instance->ctrl_context);
 			return -ENOMEM;
 		}
 	}
Signature · 1 line
2.18.1
author maintainer
#3 lore raw

PATCH 3/5 megaraid_sas: Early detection of VD deletion through RaidMap update

In reply to Chandrakanth Patil

Consider in a case, when a VD is deleted and the targetID of that VD is assigned to a newly created VD. If the sequence of deletion/addition of VD happens very quickly, there is a possibility that second event(VD add) occurs even before the driver processes the first event(VD delete).
As event processing is done in deferred context the device list remains same(but targetID is re-used) so driver will not learn the VD deletion/additon and IOs meant for older VD will be directed to new VD which may lead to data corruption.

In new design, driver will detect the deleted VD as soon as possible based on the RaidMap update and blocks further IOs to that device.

---
 drivers/scsi/megaraid/megaraid_sas.h      |  3 ++
 drivers/scsi/megaraid/megaraid_sas_base.c | 61 ++++++++++++++++++++++-
 drivers/scsi/megaraid/megaraid_sas_fp.c   |  6 ++-
 3 files changed, 67 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +3 -0
index 0f808d63580e..d7185aa21eb5 100644
@@ -2023,6 +2023,7 @@ union megasas_frame {
 struct MR_PRIV_DEVICE {
 	bool is_tm_capable;
 	bool tm_busy;
+	bool device_removed_by_fw;
 	atomic_t r1_ldio_hint;
 	u8 interface_type;
 	u8 task_abort_tmo;
@@ -2323,6 +2324,8 @@ struct megasas_instance {
 	struct megasas_pd_list          pd_list[MEGASAS_MAX_PD];
 	struct megasas_pd_list          local_pd_list[MEGASAS_MAX_PD];
 	u8 ld_ids[MEGASAS_MAX_LD_IDS];
+	u8 ld_ids_prev[MEGASAS_MAX_LD_IDS];
+	u8 ld_ids_from_raidmap[MEGASAS_MAX_LD_IDS];
 	s8 init_id;
 
 	u16 max_num_sge;
drivers/scsi/megaraid/megaraid_sas_base.c +59 -2

104 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fp.c +5 -1
index b6c08d620033..470b9797dd65 100644
@@ -349,6 +349,10 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
 
 	num_lds = le16_to_cpu(drv_map->raidMap.ldCount);
 
+	memcpy(instance->ld_ids_prev,
+	       instance->ld_ids_from_raidmap,
+	       sizeof(instance->ld_ids_from_raidmap));
+	memset(instance->ld_ids_from_raidmap, 0xff, MEGASAS_MAX_LD_IDS);
 	/*Convert Raid capability values to CPU arch */
 	for (i = 0; (num_lds > 0) && (i < MAX_LOGICAL_DRIVES_EXT); i++) {
 		ld = MR_TargetIdToLdGet(i, drv_map);
@@ -359,7 +363,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
 
 		raid = MR_LdRaidGet(ld, drv_map);
 		le32_to_cpus((u32 *)&raid->capability);
-
+		instance->ld_ids_from_raidmap[ld] = i;
 		num_lds--;
 	}
 
Signature · 1 line
2.18.1
#4 lore raw

Re: [PATCH 3/5] megaraid_sas: Early detection of VD deletion through RaidMap update

Thank you for the patch! Perhaps something to improve:

Hi Chandrakanth,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.12-rc3]
[cannot apply to mkp-scsi/for-next scsi/for-next next-20210317] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chandrakanth-Patil/megaraid_sas-Update-driver-version-to-07-717-01-00-rc1/20210318-031205
base:    1e28eed17697bcf343c6743f0028cc3b5dd88bf0
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/dadb835ed01309bcd9a8d51a01ad4467dc71aea6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chandrakanth-Patil/megaraid_sas-Update-driver-version-to-07-717-01-00-rc1/20210318-031205 git checkout dadb835ed01309bcd9a8d51a01ad4467dc71aea6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/scsi/megaraid/megaraid_sas_base.c:3502:1: warning: no previous prototype for 'megasas_set_sdev_removed_by_fw' [-Wmissing-prototypes]

3502 | megasas_set_sdev_removed_by_fw(struct megasas_instance *instance)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/megasas_set_sdev_removed_by_fw +3502 drivers/scsi/megaraid/megaraid_sas_base.c

3500
3501 void

> 3502	megasas_set_sdev_removed_by_fw(struct megasas_instance *instance)

3503 {
3504 struct scsi_device *sdev;
3505 struct MR_PRIV_DEVICE *mr_device_priv_data;
3506 uint channel, id, i;
3507
3508 for (i = 0; (i < MEGASAS_MAX_LD_IDS); i++) {
3509 if (instance->ld_ids_prev[i] != 0xff &&
3510 instance->ld_ids_from_raidmap[i] == 0xff) {
3511 channel = MEGASAS_MAX_PD_CHANNELS +
3512 (instance->ld_ids_prev[i] /
3513 MEGASAS_MAX_DEV_PER_CHANNEL);
3514 id = (instance->ld_ids_prev[i] %
3515 MEGASAS_MAX_DEV_PER_CHANNEL);
3516
3517 if (megasas_dbg_lvl & LD_PD_DEBUG)
3518 dev_info(&instance->pdev->dev,
3519 "index %d old 0x%x new 0x%x from %s\n",
3520 i, instance->ld_ids_prev[i],
3521 instance->ld_ids_from_raidmap[i],
3522 __func__);
3523
3524 sdev = scsi_device_lookup(instance->host, channel, id, 0);
3525 if (sdev) {
3526 mr_device_priv_data = sdev->hostdata;
3527 mr_device_priv_data->device_removed_by_fw = true;
3528 scsi_device_put(sdev);
3529 }
3530 }
3531 }
3532 }
3533

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#5 lore raw

Re: [PATCH 3/5] megaraid_sas: Early detection of VD deletion through RaidMap update

In reply to Chandrakanth Patil
Thank you for the patch! Perhaps something to improve:

Hi Chandrakanth,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.12-rc3]
[cannot apply to mkp-scsi/for-next scsi/for-next next-20210317] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chandrakanth-Patil/megaraid_sas-Update-driver-version-to-07-717-01-00-rc1/20210318-031205
base:    1e28eed17697bcf343c6743f0028cc3b5dd88bf0
config: x86_64-randconfig-s022-20210317 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-277-gc089cd2d-dirty
        # https://github.com/0day-ci/linux/commit/dadb835ed01309bcd9a8d51a01ad4467dc71aea6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Chandrakanth-Patil/megaraid_sas-Update-driver-version-to-07-717-01-00-rc1/20210318-031205
        git checkout dadb835ed01309bcd9a8d51a01ad4467dc71aea6
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

sparse warnings: (new ones prefixed by >>)
drivers/scsi/megaraid/megaraid_sas_base.c:117:5: sparse: sparse: symbol 'host_tagset_enable' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_base.c:4605:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:4605:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:4605:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:4856:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:4856:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:4856:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:6671:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:6671:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:6671:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:4512:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:4512:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:4512:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:282:31: sparse: sparse: restricted __le16 degrades to integer drivers/scsi/megaraid/megaraid_sas_base.c:288:31: sparse: sparse: cast from restricted __le16 drivers/scsi/megaraid/megaraid_sas_base.c:414:29: sparse: sparse: cast to restricted __le32
drivers/scsi/megaraid/megaraid_sas_base.c:1224:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] opcode @@ got restricted __le32 [usertype] opcode @@
drivers/scsi/megaraid/megaraid_sas_base.c:1224:32: sparse: expected unsigned int [usertype] opcode
drivers/scsi/megaraid/megaraid_sas_base.c:1224:32: sparse: got restricted __le32 [usertype] opcode
drivers/scsi/megaraid/megaraid_sas_base.c:2003:33: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_base.c:2044:34: sparse: sparse: cast to restricted __le32

>> drivers/scsi/megaraid/megaraid_sas_base.c:3502:1: sparse: sparse: symbol 'megasas_set_sdev_removed_by_fw' was not declared. Should it be static?

drivers/scsi/megaraid/megaraid_sas_base.c:4736:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:4736:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:4736:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:4975:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:4975:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:4975:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:5160:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:5160:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:5160:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:5242:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:5242:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:5242:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:6224:42: sparse: sparse: cast removes address space '__iomem' of expression
drivers/scsi/megaraid/megaraid_sas_base.c:6223:57: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [noderef] [usertype] __iomem * @@ got unsigned int [usertype] * @@
drivers/scsi/megaraid/megaraid_sas_base.c:6223:57: sparse: expected unsigned int [noderef] [usertype] __iomem *
drivers/scsi/megaraid/megaraid_sas_base.c:6223:57: sparse: got unsigned int [usertype] *
drivers/scsi/megaraid/megaraid_sas_base.c:6228:34: sparse: sparse: cast removes address space '__iomem' of expression
drivers/scsi/megaraid/megaraid_sas_base.c:6227:57: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [noderef] [usertype] __iomem * @@ got unsigned int [usertype] * @@
drivers/scsi/megaraid/megaraid_sas_base.c:6227:57: sparse: expected unsigned int [noderef] [usertype] __iomem *
drivers/scsi/megaraid/megaraid_sas_base.c:6227:57: sparse: got unsigned int [usertype] *
drivers/scsi/megaraid/megaraid_sas_base.c:6535:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:6535:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:6535:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:6749:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] flags @@ got int @@
drivers/scsi/megaraid/megaraid_sas_base.c:6749:21: sparse: expected restricted __le16 [usertype] flags
drivers/scsi/megaraid/megaraid_sas_base.c:6749:21: sparse: got int
drivers/scsi/megaraid/megaraid_sas_base.c:7505:44: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/megaraid/megaraid_sas_base.c:8122:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected int crash_support @@ got restricted __le32 @@
drivers/scsi/megaraid/megaraid_sas_base.c:8122:23: sparse: expected int crash_support
drivers/scsi/megaraid/megaraid_sas_base.c:8122:23: sparse: got restricted __le32
drivers/scsi/megaraid/megaraid_sas_base.c:8206:31: sparse: sparse: invalid assignment: &=
drivers/scsi/megaraid/megaraid_sas_base.c:8206:31: sparse: left side has type restricted __le16
drivers/scsi/megaraid/megaraid_sas_base.c:8206:31: sparse: right side has type int
drivers/scsi/megaraid/megaraid_sas_base.c:8739:46: sparse: sparse: restricted __le32 degrades to integer

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#6 lore raw

[RFC PATCH] megaraid_sas: megasas_set_sdev_removed_by_fw can be static

In reply to Chandrakanth Patil
Reported-by: kernel test robot <[email protected]>
---
 megaraid_sas_base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
index f3716f7e1d105..09a8b37eb425a 100644
@@ -3498,7 +3498,7 @@ megasas_complete_abort(struct megasas_instance *instance,
 	}
 }
 
-void
+static void
 megasas_set_sdev_removed_by_fw(struct megasas_instance *instance)
 {
 	struct scsi_device *sdev;
author maintainer
#7 lore raw

PATCH 4/5 megaraid_sas: Handle missing interrupts while re-enabling IRQs

In reply to Chandrakanth Patil

While reenabling the IRQ after irq poll there may be a small window for the firmware to post the replies with interrupts raised. In that case, driver will not see the interrupts which lead to IOs timeout.

This issue hits only when there is a high IOs completion on a single reply queue, which forces the driver to switch between the interrupt and IRQ context.

To fix this, driver will process the reply queue one more time after enabling the IRQ.

---
 drivers/scsi/megaraid/megaraid_sas.h        |  1 +
 drivers/scsi/megaraid/megaraid_sas_base.c   |  2 ++
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 22 +++++++++++++++------
 3 files changed, 19 insertions(+), 6 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +1 -0
index d7185aa21eb5..689bc519b4c5 100644
@@ -2213,6 +2213,7 @@ struct megasas_irq_context {
 	struct irq_poll irqpoll;
 	bool irq_poll_scheduled;
 	bool irq_line_enable;
+	atomic_t in_use;
 };
 
 struct MR_DRV_SYSTEM_INFO {
drivers/scsi/megaraid/megaraid_sas_base.c +2 -0
index f3716f7e1d10..a3584b507749 100644
@@ -5630,6 +5630,7 @@ megasas_setup_irqs_ioapic(struct megasas_instance *instance)
 	pdev = instance->pdev;
 	instance->irq_context[0].instance = instance;
 	instance->irq_context[0].MSIxIndex = 0;
+	atomic_set(&instance->irq_context[0].in_use, 0);
 	snprintf(instance->irq_context->name, MEGASAS_MSIX_NAME_LEN, "%s%u",
 		"megasas", instance->host->host_no);
 	if (request_irq(pci_irq_vector(pdev, 0),
@@ -5666,6 +5667,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe)
 	for (i = 0; i < instance->msix_vectors; i++) {
 		instance->irq_context[i].instance = instance;
 		instance->irq_context[i].MSIxIndex = i;
+		atomic_set(&instance->irq_context[i].in_use, 0);
 		snprintf(instance->irq_context[i].name, MEGASAS_MSIX_NAME_LEN, "%s%u-msix%u",
 			"megasas", instance->host->host_no, i);
 		if (request_irq(pci_irq_vector(pdev, i),
drivers/scsi/megaraid/megaraid_sas_fusion.c +16 -6
index 54f8a8073ca0..d151d2e0b1c8 100644
@@ -3478,7 +3478,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
 	struct fusion_context *fusion;
 	struct megasas_cmd *cmd_mfi;
 	struct megasas_cmd_fusion *cmd_fusion;
-	u16 smid, num_completed;
+	u16 smid, num_completed = 0;
 	u8 reply_descript_type, *sense, status, extStatus;
 	u32 device_id, data_length;
 	union desc_value d_val;
@@ -3493,6 +3493,9 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
 	if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR)
 		return IRQ_HANDLED;
 
+	if (!atomic_add_unless(&irq_context->in_use, 1, 1))
+		return num_completed;
+
 	desc = fusion->reply_frames_desc[MSIxIndex] +
 				fusion->last_reply_idx[MSIxIndex];
 
@@ -3503,10 +3506,10 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
 	reply_descript_type = reply_desc->ReplyFlags &
 		MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
 
-	if (reply_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
+	if (reply_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) {
+		atomic_dec(&irq_context->in_use);
 		return IRQ_NONE;
-
-	num_completed = 0;
+	}
 
 	while (d_val.u.low != cpu_to_le32(UINT_MAX) &&
 	       d_val.u.high != cpu_to_le32(UINT_MAX)) {
@@ -3619,6 +3622,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
 					irq_context->irq_line_enable = true;
 					irq_poll_sched(&irq_context->irqpoll);
 				}
+				atomic_dec(&irq_context->in_use);
 				return num_completed;
 			}
 		}
@@ -3636,6 +3640,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
 				instance->reply_post_host_index_addr[0]);
 		megasas_check_and_restore_queue_depth(instance);
 	}
+	atomic_dec(&irq_context->in_use);
 	return num_completed;
 }
 
@@ -3676,6 +3681,7 @@ static void megasas_sync_irqs(unsigned long instance_addr)
 		if (irq_ctx->irq_poll_scheduled) {
 			irq_ctx->irq_poll_scheduled = false;
 			enable_irq(irq_ctx->os_irq);
+			complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx);
 		}
 	}
 }
@@ -3707,6 +3713,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget)
 		irq_poll_complete(irqpoll);
 		irq_ctx->irq_poll_scheduled = false;
 		enable_irq(irq_ctx->os_irq);
+		complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx);
 	}
 
 	return num_entries;
@@ -3723,6 +3730,7 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr)
 {
 	struct megasas_instance *instance =
 		(struct megasas_instance *)instance_addr;
+	struct megasas_irq_context *irq_ctx;
 	u32 count, MSIxIndex;
 
 	count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
@@ -3731,8 +3739,10 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr)
 	if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR)
 		return;
 
-	for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++)
-		complete_cmd_fusion(instance, MSIxIndex, NULL);
+	for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) {
+		irq_ctx = &instance->irq_context[MSIxIndex];
+		complete_cmd_fusion(instance, MSIxIndex, irq_ctx);
+	}
 }
 
 /**
Signature · 1 line
2.18.1
author maintainer
#8 lore raw

PATCH 5/5 megaraid_sas: Update driver version to 07.717.01.00-rc1

In reply to Chandrakanth Patil
---
 drivers/scsi/megaraid/megaraid_sas.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +2 -2
index 689bc519b4c5..3d4ea87ba983 100644
@@ -21,8 +21,8 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION				"07.714.04.00-rc1"
-#define MEGASAS_RELDATE				"Apr 14, 2020"
+#define MEGASAS_VERSION				"07.717.01.00-rc1"
+#define MEGASAS_RELDATE				"Nov 13, 2020"
 
 #define MEGASAS_MSIX_NAME_LEN			32
 
Signature · 1 line
2.18.1