diff mbox series

[v2,4/5] megaraid_sas: Handle missing interrupts while re-enabling IRQs

Message ID 20210521102548.11156-5-chandrakanth.patil@broadcom.com
State Superseded
Headers show
Series megaraid_sas: Update driver version to 07.717.02.00-rc1 | expand

Commit Message

Chandrakanth patil May 21, 2021, 10:25 a.m. UTC
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.

Link: https://lore.kernel.org/linux-scsi/20201102072746.27410-1-sreekanth.reddy@broadcom.com/
Cc: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

kernel test robot May 22, 2021, 4:01 p.m. UTC | #1
Hi Chandrakanth,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.13-rc2 next-20210521]
[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-02-00-rc1/20210522-203404
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-a001-20210522 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/14f4c308962448ba3ff062098bed88de6acda8ab
        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-02-00-rc1/20210522-203404
        git checkout 14f4c308962448ba3ff062098bed88de6acda8ab
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 'megasas_complete_cmd_dpc_fusion':
>> drivers/scsi/megaraid/megaraid_sas_fusion.c:3797:30: warning: variable 'irq_ctx' set but not used [-Wunused-but-set-variable]

    3797 |  struct megasas_irq_context *irq_ctx = NULL;
         |                              ^~~~~~~


vim +/irq_ctx +3797 drivers/scsi/megaraid/megaraid_sas_fusion.c

  3785	
  3786	/**
  3787	 * megasas_complete_cmd_dpc_fusion -	Completes command
  3788	 * @instance_addr:			Adapter soft state address
  3789	 *
  3790	 * Tasklet to complete cmds
  3791	 */
  3792	static void
  3793	megasas_complete_cmd_dpc_fusion(unsigned long instance_addr)
  3794	{
  3795		struct megasas_instance *instance =
  3796			(struct megasas_instance *)instance_addr;
> 3797		struct megasas_irq_context *irq_ctx = NULL;

  3798		u32 count, MSIxIndex;
  3799	
  3800		count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
  3801	
  3802		/* If we have already declared adapter dead, donot complete cmds */
  3803		if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR)
  3804			return;
  3805	
  3806		for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) {
  3807			irq_ctx = &instance->irq_context[MSIxIndex];
  3808			complete_cmd_fusion(instance, MSIxIndex, NULL);
  3809		}
  3810	}
  3811	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index f79c19010c92..8b8d68e75318 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3745,6 +3745,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);
 		}
 	}
 }
@@ -3776,6 +3777,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;
@@ -3792,6 +3794,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 = NULL;
 	u32 count, MSIxIndex;
 
 	count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
@@ -3800,8 +3803,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++)
+	for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) {
+		irq_ctx = &instance->irq_context[MSIxIndex];
 		complete_cmd_fusion(instance, MSIxIndex, NULL);
+	}
 }
 
 /**