From patchwork Tue Dec 22 10:11:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 11986253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E06EC433E9 for ; Tue, 22 Dec 2020 10:14:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A9052311D for ; Tue, 22 Dec 2020 10:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726488AbgLVKOS (ORCPT ); Tue, 22 Dec 2020 05:14:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgLVKOS (ORCPT ); Tue, 22 Dec 2020 05:14:18 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2BAFC0611CF for ; Tue, 22 Dec 2020 02:13:17 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id q22so8171027pfk.12 for ; Tue, 22 Dec 2020 02:13:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references; bh=af/30sSBa8jFiIZ6AKhJ31eghFtN+mYNsZgSED9r9H8=; b=SfeqI4UqoKW1ZcIov0IiiK8xfKnvTjtgLT59aTvt4VVfo/tfYtNDNCMRhMaom8QxDx j/JbPc9p+ZLcCWeJOakerbdU7nnZAhjmTdGYLdN23sjhQAgA1XLUfG1j0Te5Z1gkTWxE 2DPc5AidPdVCW/QFfaKbgXkGa8REtbURQTxM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references; bh=af/30sSBa8jFiIZ6AKhJ31eghFtN+mYNsZgSED9r9H8=; b=SPDVnfl+BMGXVYDFr2LoVTS/EihmaSg+881MoQbSXH8JpAzsLjx/apbxSfV/Holr/O BP6I+SGJ27mkVX5qG4HaNf85jXGEOsAEjqITLAoWPh2iQ8jOdh21XbTFuoBu8jNHLFc4 caobCY0zotLGQKzeu1cHv+vmAEjGfnVXPIm5mZd6RhUH/yE+K01M3qG78sCaiMTBNlDn oifwvn/s2hczdZjrvYnDbbPBDlkCTF7Je6Sb8EUBaflI6R9cMFB85HvvebeVQDFoh6sg k1l4QUFVclGb6zKD3LiZvIyM/wdEtBIVpI2tMXXomSw3R+ywZHWxx37IAANcI6x7zoU4 i3Rw== X-Gm-Message-State: AOAM530LDjepSSs261uBalE6WIpVztlalt+aqfT7CXmcew/Kw78TM7bK xcWInarbdJ4B/3aqGYPchv90Lgx6zSxqxpiycAVAfgpvgvrbHUQ7tynsPalSJQaPQ6apgM9B8up Xcev+jRUljmthiIefLVd//FSXDn8PYrJfS1UMFn+WYaKzq7hHW5Im8N/cGk0vLQRpz/sxdSOjmz 2DN3750UIQ MIME-Version: 1.0 X-Google-Smtp-Source: ABdhPJxOVvd22J7XJIbWCSY7lRND5Sk2NyPzVHA6ZwWpW7PEtQkfBiwSejDcDOm92uC5aQ3tC7UFUg== X-Received: by 2002:a05:6a00:44:b029:19d:e250:1355 with SMTP id i4-20020a056a000044b029019de2501355mr19072397pfk.36.1608631997137; Tue, 22 Dec 2020 02:13:17 -0800 (PST) Received: from drv-bst-rhel8.static.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id p16sm19148624pju.47.2020.12.22.02.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:13:16 -0800 (PST) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com, steve.hagan@broadcom.com, peter.rivera@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, Kashyap Desai , sathya.prakash@broadcom.com Subject: [PATCH 19/24] mpi3mr: print pending host ios for debug Date: Tue, 22 Dec 2020 15:41:51 +0530 Message-Id: <20201222101156.98308-20-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20201222101156.98308-1-kashyap.desai@broadcom.com> References: <20201222101156.98308-1-kashyap.desai@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Kashyap Desai Cc: sathya.prakash@broadcom.com Reviewed-by: Hannes Reinecke --- drivers/scsi/mpi3mr/mpi3mr_os.c | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 742cf45d4878..8e665c70604d 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -334,6 +334,36 @@ void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) } } +/** + * mpi3mr_print_scmd - print individual SCSI command + * @rq: Block request + * @data: Adapter instance reference + * + * Print the SCSI command details if it is in LLD scope. + * + * Return: true always. + */ +static bool mpi3mr_print_scmd(struct request *rq, + void *data, bool reserved) +{ + struct mpi3mr_ioc *mrioc = (struct mpi3mr_ioc *)data; + struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq); + struct scmd_priv *priv = NULL; + + if (scmd) { + priv = scsi_cmd_priv(scmd); + if (!priv->in_lld_scope) + goto out; + + ioc_info(mrioc, "%s :Host Tag = %d, qid = %d\n", + __func__, priv->host_tag, priv->req_q_idx + 1); + scsi_print_command(scmd); + } + +out: + return(true); +} + /** * mpi3mr_flush_scmd - Flush individual SCSI command @@ -2370,6 +2400,43 @@ static int mpi3mr_map_queues(struct Scsi_Host *shost) mrioc->pdev, mrioc->op_reply_q_offset); } +/** + * mpi3mr_get_fw_pending_ios - Calculate pending I/O count + * @mrioc: Adapter instance reference + * + * Calculate the pending I/Os for the controller and return. + * + * Return: Number of pending I/Os + */ +static inline int mpi3mr_get_fw_pending_ios(struct mpi3mr_ioc *mrioc) +{ + u16 i; + uint pend_ios = 0; + + for (i = 0; i < mrioc->num_op_reply_q; i++) + pend_ios += atomic_read(&mrioc->op_reply_qinfo[i].pend_ios); + return pend_ios; +} + +/** + * mpi3mr_print_pending_host_io - print pending I/Os + * @mrioc: Adapter instance reference + * + * Print number of pending I/Os and each I/O details prior to + * reset for debug purpose. + * + * Return: Nothing + */ +static void mpi3mr_print_pending_host_io(struct mpi3mr_ioc *mrioc) +{ + struct Scsi_Host *shost = mrioc->shost; + + ioc_info(mrioc, "%s :Pending commands prior to reset: %d\n", + __func__, mpi3mr_get_fw_pending_ios(mrioc)); + blk_mq_tagset_busy_iter(&shost->tag_set, + mpi3mr_print_scmd, (void *)mrioc); +} + /** * mpi3mr_eh_host_reset - Host reset error handling callback * @scmd: SCSI command reference @@ -2395,6 +2462,7 @@ static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd) dev_type = stgt_priv_data->dev_type; } + mpi3mr_print_pending_host_io(mrioc); ret = mpi3mr_soft_reset_handler(mrioc, MPI3MR_RESET_FROM_EH_HOS, 1); if (ret)