Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp652206pxb; Tue, 5 Apr 2022 17:23:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz52N+qIxEw/WxOHW1Q6Wdj9ZDpcjbQwTrx5O3PNHUPItuF9Rt7gRjZCo43grDymOx2CTwE X-Received: by 2002:a65:645a:0:b0:386:53e:8d61 with SMTP id s26-20020a65645a000000b00386053e8d61mr4857771pgv.166.1649204586376; Tue, 05 Apr 2022 17:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649204586; cv=none; d=google.com; s=arc-20160816; b=pzLbllPWd7ias/oDF604dsQojq4vXBTQlFM3ayPtPI8x2nMJOAaJEecHWqW0bgTYZi izYVNIpr+mU0l8vJZsRbpWasPggt0wu6wIGWDP1XUiY4lNnhtUY1QaCBo4JSwQGGSE2q XDDMLs1kFnzek4fGEvVIau+MPQb3F94jrlO+N3EUg6NkhY5qrJoidb/J6uVUHCKevanz PiN4PPfIXK0qURyn0bjNW18q3yCOVebmzfsZaavVC8huwozkBICT9iUEBlU6JvfQj0n8 CY5Th4MywJzyYJHHmLjp2v79leO5Oanz3sDHsbEZVMs0gKfoxk5F6yASQv4itSk2BYe8 AMfA== 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=JnBgGQMOpaHB4TtEWrUZ/kxw4ZGWco3vCjklX/UQHPY=; b=yqtQvKwCJKGLFqA4traQ8GJQklNkXoq/T3Mmc2UZl6dKExAPACBNx01gACJazfNh1B vAyXApQsiRpfEVtQ00Zr0t9yb3LlbKG24jUkkZSm3dksjPJlKDn1vK/hhP+T9Q5t6csU CrSSPuIez4xm7ELdoQnze3DSD1HeHDow08CcuMnVknZHtJebMMwrUUxKyjm3i61O2gd+ nOOgSl5FO6QvL8SF4Rx/nVJwPliWlbqQ8u9zhVz6kT9UOtPKmz4STrMEsehXmC/oTdTU S038oP82O3kqt/CCSusp+RPirYhNQGUPiduwso9j2OZb7IHBoiAC/MZ2xFP88PjMp8Ni j94A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wp3ArhXI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y5-20020a62ce05000000b004fe46373984si2382958pfg.212.2022.04.05.17.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 17:23:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wp3ArhXI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A9428208313; Tue, 5 Apr 2022 17:09:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384832AbiDENcc (ORCPT + 99 others); Tue, 5 Apr 2022 09:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345771AbiDEJXB (ORCPT ); Tue, 5 Apr 2022 05:23:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A718CCFB; Tue, 5 Apr 2022 02:12:08 -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 ams.source.kernel.org (Postfix) with ESMTPS id B1939B81A12; Tue, 5 Apr 2022 09:12:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AC69C385A3; Tue, 5 Apr 2022 09:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149926; bh=CtNUPttv43ymyB/SUDL/IvZBJI2TaBEMgGHG76F1Mz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wp3ArhXInp6yc3/7i6/nZAq1mesovDRq+irpz8CmbBb2jS1Vg0tHiX53YWRgudXt6 hE3oIajVdHAC3fc04tJO4ks9lO7sGCAMkBnw+kH4KDtwCMQsoFfuFawS7y+IwLE/+W 70j4T7QrmuW9V4FgWZcOSnilglBeBEQaXKr6sLQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.16 0892/1017] scsi: qla2xxx: Fix laggy FC remote port session recovery Date: Tue, 5 Apr 2022 09:30:05 +0200 Message-Id: <20220405070420.706251110@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 713b415726f100f6644971e75ebfe1edbef1a390 upstream. For session recovery, driver relies on the dpc thread to initiate certain operations. The dpc thread runs exclusively without the Mailbox interface being occupied. A recent code change for heartbeat check via mailbox cmd 0 is preventing the dpc thread from carrying out its operation. This patch allows the higher priority error recovery to run first before running the lower priority heartbeat check. Link: https://lore.kernel.org/r/20220310092604.22950-9-njavali@marvell.com Fixes: d94d8158e184 ("scsi: qla2xxx: Add heartbeat check") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani 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_def.h | 1 + drivers/scsi/qla2xxx/qla_os.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4621,6 +4621,7 @@ struct qla_hw_data { struct workqueue_struct *wq; struct work_struct heartbeat_work; struct qlfc_fw fw_buf; + unsigned long last_heartbeat_run_jiffies; /* FCP_CMND priority support */ struct qla_fcp_prio_cfg *fcp_prio_cfg; --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -7209,7 +7209,7 @@ skip: return do_heartbeat; } -static void qla_heart_beat(struct scsi_qla_host *vha) +static void qla_heart_beat(struct scsi_qla_host *vha, u16 dpc_started) { struct qla_hw_data *ha = vha->hw; @@ -7219,8 +7219,19 @@ static void qla_heart_beat(struct scsi_q if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) return; - if (qla_do_heartbeat(vha)) + /* + * dpc thread cannot run if heartbeat is running at the same time. + * We also do not want to starve heartbeat task. Therefore, do + * heartbeat task at least once every 5 seconds. + */ + if (dpc_started && + time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) + return; + + if (qla_do_heartbeat(vha)) { + ha->last_heartbeat_run_jiffies = jiffies; queue_work(ha->wq, &ha->heartbeat_work); + } } /************************************************************************** @@ -7411,6 +7422,8 @@ qla2x00_timer(struct timer_list *t) start_dpc++; } + /* borrowing w to signify dpc will run */ + w = 0; /* Schedule the DPC routine if needed */ if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || @@ -7443,9 +7456,10 @@ qla2x00_timer(struct timer_list *t) test_bit(RELOGIN_NEEDED, &vha->dpc_flags), test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); qla2xxx_wake_dpc(vha); + w = 1; } - qla_heart_beat(vha); + qla_heart_beat(vha, w); qla2x00_restart_timer(vha, WATCH_INTERVAL); }