]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
scsi: lpfc: Correct soft lockup when running mds diagnostics
authorJames Smart <jsmart2021@gmail.com>
Mon, 10 Sep 2018 17:30:45 +0000 (10:30 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Sep 2018 00:37:33 +0000 (20:37 -0400)
When running an mds diagnostic that passes frames with the switch, soft
lockups are detected. The driver is in a CQE processing loop and has
sufficient amount of traffic that it never exits the ring processing routine,
thus the "lockup".

Cap the number of elements in the work processing routine to 64 elements. This
ensures that the cpu will be given up and the handler reschedule to process
additional items.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_sli.c

index 9830bdb6e072625cd75e46d8b4b99845e739305d..a95c823cd1a4442b36b311b3780b412beb7f1f6c 100644 (file)
@@ -3797,6 +3797,7 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba,
        struct hbq_dmabuf *dmabuf;
        struct lpfc_cq_event *cq_event;
        unsigned long iflag;
+       int count = 0;
 
        spin_lock_irqsave(&phba->hbalock, iflag);
        phba->hba_flag &= ~HBA_SP_QUEUE_EVT;
@@ -3818,16 +3819,22 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba,
                        if (irspiocbq)
                                lpfc_sli_sp_handle_rspiocb(phba, pring,
                                                           irspiocbq);
+                       count++;
                        break;
                case CQE_CODE_RECEIVE:
                case CQE_CODE_RECEIVE_V1:
                        dmabuf = container_of(cq_event, struct hbq_dmabuf,
                                              cq_event);
                        lpfc_sli4_handle_received_buffer(phba, dmabuf);
+                       count++;
                        break;
                default:
                        break;
                }
+
+               /* Limit the number of events to 64 to avoid soft lockups */
+               if (count == 64)
+                       break;
        }
 }