Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3119221rwb; Mon, 15 Aug 2022 18:35:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cpc6APb81WmKmeJmGdKHWDM80WzoCvGNNUQ0jZfs+liU/aCIXT2anYa69Qrtw4MikEusO X-Received: by 2002:a17:903:24f:b0:172:7d68:cf1 with SMTP id j15-20020a170903024f00b001727d680cf1mr504831plh.55.1660613721680; Mon, 15 Aug 2022 18:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613721; cv=none; d=google.com; s=arc-20160816; b=PM6tVMDlM3wdEhtfR93sVR+bevSaMW05lYAY4EhRViGCpHH+GgfpIqsZu7TEKz8cGc tf74UszPsO9GsxUKN55JDrhwZUDLfhwrQ6JviUlh1KBSl4/g30dVnaCcvKd/zAeriVJY QwwdDI+yKnVT6crliV4lxoYukDiGXoHsviRb8cMhAAv1R0ObRXQtiTzNP9tuM72dVWPK gX6R/a+zU+s1uXGythityNprOxKCrZ8XLZkAMkKK/V1M51RpNCra/urqTtTcMb50J2Dp jxLl9TEFGhct3hidHc0tTOR3RtYF8JKAvT34PQ+wPpTl6fYAznTp9QHoCe9UlTv8IrwG l8rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DW3pCnAG4/CuqkYfi810PD+Me8Ho89wfWrm2gV+F4gQ=; b=fsa4uqfn71cc+2YbNlefCygW5rrzf1odnj2UCDPYgf1WQqWd0JRMZ97ka7By0l4pyM 2I5IIDqdjyPmn3VHouaRBHxoM5IXvbzSi8KpqV5B6xE7ua6x/9n5TeRVAWVdqPrYyUIa EwkAyWrBXThIBtidi5gq5cWVhkx2sxIzXrKo604RPQfhklv+gbYTdGZY0cjEa2qheCAE NycOsRAYCvlx/Sd5oAb4yVfXeHdKoZuNK5ZpgTETlsOsZFT302usb67cHkA9t6LnxLTc 4eObvBDET0g15Im6n3pKJFTLWehDQHa/aubcriQHNmdkQ1DfbuCeSfuA/8j2kXTifzf4 x1lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K9Kq1T61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d20-20020a170902729400b001713d5d096esi12528207pll.14.2022.08.15.18.35.10; Mon, 15 Aug 2022 18:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K9Kq1T61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348133AbiHPAv7 (ORCPT + 99 others); Mon, 15 Aug 2022 20:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349245AbiHPAqd (ORCPT ); Mon, 15 Aug 2022 20:46:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD5F9178C19; Mon, 15 Aug 2022 13:45:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E15DF61262; Mon, 15 Aug 2022 20:45:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD3C9C433B5; Mon, 15 Aug 2022 20:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596318; bh=BWkT5Y8yauvayeEYP3032GkgL1q2sJJNLjErP6LavCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9Kq1T61Z/1O2gfSpnvxZJQt+urzSogw3N4hy67W7c58k3tl+c7A9Adi+H4P2SQyf tezi1z5EYSicagV4d+25W5DSHM04Ko4XDSGmKb/ZnYOPLQTDZ1Wl+zNMUwQyi8v4V9 ijkWsWO5JTdLtUvFsCe50SC7Y4Pda+jyxFmG7JfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Bannoth , Kyle Mahlkuch , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.19 1040/1157] scsi: qla2xxx: Fix erroneous mailbox timeout after PCI error injection Date: Mon, 15 Aug 2022 20:06:36 +0200 Message-Id: <20220815180521.594043203@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quinn Tran commit f260694e6463b63ae550aad25ddefe94cb1904da upstream. Clear wait for mailbox interrupt flag to prevent stale mailbox: Feb 22 05:22:56 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-500a:4: LOOP UP detected (16 Gbps). Feb 22 05:22:59 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-d04c:4: MBX Command timeout for cmd 69, ... To fix the issue, driver needs to clear the MBX_INTR_WAIT flag on purging the mailbox. When the stale mailbox completion does arrive, it will be dropped. Link: https://lore.kernel.org/r/20220616053508.27186-11-njavali@marvell.com Fixes: b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request") Cc: Naresh Bannoth Cc: Kyle Mahlkuch Cc: stable@vger.kernel.org Reported-by: Naresh Bannoth Tested-by: Naresh Bannoth Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_mbx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -276,6 +276,12 @@ qla2x00_mailbox_command(scsi_qla_host_t atomic_inc(&ha->num_pend_mbx_stage3); if (!wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ)) { + ql_dbg(ql_dbg_mbx, vha, 0x117a, + "cmd=%x Timeout.\n", command); + spin_lock_irqsave(&ha->hardware_lock, flags); + clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); + spin_unlock_irqrestore(&ha->hardware_lock, flags); + if (chip_reset != ha->chip_reset) { eeh_delay = ha->flags.eeh_busy ? 1 : 0; @@ -288,12 +294,6 @@ qla2x00_mailbox_command(scsi_qla_host_t rval = QLA_ABORTED; goto premature_exit; } - ql_dbg(ql_dbg_mbx, vha, 0x117a, - "cmd=%x Timeout.\n", command); - spin_lock_irqsave(&ha->hardware_lock, flags); - clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); - spin_unlock_irqrestore(&ha->hardware_lock, flags); - } else if (ha->flags.purge_mbox || chip_reset != ha->chip_reset) { eeh_delay = ha->flags.eeh_busy ? 1 : 0;