From patchwork Wed Mar 23 20:55:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 553842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 814BEC433EF for ; Wed, 23 Mar 2022 20:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240791AbiCWU51 (ORCPT ); Wed, 23 Mar 2022 16:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiCWU5Z (ORCPT ); Wed, 23 Mar 2022 16:57:25 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E67B8CCEE; Wed, 23 Mar 2022 13:55:55 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id mj15-20020a17090b368f00b001c637aa358eso7605317pjb.0; Wed, 23 Mar 2022 13:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8I/s6Mck/BgQdxWJXuzKA36uTPWwAXWlArll/42jSUU=; b=LwM4DTom5LVXG7k+BxXRdIjwspF0I/mnxlkljLVggf5UBTYGh48sYCIFcUY+6Ah8dw az6OngQ2S1LCuMPEYGXuxCgRJwYBQYNOwBEYBcXVDWx/XXZV8DxiqmRFec1JST5OFpx2 SJ3q3PJfs9BK5OXiAvHjogPf1Mml3bxVg3wawWs+1FDL416J/ep/ABETwzigvddwxzdz ImnADYF2Kb+lJnphbu0KmBzAl47D+p+7QxCKK2kMmhq71Fo0kdrjHQrPbd3Teg+WXtT3 ocZuWddaKZ8MNuJKFIdtmB5mbslo6HpzX99RvJA4hq1ZgpFPs78zPv7Fr6ZX9FLXXmvw +25g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8I/s6Mck/BgQdxWJXuzKA36uTPWwAXWlArll/42jSUU=; b=buHXD78HcYotA2HZwOUXECkgTBrzmOcRVOW9LbRAD+q9ni6M7YlMj6oL2gk8F8quYS /MyuRxtESv+PlhPcZGqZVR7siesDJ/Qx/3TgwKKMbQOkTfnWy0H2MJGSjXgAkHBJ1EVt u5tXC89p6n4+ZNf2y+u7qMYYosy1l1gNmH3fVbOwbCxIQ0mKyKpm5wyuuZ/rhAgbU2xy /u021M24PZbBsoINj+FKmYkPTvw8k1ZXhNi0urar3ToToTycF8LRTcXE5+z9zxZc01xs zGBay+iov0T96cnSp1jliAYP6o4nOH/uiVl6oPrNZWlrVmKdMQdOK6oqV51MzGVu/QKr FzMQ== X-Gm-Message-State: AOAM530U+9qLntkeKp4/vDIXbXRF0QSQ4cluyV1D3b8J80pScfpfsdWn 4lOLiQl2CmL9bLxADZuY76eO2CcGt9w= X-Google-Smtp-Source: ABdhPJzosCadetFdrNP0zPjt6jcq/LIIkDoBnVTHD8kvKx/Q2byH/sB/fFQs+a0JxxD6Zj5JPTH70Q== X-Received: by 2002:a17:90a:1704:b0:1c6:691b:17f3 with SMTP id z4-20020a17090a170400b001c6691b17f3mr1775281pjd.187.1648068954420; Wed, 23 Mar 2022 13:55:54 -0700 (PDT) Received: from mail-ash-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x7-20020a056a00188700b004fae6f0d3e5sm600521pfh.175.2022.03.23.13.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 13:55:53 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , stable@vger.kernel.org, Dick Kennedy Subject: [PATCH 1/2] lpfc: Fix broken sli4 abort path Date: Wed, 23 Mar 2022 13:55:44 -0700 Message-Id: <20220323205545.81814-2-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220323205545.81814-1-jsmart2021@gmail.com> References: <20220323205545.81814-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org There was a merge error in ther 14.2.0.0 patches that resulted in the sli4 path using the sli3 issue_abort_iotag routine. This resulted in txcmplq corruption. Fix to use the sli4 routine when sli4. Fixes: 31a59f75702f ("scsi: lpfc: SLI path split: Refactor Abort paths") Cc: # v5.2+ Co-developed-by: Dick Kennedy Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_scsi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 3c132604fd91..ba9dbb51b75f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -5929,13 +5929,15 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) } lpfc_cmd->waitq = &waitq; - if (phba->sli_rev == LPFC_SLI_REV4) + if (phba->sli_rev == LPFC_SLI_REV4) { spin_unlock(&pring_s4->ring_lock); - else + ret_val = lpfc_sli4_issue_abort_iotag(phba, iocb, + lpfc_sli_abort_fcp_cmpl); + } else { pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; - - ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb, - lpfc_sli_abort_fcp_cmpl); + ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb, + lpfc_sli_abort_fcp_cmpl); + } /* Make sure HBA is alive */ lpfc_issue_hb_tmo(phba); From patchwork Wed Mar 23 20:55:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 553994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC884C433EF for ; Wed, 23 Mar 2022 20:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240826AbiCWU53 (ORCPT ); Wed, 23 Mar 2022 16:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239385AbiCWU50 (ORCPT ); Wed, 23 Mar 2022 16:57:26 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2099A8B6C7 for ; Wed, 23 Mar 2022 13:55:56 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id z128so2172084pgz.2 for ; Wed, 23 Mar 2022 13:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F4xUjka7VgCXSVu4TpGpu5Q5hXqYQhaOUslri8F6FtE=; b=Jh5ZJRmdvdzB95LuMBJ9JSKkpXSMvMGAQWG3AAHB0ZeBXgzCIJuJgr23Gt3Sdh6i1c 2IVtQE8BmfaZHvk2ViZgjT/SVMKpO73LqebcHF7MdxryeCQ6zK3wATc6DzGV4goGe12e XJ+EVGlPqRaUtQkWs40+gSy0y2DFBTEVChV1SDMRbEFCQH3QN0DxNOg8degVFBEMdbzL YVjuscLCwNKEHL1Ge3BNMjS0oTa8x10mRSUSjPJaNqS4HYBFoTC98Z5LqAMITNKro5y+ FAVCW5agkfwGCfI3kCsaJSI5djGh3OR+nVBIZF8ST/aJh+IhP5tMViOKwgxRKyU0FthT 4F2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F4xUjka7VgCXSVu4TpGpu5Q5hXqYQhaOUslri8F6FtE=; b=qbe1RS4uvtiVcCQr34JhHzrkJUaByoSPeCrlVAA/mMaKVIY8bC3h9vAjHeunpFInUP VMfRCjVnRixWkM8+eSQYHy5Gq0Ou7i7mUjlZmTzZfvwkBVoJ3X+zJ+vzp3l4rKcjyGAr d+6Es3WHELmUXXNHxts9+noNJlcAeCyXr15F7eB6WigF5eKIn5GpObJfy7UwxQCzfEh1 GMH7mq+Mv0LWR6Q1x7DVaMxGc5OIT0+/AmRUWqdDvG+b5qeHep5Bv8QAhoS4sxAqxgXD kVOsLogAImpgzcJhhqco+hoZHebAeixWL4rarEbA5H4XXqfOqVJ8H2eIGO+DIS3Z5G3p 7BjQ== X-Gm-Message-State: AOAM530A2pV+I7/A4rj6avU7ygQiEl0kHJ4I33MTyDTLBZ/V0MfAi1Bk 5E3dGvGyD7ihCnoLPYE9dxqrNb9CiGs= X-Google-Smtp-Source: ABdhPJy9XrbmSMr/fE4QSJr6rpw0ogDJ8i7zH43Z/GTbMzCl+UDOZNZl0M0xzS0HpiTO2HWPt6Eqig== X-Received: by 2002:a05:6a00:1acd:b0:4fa:778f:8570 with SMTP id f13-20020a056a001acd00b004fa778f8570mr1360604pfv.75.1648068955505; Wed, 23 Mar 2022 13:55:55 -0700 (PDT) Received: from mail-ash-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x7-20020a056a00188700b004fae6f0d3e5sm600521pfh.175.2022.03.23.13.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 13:55:55 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy Subject: [PATCH 2/2] lpfc: Fix locking for lpfc_sli_iocbq_lookup Date: Wed, 23 Mar 2022 13:55:45 -0700 Message-Id: <20220323205545.81814-3-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220323205545.81814-1-jsmart2021@gmail.com> References: <20220323205545.81814-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The rules changed for lpfc_sli_iocbq_lookup vs locking. Prior, the routine properly took out the lock. In newly refactored code, the locks must be held when calling the routine. Fix lpfc_sli_process_sol_iocb() to take the locks before calling the routine. Fix lpfc_sli_handle_fast_ring_event() to not release the locks to call the routine. Fixes: 1b64aa9eae28 ("scsi: lpfc: SLI path split: Refactor fast and slow paths to native SLI4") Co-developed-by: Dick Kennedy Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_sli.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 20d40957a385..b6a0da28b00f 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -3715,7 +3715,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, unsigned long iflag; u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag; + if (phba->sli_rev == LPFC_SLI_REV4) + spin_lock_irqsave(&pring->ring_lock, iflag); + else + spin_lock_irqsave(&phba->hbalock, iflag); cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); + if (phba->sli_rev == LPFC_SLI_REV4) + spin_unlock_irqrestore(&pring->ring_lock, iflag); + else + spin_unlock_irqrestore(&phba->hbalock, iflag); ulp_command = get_job_cmnd(phba, saveq); ulp_status = get_job_ulpstatus(phba, saveq); @@ -4052,10 +4060,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, break; } - spin_unlock_irqrestore(&phba->hbalock, iflag); cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, &rspiocbq); - spin_lock_irqsave(&phba->hbalock, iflag); if (unlikely(!cmdiocbq)) break; if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED)