From patchwork Wed Sep 30 15:47:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 7299711 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91024BEEA4 for ; Wed, 30 Sep 2015 15:52:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BACD8206F9 for ; Wed, 30 Sep 2015 15:52:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DAC8920650 for ; Wed, 30 Sep 2015 15:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754552AbbI3Psv (ORCPT ); Wed, 30 Sep 2015 11:48:51 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34584 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754433AbbI3Pso (ORCPT ); Wed, 30 Sep 2015 11:48:44 -0400 Received: by padhy16 with SMTP id hy16so44230989pad.1 for ; Wed, 30 Sep 2015 08:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GelXBatJm/HdPtcYqbBPgWBN6YWMIgxuMg+7BGcUo9M=; b=pBXZ5+0I3UK28qELtwyRY1qs+wsVcdEvU7sO3/Brc6yzi3/l9Khuv2zFUCr8GZG+pc LIDlEqn/t6eZfHWjWMS0up4NBABanOByKjv8yhTUhUPFJCT3sPX4nNoL28rtxMgqZ45W wz8T/I3CGophFhHYS2LmKAcJr+9JDPXVzQrDA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GelXBatJm/HdPtcYqbBPgWBN6YWMIgxuMg+7BGcUo9M=; b=PJbD/t4YcvAm3RyD0faZOVL879d2TY6sfWkgnIvmV6b+rp74O27g4XpKcFI9LLMqu3 7VD0VoMoeqw/1cOcyz9EHR8Gc90qm+wQU9s4RB6Ccpv1KsOCU/wuLFuzd4BtiUrUHKxM Hfa7P2wpShSdr6g7sp77alzp9ji3mLfwxitIub8vmrrehTNsXATGbWhel/TZdTqxxTLR WOJ3TVSh0B2R8slgMp1WrSJ0LpQwOEcSsoSZmZJUI8/5CMiO+Ov6jL4Fz78L+0tUgn9W L4VFyvVl3StsQ1ONyYimqq5pmQnW2zG69nthzxbKga9njxy4wZf3HoWjJNcGcJl8WXEM hfyw== X-Gm-Message-State: ALoCoQm3KTS4r78W1F8hs84Yw0VNRVl/QNf7oK9PpBxbILJ1XiWn4mCmUGWwxWpi9r77BqYZPSqG X-Received: by 10.67.6.164 with SMTP id cv4mr5742873pad.59.1443628124136; Wed, 30 Sep 2015 08:48:44 -0700 (PDT) Received: from host1.lsi.com ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id xg2sm1458666pbb.2.2015.09.30.08.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 08:48:43 -0700 (PDT) From: Sreekanth Reddy X-Google-Original-From: Sreekanth Reddy To: jejb@kernel.org, hch@infradead.org Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, JBottomley@Parallels.com, Sathya.Prakash@avagotech.com, chaitra.basappa@avagotech.com, suganath-prabu.subramani@avagotech.com, linux-kernel@vger.kernel.org, Sreekanth Reddy Subject: [PATCH 11/18] mpt3sas: fix for driver fails EEH, recovery from injected pci bus error Date: Wed, 30 Sep 2015 21:17:11 +0530 Message-Id: <1443628038-13552-12-git-send-email-Sreekanth.Reddy@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1443628038-13552-1-git-send-email-Sreekanth.Reddy@avagotech.com> References: <1443628038-13552-1-git-send-email-Sreekanth.Reddy@avagotech.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch stops the driver to invoke kthread (which remove the dead ioc) for some time while EEH recovery has started. This changes are ported from below mpt2sas driver patch 'commit b4730fb6e54a634a145c9c71c5cf856f00beb5cd ("mpt2sas: fix for driver fails EEH, recovery from injected pci bus error")' Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpt3sas/mpt3sas_base.c | 19 ++++++++++++++++++- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 2b33e48..b5b1eb2 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -157,7 +157,7 @@ _base_fault_reset_work(struct work_struct *work) spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); - if (ioc->shost_recovery) + if (ioc->shost_recovery || ioc->pci_error_recovery) goto rearm_timer; spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); @@ -166,6 +166,20 @@ _base_fault_reset_work(struct work_struct *work) pr_err(MPT3SAS_FMT "SAS host is non-operational !!!!\n", ioc->name); + /* It may be possible that EEH recovery can resolve some of + * pci bus failure issues rather removing the dead ioc function + * by considering controller is in a non-operational state. So + * here priority is given to the EEH recovery. If it doesn't + * not resolve this issue, mpt3sas driver will consider this + * controller to non-operational state and remove the dead ioc + * function. + */ + if (ioc->non_operational_loop++ < 5) { + spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, + flags); + goto rearm_timer; + } + /* * Call _scsih_flush_pending_cmds callback so that we flush all * pending commands back to OS. This call is required to aovid @@ -193,6 +207,8 @@ _base_fault_reset_work(struct work_struct *work) return; /* don't rearm timer */ } + ioc->non_operational_loop = 0; + if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) { rc = mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, FORCE_BIG_HAMMER); @@ -5162,6 +5178,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) if (r) goto out_free_resources; + ioc->non_operational_loop = 0; return 0; out_free_resources: diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 08f46a7..a0d1f13 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -845,6 +845,7 @@ struct MPT3SAS_ADAPTER { u16 cpu_msix_table_sz; u32 ioc_reset_count; MPT3SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds; + u32 non_operational_loop; /* internal commands, callback index */ u8 scsi_io_cb_idx;