Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp140850imd; Wed, 31 Oct 2018 16:08:40 -0700 (PDT) X-Google-Smtp-Source: AJdET5fFwuM0WQSsCjdB2M+Nq9l48QvRzn2tmxpmDRK7TAZv527Dxt0SlRPcLKMxUjQEMChEl5NY X-Received: by 2002:a17:902:3084:: with SMTP id v4-v6mr5199534plb.326.1541027320291; Wed, 31 Oct 2018 16:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027320; cv=none; d=google.com; s=arc-20160816; b=xyprX6ruv/D0vcN8Kv0CKPeTfuaHkWQ9T56YMdPSEYW9irP5IG5ed78s9Oo85YzIUQ T4Pq8Zaz/+B6psHyyGKBws6Gdo/Pv1ojJYm5KsDAXtPf7MJhSrepPmu4tXq9gIwnqseK EpGYYbdJrsBTCkoqEXhcSt9A9MYF+w2uZTBkAGa/gUKDRSyLg9+pdVN6ixEVlhywkIkA iGBRwiB0IH2RwVnmoebpmm69BpFtuI1Z5ORRVQJb+CbhjDBvuOqtCQZdZuu5xxoixGsm qf2/VMiR1gYuX3KwqbGOSg4SqHKExKXch4b6O6+/VQzX6du0wVpX+zakd9Au3w8Che6b gWnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=KCBQJB6v8bTOcw1Fqeaih3mm+Q7CoWBbSnT16qJOWHU=; b=U+tJDhW+CZVCUQoTJNwdWviKLEsVVtE0KT04PeqqHxMQn6zZ/ziCtrhGhFdUztIOta um5REZPvtAcxZQZfuV3Xx8DaZjIWFzaVvq1V7EKheQk3xguni81gQV8rxK+Uk+btVSkq jRQU00ICV5f8yCBEABdl4Y2fmslNQIuejbAFgfnmIadlMIAkVUwzwg3T6SV0hBs/DIV7 y7KMGdVAODLEVVpHvN7iZsUugrIBGaWe1oLYwyhp4dMjKcl9w4nbb0Jys9/j5bE2gQD/ NQVEOSLl7HzqrnB5ARakqggK6K88nYo4JYM343lrVU4IFbEF3DMm+6XJ/aRTRVKkztD9 086g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CyhbpnRS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x35-v6si29145220pgk.558.2018.10.31.16.08.23; Wed, 31 Oct 2018 16:08:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CyhbpnRS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729312AbeKAIH5 (ORCPT + 99 others); Thu, 1 Nov 2018 04:07:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729279AbeKAIH4 (ORCPT ); Thu, 1 Nov 2018 04:07:56 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D50E520838; Wed, 31 Oct 2018 23:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027265; bh=5jdHjBZhBL+hfZkVJwvECMpRYCZaRltFmRu+lRH8KRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyhbpnRS65zfFCJeOtj0XqRRA2+A6XS6uQ+REHZO6Vxv6yMW3aGCat0EXgkfN9uzQ xwypD+cadIfR5r54jwrV11IkEgEMPQkUWQwH6azTow96t0PmePVK3BlqDXJbAEDGi5 2wtxlPtdN1RbahK9X63C63h0LV6cV4Cy3awpMyLs= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 137/146] scsi: lpfc: Correct soft lockup when running mds diagnostics Date: Wed, 31 Oct 2018 19:05:32 -0400 Message-Id: <20181031230541.28822-137-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 0ef01a2d95fd62bb4f536e7ce4d5e8e74b97a244 ] 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 Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_sli.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 9830bdb6e072..a95c823cd1a4 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -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; } } -- 2.17.1