From patchwork Wed Apr 7 02:04:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 417119 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.6 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, MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 CB857C433ED for ; Wed, 7 Apr 2021 02:05:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9EE3613B8 for ; Wed, 7 Apr 2021 02:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344378AbhDGCFM (ORCPT ); Tue, 6 Apr 2021 22:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344303AbhDGCFH (ORCPT ); Tue, 6 Apr 2021 22:05:07 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4426C06174A for ; Tue, 6 Apr 2021 19:04:58 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id z22-20020a17090a0156b029014d4056663fso493665pje.0 for ; Tue, 06 Apr 2021 19:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AaN8an06OWJwHqkiDWD/jfO+DU4VBQ1oMOgLAiwh8Fc=; b=T3Bvx1Ub0ctScjM92DwcYLetm2tc2U+MV7rUD6F0brrmed9xczan+o2/QsHCthcZUs QlNxPg/lmHqcJ/nyMkShPx3NugXj7BESEYJaSiYXpejg1CVZUr17l3wY9kWnLfv0w59y HGUTOY5q//blc2K2nyQDwb72J3E4W3Rhs4OQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AaN8an06OWJwHqkiDWD/jfO+DU4VBQ1oMOgLAiwh8Fc=; b=VEhzKYoVxNu+y/iV8qex9S5dXVQkw8HIQ/XAv7e0Xyr57/7gziirI0pIDiLaB1fe5h KGotXMXu66RWvOH8mvoN8ezs53oWGggRfN1qYlpqEdSwJCFZrWgpGNryLgskYNE1fgbZ ogcwPTgWg8S74vjEf8SmVRm1VWpkmzvqfXc5rh+yK+0gQ7i/9Kmlxv6Xpvc2iLH8gb7K Pe8cf2WK8YnwtTybMdFGFixoXCfwy09scnOT7/XAe4TyHVboKr4DtKfo3heKLoNQc5CA SzqFrjLpHj38pxYIpIsl5CLX7LViKSoALSRvu+slCZFCAoqtrEnB57VvhqW2vAqrTwx+ bhEA== X-Gm-Message-State: AOAM531SNuxY4b2CwWgUAjmunpO2ZAFYLeNPetJ18oZPzJYLfvFCIDPy tCknom5hpefCmNdYLA13QWyE6gsY4ubM7uc2M23t75751wcSRhpKYAqbb+cRWGDKf2+EH9nJIkP 8FJhH7t+g859lxxLCj2sYAvkYPGwnjZqgkzpGdl8XX/dGuBjbHRF1Baj65idehcmUWh7dJ/6gcr qayJajIQ== X-Google-Smtp-Source: ABdhPJxs0TFBqqgBRb/6J6DUo3pMb7YRUqodT81NHKS2T/5FDlGsTft0fuT2NQXmE4WVAMTTD1CRCg== X-Received: by 2002:a17:902:6541:b029:e6:27a4:80fb with SMTP id d1-20020a1709026541b02900e627a480fbmr892887pln.15.1617761098009; Tue, 06 Apr 2021 19:04:58 -0700 (PDT) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y9sm3435858pja.50.2021.04.06.19.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 19:04:57 -0700 (PDT) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: Kashyap Desai , sathya.prakash@broadcom.com Subject: [PATCH v2 20/24] mpi3mr: wait for pending IO completions upon detection of VD IO timeout Date: Wed, 7 Apr 2021 07:34:47 +0530 Message-Id: <20210407020451.924822-21-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210407020451.924822-1-kashyap.desai@broadcom.com> References: <20210407020451.924822-1-kashyap.desai@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Wait for (default 180 seconds) host IO completion if IO timeout is detected on VDs Signed-off-by: Kashyap Desai Reviewed-by: Hannes Reinecke Cc: sathya.prakash@broadcom.com Reviewed-by: Tomas Henzl --- drivers/scsi/mpi3mr/mpi3mr.h | 1 + drivers/scsi/mpi3mr/mpi3mr_fw.c | 2 ++ drivers/scsi/mpi3mr/mpi3mr_os.c | 45 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index ff3e68a6d0b5..505df0e7b852 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -102,6 +102,7 @@ extern struct list_head mrioc_list; #define MPI3MR_RESET_HOST_IOWAIT_TIMEOUT 5 #define MPI3MR_TSUPDATE_INTERVAL 900 #define MPI3MR_DEFAULT_SHUTDOWN_TIME 120 +#define MPI3MR_RAID_ERRREC_RESET_TIMEOUT 180 #define MPI3MR_WATCHDOG_INTERVAL 1000 /* in milli seconds */ diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 79a9f98c736e..f09330bb4b8a 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -3775,6 +3775,8 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, } } + mpi3mr_wait_for_host_io(mrioc, MPI3MR_RESET_HOST_IOWAIT_TIMEOUT); + mpi3mr_ioc_disable_intr(mrioc); if (snapdump) { diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 8cf591a031b5..0976352f423f 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -2434,6 +2434,43 @@ static void mpi3mr_print_pending_host_io(struct mpi3mr_ioc *mrioc) mpi3mr_print_scmd, (void *)mrioc); } +/** + * mpi3mr_wait_for_host_io - block for I/Os to complete + * @mrioc: Adapter instance reference + * @timeout: time out in seconds + * Waits for pending I/Os for the given adapter to complete or + * to hit the timeout. + * + * Return: Nothing + */ +void mpi3mr_wait_for_host_io(struct mpi3mr_ioc *mrioc, u32 timeout) +{ + enum mpi3mr_iocstate iocstate; + int i = 0; + + iocstate = mpi3mr_get_iocstate(mrioc); + if (iocstate != MRIOC_STATE_READY) + return; + + if (!mpi3mr_get_fw_pending_ios(mrioc)) + return; + ioc_info(mrioc, + "%s :Waiting for %d seconds prior to reset for %d I/O\n", + __func__, timeout, mpi3mr_get_fw_pending_ios(mrioc)); + + for (i = 0; i < timeout; i++) { + if (!mpi3mr_get_fw_pending_ios(mrioc)) + break; + iocstate = mpi3mr_get_iocstate(mrioc); + if (iocstate != MRIOC_STATE_READY) + break; + msleep(1000); + } + + ioc_info(mrioc, "%s :Pending I/Os after wait is: %d\n", __func__, + mpi3mr_get_fw_pending_ios(mrioc)); +} + /** * mpi3mr_eh_host_reset - Host reset error handling callback * @scmd: SCSI command reference @@ -2459,6 +2496,14 @@ static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd) dev_type = stgt_priv_data->dev_type; } + if (dev_type == MPI3_DEVICE_DEVFORM_VD) { + mpi3mr_wait_for_host_io(mrioc, + MPI3MR_RAID_ERRREC_RESET_TIMEOUT); + if (!mpi3mr_get_fw_pending_ios(mrioc)) { + retval = SUCCESS; + goto out; + } + } mpi3mr_print_pending_host_io(mrioc); ret = mpi3mr_soft_reset_handler(mrioc, MPI3MR_RESET_FROM_EH_HOS, 1);