From patchwork Fri Jan 5 13:27:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10146579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5D5C601A1 for ; Fri, 5 Jan 2018 13:29:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54F7287CD for ; Fri, 5 Jan 2018 13:29:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA306287D3; Fri, 5 Jan 2018 13:29:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A2D1287CD for ; Fri, 5 Jan 2018 13:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751818AbeAEN31 (ORCPT ); Fri, 5 Jan 2018 08:29:27 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37873 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751815AbeAEN31 (ORCPT ); Fri, 5 Jan 2018 08:29:27 -0500 Received: by mail-pf0-f194.google.com with SMTP id n6so2183671pfa.4 for ; Fri, 05 Jan 2018 05:29:27 -0800 (PST) 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=w8BDAEOzjods++/fXX0zouTprJChqrwqi+QRrSMYOSI=; b=L2rI+E3YU5Ty02LzA9D1yFuMUxXQW8PF6W3MRGwX8UhMl/OhXbTnPFc7ibWBwyKtqV QVL1VMXD3JbYB0Xce/Av5XKN5Rs5NQVGJ9nr3BMCNWZMBRUSPdX0Wfxvus9Mslphtm2k DQEU6i5ksdQ15C/VVdQuB4eCQmDq0ouwTuv9A= 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=w8BDAEOzjods++/fXX0zouTprJChqrwqi+QRrSMYOSI=; b=VVyqZOGDbyUCwfZizvHH20sORI57oYGsS4pGXZJCdbOk0WhNPdr9/IZcp5+QpG57u/ pVwDbqzVoRWa7ZkKYA8HYuPYfbja9Fh7rhflpeTtGjS++KHt8sRWD5eIqn2sek8Ps7cD takXhrMVHyEawu99wUFciLInrdlhN7asNhrA28SSwHDOkqJ0R+32ymQUacwYs4hygP4D /o24ZPN3Uybvxth/fVnNtsgv9cRmAU54N2JXIwef08xgLepWXsPHOY6MZaJStp6biJEV 7ykrijg6Wl1ZhQsiBQ7CCDzCVEIjgjgDJVBnfNAEc/NESAsoQtlMWpoRhopUOLr5Uu+T NAsQ== X-Gm-Message-State: AKGB3mJXJd1SU/o5tNENwLtdsltWumstfjnPiUgcZhLcOn4m11nP/hxp eu/D6qlWUNDg/JmBIH6Ryua5Q7Qj X-Google-Smtp-Source: ACJfBosFfumJNHlDOzklPYANNW74r5zRxAw9Xrcdsrn8WGiSGvzGFDfsmPk+ktqi5s+Oa5wDKeQAIA== X-Received: by 10.99.96.23 with SMTP id u23mr834317pgb.199.1515158966257; Fri, 05 Jan 2018 05:29:26 -0800 (PST) Received: from dhcp-135-24-192-142.localdomain ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id 68sm12588733pfx.186.2018.01.05.05.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 05:29:24 -0800 (PST) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, Shivasharan S Subject: [PATCH 07/14] megaraid_sas: Avoid firing DCMDs while OCR is in progress Date: Fri, 5 Jan 2018 05:27:42 -0800 Message-Id: <1515158869-26693-8-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver needs to avoid PCI writes while OCR is in progress. Use reset_mutex to synchronize between firing DCMDs MR_DCMD_PD_GET_INFO and MR_DCMD_DRV_GET_TARGET_PROP while OCR is triggered. Without this fix, if Device/VD add/creation is in progress and at the same time MR Firmware is going through OCR, user may see OCR never completed and it may need system reboot. This scenario is rare to occur. Fix is provided as part of review. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 1 - drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index f5a36ccb8606..0a66935ddf33 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2188,7 +2188,6 @@ struct megasas_instance { struct megasas_evt_detail *evt_detail; dma_addr_t evt_detail_h; struct megasas_cmd *aen_cmd; - struct mutex hba_mutex; struct semaphore ioctl_sem; struct Scsi_Host *host; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 8a0776d6c6fa..5ab343d386f9 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1952,7 +1952,7 @@ static int megasas_slave_configure(struct scsi_device *sdev) } } - mutex_lock(&instance->hba_mutex); + mutex_lock(&instance->reset_mutex); /* Send DCMD to Firmware and cache the information */ if ((instance->pd_info) && !MEGASAS_IS_LOGICAL(sdev)) megasas_get_pd_info(instance, sdev); @@ -1966,7 +1966,7 @@ static int megasas_slave_configure(struct scsi_device *sdev) is_target_prop = (ret_target_prop == DCMD_SUCCESS) ? true : false; megasas_set_static_target_properties(sdev, is_target_prop); - mutex_unlock(&instance->hba_mutex); + mutex_unlock(&instance->reset_mutex); /* This sdev property may change post OCR */ megasas_set_dynamic_target_properties(sdev); @@ -6350,7 +6350,6 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) spin_lock_init(&instance->stream_lock); spin_lock_init(&instance->completion_lock); - mutex_init(&instance->hba_mutex); mutex_init(&instance->reset_mutex); if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||