From patchwork Tue May 7 17:05:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 098FE933 for ; Tue, 7 May 2019 17:06:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E767428876 for ; Tue, 7 May 2019 17:06:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D984B28879; Tue, 7 May 2019 17:06:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 8CC9628876 for ; Tue, 7 May 2019 17:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727146AbfEGRGO (ORCPT ); Tue, 7 May 2019 13:06:14 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38650 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGO (ORCPT ); Tue, 7 May 2019 13:06:14 -0400 Received: by mail-pl1-f193.google.com with SMTP id a59so8482075pla.5 for ; Tue, 07 May 2019 10:06:13 -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=1l5cQcHT4dT5TKu+rRmWN9++CuA6N+bsfsSSqBnqWYs=; b=MHsu7eXM5jPjUun55VTtEv0evMbsRVcpc157OizaP7mk+ZsNxtZZpzOJqLb+iKUGO/ 6K40Q/48liJe7idYKcPfutdTaLHP/DwSe2Ax2/T8A30OB/3SaUrSTAw6qDu6V9GXK4zU CURpNvbz2/SciyhCH5xyTKhaOCi6fpy0MBOqw= 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=1l5cQcHT4dT5TKu+rRmWN9++CuA6N+bsfsSSqBnqWYs=; b=eL3ulLYj1/W1oO2N/c+pkrYWxmxEykLhTa7u4f6bp6Uxrnofva1gPVSh1nYxQ+j0Ir Fkg7Bpl5zqThyjgmSQQZP+i4nuka8lcDWC8GXIe8w5uyZldQc6nfxidJPq95k2CXWJq4 fTDcMq0whJS+6ju2N4amgn7e45S+dyEoWqeADFwp26Abo9OTlwejFbJir6FGFPgi3n27 AQiB4ELjOMd6OmD4awPzVQxANS2WvHr8Kv5FPTuzx6/K04Jr1Jwo4f90ZD+MRrzU6X4w kwtXq6Gqx7RhzWB6VRWj6IBHcQ4BJJkNyxAis+coMM189JqENGc1JKykQ4jBEvRuR7HV cNNQ== X-Gm-Message-State: APjAAAWG/zMsZ1KcWnj4UNcuRcqj+cVcE1Vss+JRRj932ppk0LnCNgFq 0doKorKnUtIo7Pcx6pI/11nHvnQhYGyXVIwhFDeIIbPN9OjWNdMr9Fun4M5KhW0Kp9RhxLVkV2H NA8WgCxv3lvGh1+zLPXjvlC67W8yFoei99eBF3UH3aaoBE18dYNIfCIgWZfOdrY/0EdyW5igmvt isCb3lEIp21/Hhi485XAvT X-Google-Smtp-Source: APXvYqwybA95Td+rt8vrwFi0kKHK6lxnJLLb/9Crt51Quw8v1S1j6HnRUltSCH9vt3RjocZQy63cmw== X-Received: by 2002:a17:902:d917:: with SMTP id c23mr39357997plz.14.1557248772385; Tue, 07 May 2019 10:06:12 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:11 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 01/21] megaraid_sas: remove unused variable target_index Date: Tue, 7 May 2019 10:05:30 -0700 Message-Id: <1557248750-4099-2-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 No functional change. Remove set but unused variable in megasas_set_static_target_properties. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index bbe6972f3477..f677a84f6bc8 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1931,7 +1931,6 @@ megasas_set_nvme_device_properties(struct scsi_device *sdev, u32 max_io_size) static void megasas_set_static_target_properties(struct scsi_device *sdev, bool is_target_prop) { - u16 target_index = 0; u8 interface_type; u32 device_qd = MEGASAS_DEFAULT_CMD_PER_LUN; u32 max_io_size_kb = MR_DEFAULT_NVME_MDTS_KB; @@ -1948,8 +1947,6 @@ static void megasas_set_static_target_properties(struct scsi_device *sdev, */ blk_queue_rq_timeout(sdev->request_queue, scmd_timeout * HZ); - target_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id; - switch (interface_type) { case SAS_PD: device_qd = MEGASAS_SAS_QD; From patchwork Tue May 7 17:05:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E6E4933 for ; Tue, 7 May 2019 17:06:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8652328876 for ; Tue, 7 May 2019 17:06:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AAFD28879; Tue, 7 May 2019 17:06:21 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 25E1828876 for ; Tue, 7 May 2019 17:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727192AbfEGRGU (ORCPT ); Tue, 7 May 2019 13:06:20 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41122 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGU (ORCPT ); Tue, 7 May 2019 13:06:20 -0400 Received: by mail-pf1-f194.google.com with SMTP id l132so4017717pfc.8 for ; Tue, 07 May 2019 10:06:20 -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=b8LcUew8y2c2qcOdIdJueDfN1EbZQu2fqTFNgaHgjzU=; b=G1PAIRrM3KcZOhSVQcedKOn05jhjYULKBUoYvtnVwIeAQ2GgPwm3jdw7INdRbDZ8MC GrX4Se/YMJ/8+p8uHBgWVpS1ZeFIlyGSDxgLH1F3fPYLFaTWdbvzh95WOViI3IIRdKLw U94x7rTTW44WgWIUaYhuRlO+d9PBSz75dpU24= 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=b8LcUew8y2c2qcOdIdJueDfN1EbZQu2fqTFNgaHgjzU=; b=AuNtzo0PK1cbgKu90aksQo9H99nWOrd2iMXu+yfKxKd6d9ETCMDzF8t1WzBIodvJlp 0VUxZvKOuI4aQ7nQS9YNAyooKDGZ/Q6JAKceE8jyRbqo3o7tDOHzJdJxcxRs/fyD+pEK c1Ut2n7of/4S5+z6SrSz/Wo2c/Qg29pmyuzZct48uDMxUxEPsB6fu2zrC/54VFfR6Ce0 pyL/5XEXaaUi+KZdLIMkSY3gabMpq6UsCKUIPYbmzGh2H1AePONmyp0XDkO8LgZKfVsu j7gA51ZFuIsy77izLPkziO3c+ejVk1zq+qI/LByyvwlkVh4MWG5bmro/5FwpltC7Q5JB hbSg== X-Gm-Message-State: APjAAAXPyAmtxWBvs+++7HIb4Adq3PU/UOPNHbhYstcGDCa8RJ/hqFzz Z7KWvl4RpedPL4+9aAmabl0s7y7KguTfTIHO/3nTGIEunjg0UQwOa0A8cTIK5EmrGC0uRs0FV5o c4z0M+LiaUOhbi3Tg80xtu333ls9sWcEiTny4e/L0ldetDz5Zp8eyDYcDxUNVqYQkOMkMb67Gwa PhPO2xoX77QX/53nVSpn4s X-Google-Smtp-Source: APXvYqwxF19A9qrp22LN+ibwSpxgfXiEC3WtpVzs20sU81vHdCR/8kC4xFIoY3xoLTC9giWZ4UmdNw== X-Received: by 2002:a65:4649:: with SMTP id k9mr17341404pgr.239.1557248779515; Tue, 07 May 2019 10:06:19 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:18 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 03/21] megaraid_sas: fw_reset_no_pci_access required for MFI adapters only Date: Tue, 7 May 2019 10:05:32 -0700 Message-Id: <1557248750-4099-4-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 fw_reset_no_pci_access is only applicable for MFI controllers and is not used for Fusion controllers. For all Fusion controllers, driver can check reset adapter bit in status register before performing a chip reset, without setting "fw_reset_no_pci_access". Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index d2714fc833ae..77db6e773a01 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5489,7 +5489,6 @@ static int megasas_init_fw(struct megasas_instance *instance) int i, j, loop, fw_msix_count = 0; struct IOV_111 *iovPtr; struct fusion_context *fusion; - bool do_adp_reset = true; fusion = instance->ctrl_context; @@ -5536,13 +5535,18 @@ static int megasas_init_fw(struct megasas_instance *instance) } if (megasas_transition_to_ready(instance, 0)) { - if (instance->adapter_type >= INVADER_SERIES) { + if (instance->adapter_type != MFI_SERIES) { status_reg = instance->instancet->read_fw_status_reg( instance); - do_adp_reset = status_reg & MFI_RESET_ADAPTER; - } - - if (do_adp_reset) { + if (status_reg & MFI_RESET_ADAPTER) { + instance->instancet->adp_reset + (instance, instance->reg_set); + if (megasas_transition_to_ready(instance, 0)) + goto fail_ready_state; + } else { + goto fail_ready_state; + } + } else { atomic_set(&instance->fw_reset_no_pci_access, 1); instance->instancet->adp_reset (instance, instance->reg_set); @@ -5556,8 +5560,6 @@ static int megasas_init_fw(struct megasas_instance *instance) if (megasas_transition_to_ready(instance, 0)) goto fail_ready_state; - } else { - goto fail_ready_state; } } From patchwork Tue May 7 17:05:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F8DB1398 for ; Tue, 7 May 2019 17:06:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17FE728876 for ; Tue, 7 May 2019 17:06:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ACAA28879; Tue, 7 May 2019 17:06:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 956F628876 for ; Tue, 7 May 2019 17:06:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727207AbfEGRGY (ORCPT ); Tue, 7 May 2019 13:06:24 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44270 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGY (ORCPT ); Tue, 7 May 2019 13:06:24 -0400 Received: by mail-pl1-f194.google.com with SMTP id d3so4465217plj.11 for ; Tue, 07 May 2019 10:06:23 -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=nZmw5ywIbzOc8VruWmb764fG6flSNtrbuGspqfBaQaI=; b=J1qcqjZPbPBnHndft+52+YMdtr+C+61qR+qA4HjPd6tQ36giiQjV9q/kd8ni58Ggt1 Zsmv/ty4GsQJZ8f85C01qVbWKHL7KBGJ28CoNEIv/8s4f7ebrEwHMWKpIiZVnSkldlyw Yr3ROqSGYPR0PwqiJnznoTb2WLd1mFMyn6lq4= 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=nZmw5ywIbzOc8VruWmb764fG6flSNtrbuGspqfBaQaI=; b=XA4HWW60jMSdZGUF2tJDbk00ObRKS997dEfDTzZNSDnGePl0CSFpLzhKcS9Mv+M/2n WyZFcNxJ9VMqlurpZGRfY1KGpauSvlCvCaKAf2yjnsSJxArW8N9+CXbHTXmsKcmnAxIJ CxoOLk5EjqOnulryb4qcb2Xe+cMZ/cikNLcotku6+cfuy0nlA+jT91CXubQXGmJyx+Lk Cjk7rJJ3HLdFCg8TgkF9VwhDVelIqWo/gVx9N+jPjGXG6osnQwOASGut7x8lPqDvuoyp lBxMtGvQ/Af8KHq4sZDilgGVZIH1URTMIy7+NfGemSnTHXE2TPyVqNtzpXA5s54Hft3R be0w== X-Gm-Message-State: APjAAAWlWkGUOvfbeOkcSCTJez4BV3gIbmiGzlC97iuM+mYJXZVmuLIB 5C+mu60LDLWVG6gHe4lEfS22XOg+tItKG+E9b6ChP8SWpMQqDL/asjXo0r6sYh3ZTgj6fmOvgmk z1i31q3aGIs3p7c2/juZiSNbW6TL/XIx0Fa9xdlLiFuNjvsyL94olyPRjAdZBAxa38dSmq5poo0 2D/zvOSVklZqf8cUYj+TDu X-Google-Smtp-Source: APXvYqyq5qJyyyGpxuBM1JAn8aPwKVW+OOBVdINn4gK6cAj7upAcLV5ncaH/vcflgr8iZysOzF5OZQ== X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr42282448plb.202.1557248782969; Tue, 07 May 2019 10:06:22 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:22 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 04/21] megaraid_sas: rework code around controller reset Date: Tue, 7 May 2019 10:05:33 -0700 Message-Id: <1557248750-4099-5-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 No functional change. This patch reworks code around controller reset path which gets rid of a couple of goto labels. This is in preparation for the next patch which adds PCI config space access locking while controller reset is in progress. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 6fd57f7f0b1e..902b11b97999 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1571,6 +1571,7 @@ enum FW_BOOT_CONTEXT { #define MFI_IO_TIMEOUT_SECS 180 #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) +#define MEGASAS_SRIOV_MAX_RESET_TRIES_VF 1 #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index bf1fa963af0b..76bd29c92752 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -4568,6 +4568,8 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) struct scsi_device *sdev; int ret_target_prop = DCMD_FAILED; bool is_target_prop = false; + bool do_adp_reset = true; + int max_reset_tries = MEGASAS_FUSION_MAX_RESET_TRIES; instance = (struct megasas_instance *)shost->hostdata; fusion = instance->ctrl_context; @@ -4686,34 +4688,30 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Let SR-IOV VF & PF sync up if there was a HB failure */ if (instance->requestorId && !reason) { msleep(MEGASAS_OCR_SETTLE_TIME_VF); - goto transition_to_ready; + do_adp_reset = false; + max_reset_tries = MEGASAS_SRIOV_MAX_RESET_TRIES_VF; } /* Now try to reset the chip */ - for (i = 0; i < MEGASAS_FUSION_MAX_RESET_TRIES; i++) { + for (i = 0; i < max_reset_tries; i++) { - if (instance->instancet->adp_reset + if (do_adp_reset && + instance->instancet->adp_reset (instance, instance->reg_set)) continue; -transition_to_ready: + /* Wait for FW to become ready */ if (megasas_transition_to_ready(instance, 1)) { dev_warn(&instance->pdev->dev, "Failed to transition controller to ready for " "scsi%d.\n", instance->host->host_no); - if (instance->requestorId && !reason) - goto fail_kill_adapter; - else - continue; + continue; } megasas_reset_reply_desc(instance); megasas_fusion_update_can_queue(instance, OCR_CONTEXT); if (megasas_ioc_init_fusion(instance)) { - if (instance->requestorId && !reason) - goto fail_kill_adapter; - else - continue; + continue; } if (megasas_get_ctrl_info(instance)) { @@ -4799,7 +4797,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) goto out; } -fail_kill_adapter: /* Reset failed, kill the adapter */ dev_warn(&instance->pdev->dev, "Reset failed, killing " "adapter scsi%d.\n", instance->host->host_no); From patchwork Tue May 7 17:05:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BCF4933 for ; Tue, 7 May 2019 17:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2559828876 for ; Tue, 7 May 2019 17:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1705828879; Tue, 7 May 2019 17:06:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 8FCD428876 for ; Tue, 7 May 2019 17:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727229AbfEGRG2 (ORCPT ); Tue, 7 May 2019 13:06:28 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45397 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRG2 (ORCPT ); Tue, 7 May 2019 13:06:28 -0400 Received: by mail-pg1-f196.google.com with SMTP id i21so8603518pgi.12 for ; Tue, 07 May 2019 10:06:27 -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=xidrd8LC2JRaLE5PKfyFNBrAHwqEptbcNXmQylZbJnY=; b=Lp1PzTqL6TDxT0mvI0O0+71C9hEdO5j+CHjT46wHtm9g9RMvwP6+LHIh9SuhT72jBn jQABp3ffRLxqxEaCX5MK6bjBBdJSXxdQeNQ3XkI3G0PjstBWYz7J7/iqORMJ/+zN0SvD jn9z8O5MumjXrMVulpLl32aYyd4wzVoLpU3Pk= 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=xidrd8LC2JRaLE5PKfyFNBrAHwqEptbcNXmQylZbJnY=; b=qqR7t6xnEpzGmBkReqZIkYavEQK2+/2xa6Dv6OG/t6fRc5EpU3qLobFqTG+QXUrsUW zrNDjpiAGd/6LsfzKix1/XVCrcLaJgsdLzNLugxM6yDdzQ7vM2itFuISVEUA4En9CKY2 e0Xkm+1h+CR6nsL7EVR8KncW777KVxrBC1qcrA/jUdB6nITCwcvkb/sBflD7aHy9KOvl Q8nSMYv16elD7zAkDfJAVDJf6FFC1qtheiyL0gzY/MHvyx/ca5OIvYG+fiOuiE3YNUUi hN8SLUniLiG51d4lTvZY6OD1x4iFOalTM+wZiGo4N21Z0kBVaon4Sa50eowq2ANgDlmV DplQ== X-Gm-Message-State: APjAAAW8/d6tsgs2DGcvazhsgcZBlwLnDnrjx8m7NfexgEnvMLO7oEy5 ZkTPEBDtFZ1X73Dj8azYlDIaTZbjSh+KPPLSOKCQIL9GRv6k8gnLGN9XXUTzNL5wzm0phWJvkap n+WxYJnPJxrKNSfPyxVkApXNxqgEItDL1y6YZmrzWR+6bRno+LokvdDhC67zhWkGH5UFYKyrycR vYsfBKfvV2NOVJsOBS5X6O X-Google-Smtp-Source: APXvYqzaEVufZ5heq9OOfxa3s87CwNs1JX+M9uZfMzLf3p+K0NF2VDL1qoQDz41GBoVw9C6WxJZD8A== X-Received: by 2002:a65:64d3:: with SMTP id t19mr41287826pgv.57.1557248786816; Tue, 07 May 2019 10:06:26 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:25 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 05/21] megaraid_sas: Block PCI config space access from userspace during OCR Date: Tue, 7 May 2019 10:05:34 -0700 Message-Id: <1557248750-4099-6-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 While an online controller reset(OCR) is in progress, there is short duration where all access to controller's PCI config space from the host needs to be blocked. This is due to a hardware limitation of MegaRAID controllers. With this patch, driver will block all access to controller's config space from userland applications by calling pci_cfg_access_lock() while OCR is in progress and unlocking after controller comes back to ready state. Added helper function which locks the config space before initiating OCR and wait for controller to become READY. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 3 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 15 ++++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 66 +++++++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 902b11b97999..990ee23d7bc2 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2636,4 +2636,7 @@ void megasas_fusion_stop_watchdog(struct megasas_instance *instance); void megasas_set_dma_settings(struct megasas_instance *instance, struct megasas_dcmd_frame *dcmd, dma_addr_t dma_addr, u32 dma_len); +int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, + bool do_adp_reset, + int ocr_context); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 77db6e773a01..5e5170b40f6f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5535,13 +5535,15 @@ static int megasas_init_fw(struct megasas_instance *instance) } if (megasas_transition_to_ready(instance, 0)) { + dev_info(&instance->pdev->dev, + "Failed to transition controller to ready from %s!\n", + __func__); if (instance->adapter_type != MFI_SERIES) { status_reg = instance->instancet->read_fw_status_reg( instance); if (status_reg & MFI_RESET_ADAPTER) { - instance->instancet->adp_reset - (instance, instance->reg_set); - if (megasas_transition_to_ready(instance, 0)) + if (megasas_adp_reset_wait_for_ready + (instance, true, 0) == FAILED) goto fail_ready_state; } else { goto fail_ready_state; @@ -5551,9 +5553,6 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->instancet->adp_reset (instance, instance->reg_set); atomic_set(&instance->fw_reset_no_pci_access, 0); - dev_info(&instance->pdev->dev, - "FW restarted successfully from %s!\n", - __func__); /*waiting for about 30 second before retry*/ ssleep(30); @@ -5561,6 +5560,10 @@ static int megasas_init_fw(struct megasas_instance *instance) if (megasas_transition_to_ready(instance, 0)) goto fail_ready_state; } + + dev_info(&instance->pdev->dev, + "FW restarted successfully from %s!\n", + __func__); } megasas_init_ctrl_params(instance); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 76bd29c92752..59bab98274f6 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -98,6 +98,62 @@ static void megasas_fusion_crash_dump(struct megasas_instance *instance); extern u32 megasas_readl(struct megasas_instance *instance, const volatile void __iomem *addr); +/** + * megasas_adp_reset_wait_for_ready - initiate chip reset and wait for + * controller to come to ready state + * @instance - adapter's soft state + * @do_adp_reset - If true, do a chip reset + * @ocr_context - If called from OCR context this will + * be set to 1, else 0 + * + * This functon initates a chip reset followed by a wait for controller to + * transition to ready state. + * During this, driver will block all access to PCI config space from userspace + */ +int +megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, + bool do_adp_reset, + int ocr_context) +{ + int ret = FAILED; + + /* + * Block access to PCI config space from userspace + * when diag reset is initiated from driver + */ + if (megasas_dbg_lvl & OCR_LOGS) + dev_info(&instance->pdev->dev, + "Block access to PCI config space %s %d\n", + __func__, __LINE__); + + pci_cfg_access_lock(instance->pdev); + + if (do_adp_reset) { + if (instance->instancet->adp_reset + (instance, instance->reg_set)) + goto out; + } + + /* Wait for FW to become ready */ + if (megasas_transition_to_ready(instance, ocr_context)) { + dev_warn(&instance->pdev->dev, + "Failed to transition controller to ready for scsi%d.\n", + instance->host->host_no); + goto out; + } + + ret = SUCCESS; +out: + if (megasas_dbg_lvl & OCR_LOGS) + dev_info(&instance->pdev->dev, + "Unlock access to PCI config space %s %d\n", + __func__, __LINE__); + + pci_cfg_access_unlock(instance->pdev); + + return ret; +} + /** * megasas_check_same_4gb_region - check if allocation * crosses same 4GB boundary or not @@ -4694,10 +4750,12 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Now try to reset the chip */ for (i = 0; i < max_reset_tries; i++) { - - if (do_adp_reset && - instance->instancet->adp_reset - (instance, instance->reg_set)) + /* + * Do adp reset and wait for + * controller to transition to ready + */ + if (megasas_adp_reset_wait_for_ready(instance, + do_adp_reset, 1) == FAILED) continue; /* Wait for FW to become ready */ From patchwork Tue May 7 17:05:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AA93933 for ; Tue, 7 May 2019 17:06:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10DFA28876 for ; Tue, 7 May 2019 17:06:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04B7D28879; Tue, 7 May 2019 17:06:34 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 C31C228876 for ; Tue, 7 May 2019 17:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbfEGRGc (ORCPT ); Tue, 7 May 2019 13:06:32 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41921 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGc (ORCPT ); Tue, 7 May 2019 13:06:32 -0400 Received: by mail-pg1-f196.google.com with SMTP id z3so4909746pgp.8 for ; Tue, 07 May 2019 10:06:31 -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=jEUYs8mQo5FFKhRrErQjGPLFPPXA93Wv710nOJGG2/E=; b=B45ge17rhpxjr/7ywo94s8c7dkOpHcDjrh2P+qlL5oHz/wR2VpmSr5rVRHsp5PWlyU Zqmrmu4vxmVP9q8Q9UsFLsS0SQWBrPB0EmevmmESXhqc1jAyQLv0EtIVVa309bjBGFiM pK6dSphhlEB/bKis68PrUxaRVWvgLQuxlkPGI= 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=jEUYs8mQo5FFKhRrErQjGPLFPPXA93Wv710nOJGG2/E=; b=LCeBILhuEPzc9rHi6swZ6i/Ivqp/Ix52bU9wx7NHm3p6GpBDqGUjXSXRSXJMyf6M3K J+0MXOAE4KA+kwWMTn+2Co4x+wDgzDBP+OKA9tFWbGAUFO0Jk44Jgm14ykcL1aPKxBFP U9fLz58gBeWVW+0OCu3DEqephs5aN7iC29tXxup6+1fm6tHUj5pwoOi+iB63xZyaX4lJ tV9fiaLwS2J2REq1ufjoGgvm5jBFkxV4SNP9P27ItqlCiYb7Tgf9iRWw5j/ZVaRvKx/v DSecsBuZW8O4U1ATuJuOXJxD3c2tuD3Xdaxtazs7Rn0wxTLoMQsw/32XORR9N6xc66hk Bj1Q== X-Gm-Message-State: APjAAAVfzkMuhcCtV6sWPQgprZCFh9YO787/N7cK5ljk7PY1ANsfd1ln cz38lYyEjMy22KJnpmcH3GuB6AgaQ4fHtb9brjHI7JU0yajGY9Q/uVcBgKiiKyj8VGab/mzl86h rVGPs2nsIp6x6FIaAwLHQ6XgdINxMY9pk5SbocdkKvTqUsxDhqJVr+f1OEHrBgoMR0Cn2jzgQ6c dRVVHrOqZAOMx174HNgewZ X-Google-Smtp-Source: APXvYqxB+QimV9oYpU69xKoWP5pkqLIc+wUDoG1lkqzYbQfQonG8Hx8xbafyvZHVFFO+CvmnReN51w== X-Received: by 2002:a63:e417:: with SMTP id a23mr25903100pgi.224.1557248790306; Tue, 07 May 2019 10:06:30 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:29 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 06/21] megaraid_sas: IRQ poll to avoid CPU hard lockups Date: Tue, 7 May 2019 10:05:35 -0700 Message-Id: <1557248750-4099-7-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Issue Description: We have seen cpu lock up issues from field if system has greater (more than 96) logical cpu count. SAS3.0 controller (Invader series) supports at max 96 msix vector and SAS3.5 product (Ventura) supports at max 128 msix vectors. This may be a generic issue (if PCI device support completion on multiple reply queues). Let me explain it w.r.t megaraid_sas supported h/w just to simplify the problem and possible changes to handle such issues. MegaRAID controller supports multiple reply queues in completion path. Driver creates MSI-x vectors for controller as "minimum of (FW supported Reply queues, Logical CPUs)". If submitter is not interrupted via completion on same CPU, there is a loop in the IO path. This behavior can cause hard/soft CPU lockups, IO timeout, system sluggish etc. Example - one CPU (e.g. CPU A) is busy submitting the IOs and another CPU (e.g. CPU B) is busy with processing the corresponding IO's reply descriptors from reply descriptor queue upon receiving the interrupts from HBA. If CPU A is continuously pumping the IOs then always CPU B (which is executing the ISR) will see the valid reply descriptors in the reply descriptor queue and it will be continuously processing those reply descriptor in a loop without quitting the ISR handler. megaraid_sas driver will exit ISR handler if it finds unused reply descriptor in the reply descriptor queue. Since CPU A will be continuously sending the IOs, CPU B may always see a valid reply descriptor (posted by HBA Firmware after processing the IO) in the reply descriptor queue. In worst case, driver will not quit from this loop in the ISR handler. Eventually, CPU lockup will be detected by watchdog. Above mentioned behavior is not common if "rq_affinity" set to 2 or affinity_hint is honored by irqbalancer as "exact". If rq_affinity is set to 2, submitter will be always interrupted via completion on same CPU. If irqbalancer is using "exact" policy, interrupt will be delivered to submitter CPU. Problem statement - If CPU count to MSI-X vectors (reply descriptor Queues) count ratio is not 1:1, we still have exposure of issue explained above and for that we don't have any solution. Exposure of soft/hard lockup is seen if CPU count is more than MSI-x supported by device. If CPUs count to MSI-x vectors count ratio is not 1:1, (Other way, if CPU counts to MSI-x vector count ratio is something like X:1, where X > 1) then 'exact' irqbalance policy OR rq_affinity = 2 won't help to avoid CPU hard/soft lockups. There won't be any one to one mapping between CPU to MSI-x vector instead one MSI-x interrupt (or reply descriptor queue) is shared with group/set of CPUs and there is a possibility of having a loop in the IO path within that CPU group and may observe lockups. For example: Consider a system having two NUMA nodes and each node having four logical CPUs and also consider that number of MSI-x vectors enabled on the HBA is two, then CPUs count to MSI-x vector count ratio as 4:1. e.g. MSIx vector 0 is affinity to CPU 0, CPU 1, CPU 2 & CPU 3 of NUMA node 0 and MSIx vector 1 is affinity to CPU 4, CPU 5, CPU 6 & CPU 7 of NUMA node 1. numactl --hardware available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 --> MSI-x 0 node 0 size: 65536 MB node 0 free: 63176 MB node 1 cpus: 4 5 6 7 --> MSI-x 1 node 1 size: 65536 MB node 1 free: 63176 MB Assume that user started an application which uses all the CPUs of NUMA node 0 for issuing the IOs. Only one CPU from affinity list (it can be any cpu since this behavior depends upon irqbalance) CPU0 will receive the interrupts from MSIx 0 for all the IOs. Eventually, CPU 0 IO submission percentage will be decreasing and ISR processing percentage will be increasing as it is more busy with processing the interrupts. Gradually IO submission percentage on CPU 0 will be zero and it's ISR processing percentage will be 100 percentage as IO loop has already formed within the NUMA node 0, i.e. CPU 1, CPU 2 & CPU 3 will be continuously busy with submitting the heavy IOs and only CPU 0 is busy in the ISR path as it always find the valid reply descriptor in the reply descriptor queue. Eventually, we will observe the hard lockup here. Chances of occurring of hard/soft lockups are directly proportional to value of X. If value of X is high, then chances of observing CPU lockups is high. Solution - Fix - Use IRQ poll interface defined in "irq_poll.c". megaraid_sas driver will execute ISR routine in Softirq context and it will always quit the loop based on budget provided in IRQ poll interface. Driver will switch to IRQ poll only when more than a threshold number of reply descriptors are handled in one ISR. Currently threshold is set as 1/4th of HBA queue depth. In these scenarios (i.e. where CPUs count to MSI-X vectors count ratio is X:1 (where X > 1)), IRQ poll interface will avoid CPU hard lockups due to voluntary exit from the reply queue processing based on budget. Note - Only one MSI-x vector is busy doing processing. Select CONFIG_IRQ_POLL from driver Kconfig for driver compilation. Signed-off-by: Kashyap Desai Signed-off-by: Shivasharan S --- Changes in v2: Make megasas_enable_irq_poll static as reported by kbuild test robot drivers/scsi/megaraid/Kconfig.megaraid | 1 + drivers/scsi/megaraid/megaraid_sas.h | 5 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 36 ++++++++ drivers/scsi/megaraid/megaraid_sas_fp.c | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 122 +++++++++++++++++++++------- drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 - 6 files changed, 136 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/megaraid/Kconfig.megaraid b/drivers/scsi/megaraid/Kconfig.megaraid index 17419e30ffc8..1fa9d095ae36 100644 --- a/drivers/scsi/megaraid/Kconfig.megaraid +++ b/drivers/scsi/megaraid/Kconfig.megaraid @@ -78,6 +78,7 @@ config MEGARAID_LEGACY config MEGARAID_SAS tristate "LSI Logic MegaRAID SAS RAID Module" depends on PCI && SCSI + select IRQ_POLL help Module for LSI Logic's SAS based RAID controllers. To compile this driver as a module, choose 'm' here. diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 990ee23d7bc2..8d6a9c511455 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2173,6 +2173,9 @@ struct megasas_aen_event { struct megasas_irq_context { struct megasas_instance *instance; u32 MSIxIndex; + u32 os_irq; + struct irq_poll irqpoll; + bool irq_poll_scheduled; }; struct MR_DRV_SYSTEM_INFO { @@ -2303,6 +2306,7 @@ struct megasas_instance { struct pci_dev *pdev; u32 unique_id; u32 fw_support_ieee; + u32 threshold_reply_count; atomic_t fw_outstanding; atomic_t ldio_outstanding; @@ -2639,4 +2643,5 @@ void megasas_set_dma_settings(struct megasas_instance *instance, int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, bool do_adp_reset, int ocr_context); +int megasas_irqpoll(struct irq_poll *irqpoll, int budget); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5e5170b40f6f..f7ffa72e9572 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -5272,6 +5273,25 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) return 1; } +static +void megasas_setup_irq_poll(struct megasas_instance *instance) +{ + struct megasas_irq_context *irq_ctx; + u32 count, i; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; + + /* Initialize IRQ poll */ + for (i = 0; i < count; i++) { + irq_ctx = &instance->irq_context[i]; + irq_ctx->os_irq = pci_irq_vector(instance->pdev, i); + irq_ctx->irq_poll_scheduled = false; + irq_poll_init(&irq_ctx->irqpoll, + instance->threshold_reply_count, + megasas_irqpoll); + } +} + /* * megasas_setup_irqs_ioapic - register legacy interrupts. * @instance: Adapter soft state @@ -5350,6 +5370,16 @@ static void megasas_destroy_irqs(struct megasas_instance *instance) { int i; + int count; + struct megasas_irq_context *irq_ctx; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; + if (instance->adapter_type != MFI_SERIES) { + for (i = 0; i < count; i++) { + irq_ctx = &instance->irq_context[i]; + irq_poll_disable(&irq_ctx->irqpoll); + } + } if (instance->msix_vectors) for (i = 0; i < instance->msix_vectors; i++) { @@ -5722,6 +5752,9 @@ static int megasas_init_fw(struct megasas_instance *instance) megasas_setup_irqs_ioapic(instance)) goto fail_init_adapter; + if (instance->adapter_type != MFI_SERIES) + megasas_setup_irq_poll(instance); + instance->instancet->enable_intr(instance); dev_info(&instance->pdev->dev, "INIT adapter done\n"); @@ -7187,6 +7220,9 @@ megasas_resume(struct pci_dev *pdev) megasas_setup_irqs_ioapic(instance)) goto fail_init_mfi; + if (instance->adapter_type != MFI_SERIES) + megasas_setup_irq_poll(instance); + /* Re-launch SR-IOV heartbeat timer */ if (instance->requestorId) { if (!megasas_sriov_start_heartbeat(instance, 0)) diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index 87c2c0472c8f..9ac357619b28 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 59bab98274f6..51ee6439ebbd 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -1789,6 +1790,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) instance->flag_ieee = 1; instance->r1_ldio_hint_default = MR_R1_LDIO_PIGGYBACK_DEFAULT; + instance->threshold_reply_count = instance->max_fw_cmds / 4; fusion->fast_path_io = 0; if (megasas_allocate_raid_maps(instance)) @@ -3422,7 +3424,8 @@ megasas_complete_r1_command(struct megasas_instance *instance, * Completes all commands that is in reply descriptor queue */ int -complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) +complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex, + struct megasas_irq_context *irq_context) { union MPI2_REPLY_DESCRIPTORS_UNION *desc; struct MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *reply_desc; @@ -3555,7 +3558,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) * number of reply counts and still there are more replies in reply queue * pending to be completed */ - if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { + if (threshold_reply_count >= instance->threshold_reply_count) { if (instance->msix_combined) writel(((MSIxIndex & 0x7) << 24) | fusion->last_reply_idx[MSIxIndex], @@ -3565,23 +3568,46 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) fusion->last_reply_idx[MSIxIndex], instance->reply_post_host_index_addr[0]); threshold_reply_count = 0; + if (irq_context) { + if (!irq_context->irq_poll_scheduled) { + irq_context->irq_poll_scheduled = true; + disable_irq_nosync(irq_context->os_irq); + irq_poll_sched(&irq_context->irqpoll); + } + return num_completed; + } } } - if (!num_completed) - return IRQ_NONE; + if (num_completed) { + wmb(); + if (instance->msix_combined) + writel(((MSIxIndex & 0x7) << 24) | + fusion->last_reply_idx[MSIxIndex], + instance->reply_post_host_index_addr[MSIxIndex/8]); + else + writel((MSIxIndex << 24) | + fusion->last_reply_idx[MSIxIndex], + instance->reply_post_host_index_addr[0]); + megasas_check_and_restore_queue_depth(instance); + } + return num_completed; +} - wmb(); - if (instance->msix_combined) - writel(((MSIxIndex & 0x7) << 24) | - fusion->last_reply_idx[MSIxIndex], - instance->reply_post_host_index_addr[MSIxIndex/8]); - else - writel((MSIxIndex << 24) | - fusion->last_reply_idx[MSIxIndex], - instance->reply_post_host_index_addr[0]); - megasas_check_and_restore_queue_depth(instance); - return IRQ_HANDLED; +/** + * megasas_enable_irq_poll() - enable irqpoll + */ +static void megasas_enable_irq_poll(struct megasas_instance *instance) +{ + u32 count, i; + struct megasas_irq_context *irq_ctx; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; + + for (i = 0; i < count; i++) { + irq_ctx = &instance->irq_context[i]; + irq_poll_enable(&irq_ctx->irqpoll); + } } /** @@ -3593,11 +3619,46 @@ void megasas_sync_irqs(unsigned long instance_addr) u32 count, i; struct megasas_instance *instance = (struct megasas_instance *)instance_addr; + struct megasas_irq_context *irq_ctx; count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) { synchronize_irq(pci_irq_vector(instance->pdev, i)); + irq_ctx = &instance->irq_context[i]; + irq_poll_disable(&irq_ctx->irqpoll); + if (irq_ctx->irq_poll_scheduled) { + irq_ctx->irq_poll_scheduled = false; + enable_irq(irq_ctx->os_irq); + } + } +} + +/** + * megasas_irqpoll() - process a queue for completed reply descriptors + * @irqpoll: IRQ poll structure associated with queue to poll. + * @budget: Threshold of reply descriptors to process per poll. + * + * Return: The number of entries processed. + */ + +int megasas_irqpoll(struct irq_poll *irqpoll, int budget) +{ + struct megasas_irq_context *irq_ctx; + struct megasas_instance *instance; + int num_entries; + + irq_ctx = container_of(irqpoll, struct megasas_irq_context, irqpoll); + instance = irq_ctx->instance; + + num_entries = complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx); + if (num_entries < budget) { + irq_poll_complete(irqpoll); + irq_ctx->irq_poll_scheduled = false; + enable_irq(irq_ctx->os_irq); + } + + return num_entries; } /** @@ -3620,7 +3681,7 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr) return; for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) - complete_cmd_fusion(instance, MSIxIndex); + complete_cmd_fusion(instance, MSIxIndex, NULL); } /** @@ -3647,7 +3708,8 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp) return IRQ_HANDLED; } - return complete_cmd_fusion(instance, irq_context->MSIxIndex); + return complete_cmd_fusion(instance, irq_context->MSIxIndex, irq_context) + ? IRQ_HANDLED : IRQ_NONE; } /** @@ -4334,6 +4396,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle, instance->instancet->disable_intr(instance); megasas_sync_irqs((unsigned long)instance); instance->instancet->enable_intr(instance); + megasas_enable_irq_poll(instance); if (scsi_lookup->scmd == NULL) break; } @@ -4347,6 +4410,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle, megasas_sync_irqs((unsigned long)instance); rc = megasas_track_scsiio(instance, id, channel); instance->instancet->enable_intr(instance); + megasas_enable_irq_poll(instance); break; case MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET: @@ -4735,10 +4799,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) dev_warn(&instance->pdev->dev, "Reset not supported" ", killing adapter scsi%d.\n", instance->host->host_no); - megaraid_sas_kill_hba(instance); - instance->skip_heartbeat_timer_del = 1; - retval = FAILED; - goto out; + goto kill_hba; } /* Let SR-IOV VF & PF sync up if there was a HB failure */ @@ -4776,9 +4837,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) dev_info(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__); - megaraid_sas_kill_hba(instance); - retval = FAILED; - goto out; + goto kill_hba; } megasas_refire_mgmt_cmd(instance); @@ -4807,7 +4866,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); instance->instancet->enable_intr(instance); - + megasas_enable_irq_poll(instance); shost_for_each_device(sdev, shost) { if ((instance->tgt_prop) && (instance->nvme_page_size)) @@ -4858,9 +4917,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Reset failed, kill the adapter */ dev_warn(&instance->pdev->dev, "Reset failed, killing " "adapter scsi%d.\n", instance->host->host_no); - megaraid_sas_kill_hba(instance); - instance->skip_heartbeat_timer_del = 1; - retval = FAILED; + goto kill_hba; } else { /* For VF: Restart HB timer if we didn't OCR */ if (instance->requestorId) { @@ -4868,8 +4925,15 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) } clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); instance->instancet->enable_intr(instance); + megasas_enable_irq_poll(instance); atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); + goto out; } +kill_hba: + megaraid_sas_kill_hba(instance); + megasas_enable_irq_poll(instance); + instance->skip_heartbeat_timer_del = 1; + retval = FAILED; out: clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); mutex_unlock(&instance->reset_mutex); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 1481bf029490..160ac16941fe 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -100,7 +100,6 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { #define MEGASAS_FP_CMD_LEN 16 #define MEGASAS_FUSION_IN_RESET 0 -#define THRESHOLD_REPLY_COUNT 50 #define RAID_1_PEER_CMDS 2 #define JBOD_MAPS_COUNT 2 #define MEGASAS_REDUCE_QD_COUNT 64 From patchwork Tue May 7 17:05:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B79E1398 for ; Tue, 7 May 2019 17:06:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4267328876 for ; Tue, 7 May 2019 17:06:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3395128879; Tue, 7 May 2019 17:06:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 8ABBA28876 for ; Tue, 7 May 2019 17:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727271AbfEGRGf (ORCPT ); Tue, 7 May 2019 13:06:35 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38706 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGf (ORCPT ); Tue, 7 May 2019 13:06:35 -0400 Received: by mail-pg1-f196.google.com with SMTP id j26so8619985pgl.5 for ; Tue, 07 May 2019 10:06:34 -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=u8gMjqTWnxht23RzyA+GGSQVrBkeigXH6VIN8FRlibA=; b=DO6M0YZbWcpF+ZE4cCjQa71hdZLkVOkzQhXBR7JcKVHbcNjb8v5zhj2+mInHKFmAdP Be9yBcBF7ku7ckQHbvwTrerqFyuglhrNuYqpbbjcDUzP66Zij54H8uXjMf2voBjRIFlA 2OpfxZ87OQZz5bikk9casEDZjqyclPOrVwYM4= 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=u8gMjqTWnxht23RzyA+GGSQVrBkeigXH6VIN8FRlibA=; b=XyLi0K37ifO+HqwkxIzUSlFywIZWaEcC+lwDN+IYu34eufgsj84GhvYRMUYfGISU+y 0tThJTxGmIGZi9ZuP8o9xEmoF8Th7SBLJ7RGIqLnXqhz9H7X4m/hAxbcQi1BQ6kV0R/3 hBtHOUfNOQ1KqJ3peyyNCIt+yznpdDdVX5utNwzPH+ZSA4W/oxWGQIYNqcnYbIoIsuuy Sk90gzZ4pyt7bgVAwW7AMkP9sx4D7cXER9+c5bHxb0RC7Nxk8WokE9lSjnyP2FT+AIHH Sl7erhqYSGffAZWD42PeFvpnR2gfh8V9Z38NLEx09G+0d/7RKlHq2XDpzV1ZneiOdlce N/rA== X-Gm-Message-State: APjAAAUbY3+rfgkI2iK9POnIqaqDTethAhrmb1upm6FUX4IFkxhPTQZ/ od9uAxpjWZaRymiklABpds/1pwST/vcvQPSZAf8HZ3udPVZAv6y8o1B9P0K0Gv8X65CZgMPpARy WIOqG8kBaiAZ+rM++JpFFyBbitsUwrFzpGLVP2B4qLkXFwD0yv3t5vWlg5jNk5vihBHulDyMllg SuVjTcIsHKEqqj/gJm4SnG X-Google-Smtp-Source: APXvYqzQRDOtH8oGzFuNvsvQbwaYXf6wjqFxW8SmErYD/+7rMHRIsroEbkbGP4CKPG/evw9kPHZkwQ== X-Received: by 2002:a63:f707:: with SMTP id x7mr40264640pgh.343.1557248793837; Tue, 07 May 2019 10:06:33 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:32 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 07/21] megaraid_sas: Load balance completions across all MSIx Date: Tue, 7 May 2019 10:05:36 -0700 Message-Id: <1557248750-4099-8-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 will use "reply descriptor post queues" in round robin fashion when the combined MSI-x mode is not enabled. With this IO completions are distributed and loadbalanced across all the available reply descriptor post queues equally. This is enabled only if combined MSI-x mode is not enabled in firmware. This improves performance and also fixes soft lockups. When load balancing is enabled, IRQ affinity from driver needs to be disabled. Signed-off-by: Kashyap Desai Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 22 ++++++++++++++++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 18 ++++++++++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 8d6a9c511455..6be748f302cf 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2262,6 +2262,7 @@ struct megasas_instance { u32 secure_jbod_support; u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */ bool use_seqnum_jbod_fp; /* Added for PD sequence */ + bool smp_affinity_enable; spinlock_t crashdump_lock; struct megasas_register_set __iomem *reg_set; @@ -2279,6 +2280,7 @@ struct megasas_instance { u16 ldio_threshold; u16 cur_can_queue; u32 max_sectors_per_req; + bool msix_load_balance; struct megasas_aen_event *ev; struct megasas_cmd **cmd_list; @@ -2316,6 +2318,7 @@ struct megasas_instance { atomic_t sge_holes_type1; atomic_t sge_holes_type2; atomic_t sge_holes_type3; + atomic64_t total_io_count; struct megasas_instance_template *instancet; struct tasklet_struct isr_tasklet; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f7ffa72e9572..102a7e40996e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5350,6 +5350,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) &instance->irq_context[j]); /* Retry irq register for IO_APIC*/ instance->msix_vectors = 0; + instance->msix_load_balance = false; if (is_probe) { pci_free_irq_vectors(instance->pdev); return megasas_setup_irqs_ioapic(instance); @@ -5358,6 +5359,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) } } } + return 0; } @@ -5661,6 +5663,12 @@ static int megasas_init_fw(struct megasas_instance *instance) if (rdpq_enable) instance->is_rdpq = (scratch_pad_1 & MR_RDPQ_MODE_OFFSET) ? 1 : 0; + + if (!instance->msix_combined) { + instance->msix_load_balance = true; + instance->smp_affinity_enable = false; + } + fw_msix_count = instance->msix_vectors; /* Save 1-15 reply post index address to local memory * Index 0 is already saved from reg offset @@ -5679,17 +5687,20 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->msix_vectors); } else /* MFI adapters */ instance->msix_vectors = 1; + /* Don't bother allocating more MSI-X vectors than cpus */ instance->msix_vectors = min(instance->msix_vectors, (unsigned int)num_online_cpus()); - if (smp_affinity_enable) + if (instance->smp_affinity_enable) irq_flags |= PCI_IRQ_AFFINITY; i = pci_alloc_irq_vectors(instance->pdev, 1, instance->msix_vectors, irq_flags); - if (i > 0) + if (i > 0) { instance->msix_vectors = i; - else + } else { instance->msix_vectors = 0; + instance->msix_load_balance = false; + } } /* * MSI-X host index 0 is common for all adapter. @@ -6797,6 +6808,7 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) INIT_LIST_HEAD(&instance->internal_reset_pending_q); atomic_set(&instance->fw_outstanding, 0); + atomic64_set(&instance->total_io_count, 0); init_waitqueue_head(&instance->int_cmd_wait_q); init_waitqueue_head(&instance->abort_cmd_wait_q); @@ -6819,6 +6831,8 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) instance->last_time = 0; instance->disableOnlineCtrlReset = 1; instance->UnevenSpanSupport = 0; + instance->smp_affinity_enable = smp_affinity_enable ? true : false; + instance->msix_load_balance = false; if (instance->adapter_type != MFI_SERIES) INIT_WORK(&instance->work_init, megasas_fusion_ocr_wq); @@ -7182,7 +7196,7 @@ megasas_resume(struct pci_dev *pdev) /* Now re-enable MSI-X */ if (instance->msix_vectors) { irq_flags = PCI_IRQ_MSIX; - if (smp_affinity_enable) + if (instance->smp_affinity_enable) irq_flags |= PCI_IRQ_AFFINITY; } rval = pci_alloc_irq_vectors(instance->pdev, 1, diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 51ee6439ebbd..ef0b15e4de2d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2769,8 +2769,13 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, fp_possible = (io_info.fpOkForIo > 0) ? true : false; } - cmd->request_desc->SCSIIO.MSIxIndex = - instance->reply_map[raw_smp_processor_id()]; + if (instance->msix_load_balance) + cmd->request_desc->SCSIIO.MSIxIndex = + (mega_mod64(atomic64_add_return(1, &instance->total_io_count), + instance->msix_vectors)); + else + cmd->request_desc->SCSIIO.MSIxIndex = + instance->reply_map[raw_smp_processor_id()]; if (instance->adapter_type >= VENTURA_SERIES) { /* FP for Optimal raid level 1. @@ -3083,8 +3088,13 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; - cmd->request_desc->SCSIIO.MSIxIndex = - instance->reply_map[raw_smp_processor_id()]; + if (instance->msix_load_balance) + cmd->request_desc->SCSIIO.MSIxIndex = + (mega_mod64(atomic64_add_return(1, &instance->total_io_count), + instance->msix_vectors)); + else + cmd->request_desc->SCSIIO.MSIxIndex = + instance->reply_map[raw_smp_processor_id()]; if (!fp_possible) { /* system pd firmware path */ From patchwork Tue May 7 17:05:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82F811398 for ; Tue, 7 May 2019 17:06:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BB3428876 for ; Tue, 7 May 2019 17:06:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FC3528879; Tue, 7 May 2019 17:06:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 8AB3628876 for ; Tue, 7 May 2019 17:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727282AbfEGRGj (ORCPT ); Tue, 7 May 2019 13:06:39 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36999 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGj (ORCPT ); Tue, 7 May 2019 13:06:39 -0400 Received: by mail-pg1-f193.google.com with SMTP id e6so8618848pgc.4 for ; Tue, 07 May 2019 10:06:38 -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=yNfF0OLHN6RAYdrSTgE7wi1GtYkO8fhy4g0HrI4qchw=; b=YUTOC9cqg18unrgkDYkr2sbsuBXWi+tV3ip47p+Ydga8f4NNQ7Q2xaJ3BGmph1IoxW XKNtXWj5IrcYXAPZXPdVUuCblYTbOGocLgsyn98VKq9w9YFrGdGxy0b1Z3lhX4TV6hsF 19O4kVX+44NMLGOaxRthSXmupo4v3rhtM+2bI= 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=yNfF0OLHN6RAYdrSTgE7wi1GtYkO8fhy4g0HrI4qchw=; b=LDWT23SOnH+7Vt8K/tne4rsNgCZOYoioCWaJrhuVkBHwK7atoZ6/Oo7/+HoFwlA9Fg f9mQgl7ssVeWoQSdQ5Qv2wOWlue0MVtUIsTni6KVksRgkvvWpCDMyhSSqPDCotdd9rWt kmwxBBLr2Q0lUF6h1orQsls4hZ30ZYZ9VowfZ8veGK762+ejGMcb3wzNSTDMSPDlgHEP JPnrDtlFo3xOp+F2FVIsGx+MPaY67nyROECALCfm+Qe7sf8qbqH4LyjDxuELZJVt49hV rhrdu6HsPVpB8X44AA/zQK8PfR0zL0JXT4YgW21pvSKuYJMrTAKZB0PhLot7j6GAQrz1 r9BQ== X-Gm-Message-State: APjAAAWJ/+dmBF6szg6tNAk+A6WNGXL9leeDDsA12jNKYWpAthLzxlM2 Xn9ViJKTGlixuTp4CP1xdagR0xX7zXGuiMLrmoqnJnh5qS8//GseZsY3suVX7U2WG9zUygtLJVh 4jlb7gkkT8V4wj7eF4OIm+jMPvO0a05U+jpPrccdsz/z0SXLsgB8k+JG/wakdVoRkmCE5sF5IQq Zs3OCZZ2pcVtp18kHrB/UG X-Google-Smtp-Source: APXvYqy36s1Al9MKC+ETSKiDqw4yeMgH6OnXl66DUoNwTvSwAk+KBzUyz9OIKe0F18/ozSAw4uVNLg== X-Received: by 2002:a65:4144:: with SMTP id x4mr41581918pgp.282.1557248797559; Tue, 07 May 2019 10:06:37 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:36 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 08/21] megaraid_sas: Enhance prints in OCR and TM path Date: Tue, 7 May 2019 10:05:37 -0700 Message-Id: <1557248750-4099-9-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 This patch enhances the existing debug prints in reset and task management path. These debug prints in adapter reset path helps with debugging issues related to IO timeouts that are seen frequently in the field. Add additional debug prints to dump the pending command frames before initiating a adapter reset. Also, print FastPath IOs that are outstanding. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 4 +- drivers/scsi/megaraid/megaraid_sas_base.c | 69 ++++++++++++++++++++++------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 44 +++++++++--------- 3 files changed, 80 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 6be748f302cf..27980d68cf1b 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1495,7 +1495,8 @@ struct megasas_ctrl_info { #define MEGASAS_FW_BUSY 1 /* Driver's internal Logging levels*/ -#define OCR_LOGS (1 << 0) +#define OCR_DEBUG (1 << 0) +#define TM_DEBUG (1 << 1) #define SCAN_PD_CHANNEL 0x1 #define SCAN_VD_CHANNEL 0x2 @@ -2647,4 +2648,5 @@ int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, bool do_adp_reset, int ocr_context); int megasas_irqpoll(struct irq_poll *irqpoll, int budget); +void megasas_dump_fusion_io(struct scsi_cmnd *scmd); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 102a7e40996e..032d91b1f3ba 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "megaraid_sas_fusion.h" #include "megaraid_sas.h" @@ -2833,23 +2834,63 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) } /** - * megasas_dump_frame - This function will dump MPT/MFI frame + * megasas_dump - This function will provide hexdump + * @ptr: Pointer starting which memory should be dumped + * @size: Size of memory to be dumped */ -static inline void -megasas_dump_frame(void *mpi_request, int sz) +inline void +megasas_dump(void *ptr, int sz) { int i; - __le32 *mfp = (__le32 *)mpi_request; + __le32 *loc = (__le32 *)ptr; - printk(KERN_INFO "IO request frame:\n\t"); for (i = 0; i < sz / sizeof(__le32); i++) { if (i && ((i % 8) == 0)) printk("\n\t"); - printk("%08x ", le32_to_cpu(mfp[i])); + printk("%08x ", le32_to_cpu(loc[i])); } printk("\n"); } +/** + * megasas_dump_fusion_io - This function will print key details + * of SCSI IO + * @scmd: SCSI command pointer of SCSI IO + */ +void +megasas_dump_fusion_io(struct scsi_cmnd *scmd) +{ + struct megasas_cmd_fusion *cmd; + union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; + struct megasas_instance *instance; + + cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; + instance = (struct megasas_instance *)scmd->device->host->hostdata; + + scmd_printk(KERN_INFO, scmd, + "scmd: (0x%p) retries: 0x%x allowed: 0x%x\n", + scmd, scmd->retries, scmd->allowed); + scsi_print_command(scmd); + + if (cmd) { + req_desc = (union MEGASAS_REQUEST_DESCRIPTOR_UNION *)cmd->request_desc; + scmd_printk(KERN_INFO, scmd, "Request descriptor details:\n"); + scmd_printk(KERN_INFO, scmd, + "RequestFlags:0x%x MSIxIndex:0x%x SMID:0x%x LMID:0x%x DevHandle:0x%x\n", + req_desc->SCSIIO.RequestFlags, + req_desc->SCSIIO.MSIxIndex, req_desc->SCSIIO.SMID, + req_desc->SCSIIO.LMID, req_desc->SCSIIO.DevHandle); + + printk(KERN_INFO "IO request frame:\n"); + megasas_dump(cmd->io_request, + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + printk(KERN_INFO "Chain frame:\n"); + megasas_dump(cmd->sg_frame, + instance->max_chain_frame_sz); + } + +} + /** * megasas_reset_bus_host - Bus & host reset handler entry point */ @@ -2861,24 +2902,20 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd) instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd, - "Controller reset is requested due to IO timeout\n" - "SCSI command pointer: (%p)\t SCSI host state: %d\t" - " SCSI host busy: %d\t FW outstanding: %d\n", - scmd, scmd->device->host->shost_state, + "OCR is requested due to IO timeout!!\n"); + + scmd_printk(KERN_INFO, scmd, + "SCSI host state: %d SCSI host busy: %d FW outstanding: %d\n", + scmd->device->host->shost_state, scsi_host_busy(scmd->device->host), atomic_read(&instance->fw_outstanding)); - /* * First wait for all commands to complete */ if (instance->adapter_type == MFI_SERIES) { ret = megasas_generic_reset(scmd); } else { - struct megasas_cmd_fusion *cmd; - cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; - if (cmd) - megasas_dump_frame(cmd->io_request, - MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + megasas_dump_fusion_io(scmd); ret = megasas_reset_fusion(scmd->device->host, SCSIIO_TIMEOUT_OCR); } diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ef0b15e4de2d..b4f798b458f0 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -122,7 +122,7 @@ megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, * Block access to PCI config space from userspace * when diag reset is initiated from driver */ - if (megasas_dbg_lvl & OCR_LOGS) + if (megasas_dbg_lvl & OCR_DEBUG) dev_info(&instance->pdev->dev, "Block access to PCI config space %s %d\n", __func__, __LINE__); @@ -145,7 +145,7 @@ megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, ret = SUCCESS; out: - if (megasas_dbg_lvl & OCR_LOGS) + if (megasas_dbg_lvl & OCR_DEBUG) dev_info(&instance->pdev->dev, "Unlock access to PCI config space %s %d\n", __func__, __LINE__); @@ -4519,9 +4519,6 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) instance = (struct megasas_instance *)scmd->device->host->hostdata; - scmd_printk(KERN_INFO, scmd, "task abort called for scmd(%p)\n", scmd); - scsi_print_command(scmd); - if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) { dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL," "SCSI host:%d\n", instance->host->host_no); @@ -4564,7 +4561,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) goto out; } sdev_printk(KERN_INFO, scmd->device, - "attempting task abort! scmd(%p) tm_dev_handle 0x%x\n", + "attempting task abort! scmd(0x%p) tm_dev_handle 0x%x\n", scmd, devhandle); mr_device_priv_data->tm_busy = 1; @@ -4575,9 +4572,12 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) mr_device_priv_data->tm_busy = 0; mutex_unlock(&instance->reset_mutex); -out: - sdev_printk(KERN_INFO, scmd->device, "task abort: %s scmd(%p)\n", + scmd_printk(KERN_INFO, scmd, "task abort %s!! scmd(0x%p)\n", ((ret == SUCCESS) ? "SUCCESS" : "FAILED"), scmd); +out: + scsi_print_command(scmd); + if (megasas_dbg_lvl & TM_DEBUG) + megasas_dump_fusion_io(scmd); return ret; } @@ -4600,9 +4600,6 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) instance = (struct megasas_instance *)scmd->device->host->hostdata; - sdev_printk(KERN_INFO, scmd->device, - "target reset called for scmd(%p)\n", scmd); - if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) { dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL," "SCSI host:%d\n", instance->host->host_no); @@ -4611,8 +4608,8 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) } if (!mr_device_priv_data) { - sdev_printk(KERN_INFO, scmd->device, "device been deleted! " - "scmd(%p)\n", scmd); + sdev_printk(KERN_INFO, scmd->device, + "device been deleted! scmd: (0x%p)\n", scmd); scmd->result = DID_NO_CONNECT << 16; ret = SUCCESS; goto out; @@ -4635,7 +4632,7 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) } sdev_printk(KERN_INFO, scmd->device, - "attempting target reset! scmd(%p) tm_dev_handle 0x%x\n", + "attempting target reset! scmd(0x%p) tm_dev_handle: 0x%x\n", scmd, devhandle); mr_device_priv_data->tm_busy = 1; ret = megasas_issue_tm(instance, devhandle, @@ -4644,10 +4641,10 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) mr_device_priv_data); mr_device_priv_data->tm_busy = 0; mutex_unlock(&instance->reset_mutex); -out: - scmd_printk(KERN_NOTICE, scmd, "megasas: target reset %s!!\n", + scmd_printk(KERN_NOTICE, scmd, "target reset %s!!\n", (ret == SUCCESS) ? "SUCCESS" : "FAILED"); +out: return ret; } @@ -4692,7 +4689,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) struct megasas_instance *instance; struct megasas_cmd_fusion *cmd_fusion, *r1_cmd; struct fusion_context *fusion; - u32 abs_state, status_reg, reset_adapter; + u32 abs_state, status_reg, reset_adapter, fpio_count = 0; u32 io_timeout_in_crash_mode = 0; struct scsi_cmnd *scmd_local = NULL; struct scsi_device *sdev; @@ -4766,7 +4763,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) if (convert) reason = 0; - if (megasas_dbg_lvl & OCR_LOGS) + if (megasas_dbg_lvl & OCR_DEBUG) dev_info(&instance->pdev->dev, "\nPending SCSI commands:\n"); /* Now return commands back to the OS */ @@ -4779,13 +4776,17 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) } scmd_local = cmd_fusion->scmd; if (cmd_fusion->scmd) { - if (megasas_dbg_lvl & OCR_LOGS) { + if (megasas_dbg_lvl & OCR_DEBUG) { sdev_printk(KERN_INFO, cmd_fusion->scmd->device, "SMID: 0x%x\n", cmd_fusion->index); - scsi_print_command(cmd_fusion->scmd); + megasas_dump_fusion_io(cmd_fusion->scmd); } + if (cmd_fusion->io_request->Function == + MPI2_FUNCTION_SCSI_IO_REQUEST) + fpio_count++; + scmd_local->result = megasas_check_mpio_paths(instance, scmd_local); @@ -4798,6 +4799,9 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) } } + dev_info(&instance->pdev->dev, "Outstanding fastpath IOs: %d\n", + fpio_count); + atomic_set(&instance->fw_outstanding, 0); status_reg = instance->instancet->read_fw_status_reg(instance); From patchwork Tue May 7 17:05:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DF81933 for ; Tue, 7 May 2019 17:06:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 778EF28876 for ; Tue, 7 May 2019 17:06:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BFA928879; Tue, 7 May 2019 17:06:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 1B4AC28876 for ; Tue, 7 May 2019 17:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbfEGRGm (ORCPT ); Tue, 7 May 2019 13:06:42 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36359 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGm (ORCPT ); Tue, 7 May 2019 13:06:42 -0400 Received: by mail-pg1-f196.google.com with SMTP id 85so8619451pgc.3 for ; Tue, 07 May 2019 10:06:42 -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=kOA1Bx5cGF6fzOBzG0i3z220U4AD6UldXBrPPdCIklo=; b=JJreXd/g4EhLniFJS+ZGNaaV1N2JYVU7K2B6kBeMXGECM3BOQmpxUkQDPbidSJ2xW7 jibOh5k8E9eywOZy/pW9cJ/6nDlpJRMp5zZ/h0R5vLFrR9FZdVA53haol38Z01ybHNAI vTrVtKE1yIClOpdqheozVwuC1bytX1hK0ogl4= 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=kOA1Bx5cGF6fzOBzG0i3z220U4AD6UldXBrPPdCIklo=; b=jvw2IRnq09IHlNf2ePjRzFWCnzmgqd1tLMw8rCL2iddUWI+gaCBYDCDKlnfzA99jFR Fzh09fBB1Ew0iaNHC0V6BVTi8uhA4nlKmln+oAQXuWqxzMri220Gq+Jl0Ag1XIoH76XY 45cveOZQVyBUHy6yDiLXoRV8CX47ios5QErFpTnlKQAPq9ApMWvkw5HvFAxWXE9OpRtj ALhmTfD1p1UY2XsvzRkoeLM9NVkUgHY7hCLYokgD/Xg3XIgvwUYQ0GsTFDezgADXSopd 5GcwcR9mT9raj3TRZzHjvG/ulAebCSHz815rhL1ui0wLCGjTLOeKCnTD5TWlwJg8A39C QnEA== X-Gm-Message-State: APjAAAWYHJ9f7fVEZhxi7ryU/uFyk5cXWWEOrK5MivWp8QID77r/H9S6 2wmn/IaRGhedgXyL+GDd0568lhOBwfPUszYGGSpCGk+t9RlNoNNPT5KiCCffs1jNrdME0wgBrrn i4jduQ/2wR8CcNdmqpWmxjKFqdLdfOvxB2eJSnL7KXWPfOHlJxWRsJZWPPuPFfUY30YqwSWAA4q FArO8Bu85Qxwgsio+mnkzP X-Google-Smtp-Source: APXvYqw7rU6iOTwusHG68r9SHi91qbsO4oNQ6661SegnideCkJ81FmejXxOFksKV7ZBLo0jD9tClKg== X-Received: by 2002:a63:b48:: with SMTP id a8mr38536305pgl.368.1557248801548; Tue, 07 May 2019 10:06:41 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:40 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 09/21] megaraid_sas: Enhance internal DCMD timeout prints Date: Tue, 7 May 2019 10:05:38 -0700 Message-Id: <1557248750-4099-10-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add prints to identify the internal DCMD opcode that has timed out, for debugging. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 032d91b1f3ba..7449df36a092 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1113,8 +1113,9 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance, ret = wait_event_timeout(instance->int_cmd_wait_q, cmd->cmd_status_drv != MFI_STAT_INVALID_STATUS, timeout * HZ); if (!ret) { - dev_err(&instance->pdev->dev, "Failed from %s %d DCMD Timed out\n", - __func__, __LINE__); + dev_err(&instance->pdev->dev, + "DCMD(opcode: 0x%x) is timed out, func:%s\n", + cmd->frame->dcmd.opcode, __func__); return DCMD_TIMEOUT; } } else @@ -1143,6 +1144,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd; struct megasas_abort_frame *abort_fr; int ret = 0; + u32 opcode; cmd = megasas_get_cmd(instance); @@ -1178,8 +1180,10 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, ret = wait_event_timeout(instance->abort_cmd_wait_q, cmd->cmd_status_drv != MFI_STAT_INVALID_STATUS, timeout * HZ); if (!ret) { - dev_err(&instance->pdev->dev, "Failed from %s %d Abort Timed out\n", - __func__, __LINE__); + opcode = cmd_to_abort->frame->dcmd.opcode; + dev_err(&instance->pdev->dev, + "Abort(to be aborted DCMD opcode: 0x%x) is timed out func:%s\n", + opcode, __func__); return DCMD_TIMEOUT; } } else From patchwork Tue May 7 17:05:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 202AC1398 for ; Tue, 7 May 2019 17:06:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 094C528877 for ; Tue, 7 May 2019 17:06:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1F15288A2; Tue, 7 May 2019 17:06:46 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 9930C288AF for ; Tue, 7 May 2019 17:06:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfEGRGq (ORCPT ); Tue, 7 May 2019 13:06:46 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44961 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGq (ORCPT ); Tue, 7 May 2019 13:06:46 -0400 Received: by mail-pg1-f196.google.com with SMTP id z16so8603145pgv.11 for ; Tue, 07 May 2019 10:06:45 -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=dcCoZiF26ORknzMxcBW3zcM05iT1n+AfBsRDn09t5Cc=; b=eRBVUXSjj4Z/E2/HV3KdB0kOpSmy9N2O1oD8MLhNIz3WATdlEne8ne6yz71uwott3j 2xR25P2oqf+jpQwPV32IF7x1R7nF9gHqV6CN5WtlxaZz1s+BtatR9fU+0ygcYXGbU10f wbFxDiP5TTEHt5RJV2CcI/PPTZX1bBSmywWhM= 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=dcCoZiF26ORknzMxcBW3zcM05iT1n+AfBsRDn09t5Cc=; b=ezFRi725cZKIRvUIwguz6AO0k3wFsDsLaOcH7lHjA4xEHFjFJTuPbHIN/DtNwkcLRa 8vf0cgk0e90lAih1iFvrhl/uJzALCZuS/m/n2gt7l1bxURUXVwUahkScvtvDZ699MhXE RVQh/s5WWz18lniUX/Vs1huaALOHTyIRWHQb1QlIRPIBhcvAgXyLM2QI5n0GlW+qTzwg P7nlhQk+3QSmjTznvPZtxlKEavVeavMUG5d9BUm53MOnuQnA/eksDZJ3TMYnXsq+ONfC /XSbmCw94N5BH6mlpzRyl2alMMHLzGU8wYAV+wbO1E6CtCKhNOp+rp1lapK1tH1DnKCG LjiQ== X-Gm-Message-State: APjAAAVGleFwfLJ7+UATXE2PLoJ80xhytViPkYljpERnsTqWAf5YLA4D 2vioB8/3shVjxGAmz2WtexRZ3V//pbdEWtm58c4nWfFHl6jXbRC+8paw17I8WmIfHMgXDntDUNe BL5zt3gqjkstHZjstXit9+HUM6yBufAj3l9Ms9u0qfvn8nHkWIsRmqC0qWf1HvC+PsVRNyWP4nW U0IcoE1J86A0SVKD2J7R5e X-Google-Smtp-Source: APXvYqxAYIxvuUzFL8M3pa7Cdu2RJJ2TrCj/9W29SdD6HzjCjHq5UW8UKBVDLQArIFz+qIP9g4S8lg== X-Received: by 2002:a62:1897:: with SMTP id 145mr42897858pfy.122.1557248804975; Tue, 07 May 2019 10:06:44 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:44 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 10/21] megaraid_sas: Add formatting option for megasas_dump Date: Tue, 7 May 2019 10:05:39 -0700 Message-Id: <1557248750-4099-11-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add option to format the buffer that is being dumped. Currently, the IO frame and chain frame dumped in the syslog is getting split across multiple lines based on the formatting. Fix this by using KERN_CONT in printk. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7449df36a092..d0fd307e30af 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2838,22 +2838,28 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) } /** - * megasas_dump - This function will provide hexdump - * @ptr: Pointer starting which memory should be dumped - * @size: Size of memory to be dumped + * megasas_dump - This function will print hexdump of provided buffer. + * @buf: Buffer to be dumped + * @sz: Size in bytes + * @format: Different formats of dumping e.g. format=n will + * cause only 'n' 32 bit words to be dumped in a single + * line. */ inline void -megasas_dump(void *ptr, int sz) +megasas_dump(void *buf, int sz, int format) { int i; - __le32 *loc = (__le32 *)ptr; + __le32 *buf_loc = (__le32 *)buf; - for (i = 0; i < sz / sizeof(__le32); i++) { - if (i && ((i % 8) == 0)) - printk("\n\t"); - printk("%08x ", le32_to_cpu(loc[i])); + for (i = 0; i < (sz / sizeof(__le32)); i++) { + if ((i % format) == 0) { + if (i != 0) + printk(KERN_CONT "\n"); + printk(KERN_CONT "%08x: ", (i * 4)); + } + printk(KERN_CONT "%08x ", le32_to_cpu(buf_loc[i])); } - printk("\n"); + printk(KERN_CONT "\n"); } /** @@ -2887,10 +2893,10 @@ megasas_dump_fusion_io(struct scsi_cmnd *scmd) printk(KERN_INFO "IO request frame:\n"); megasas_dump(cmd->io_request, - MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE, 8); printk(KERN_INFO "Chain frame:\n"); megasas_dump(cmd->sg_frame, - instance->max_chain_frame_sz); + instance->max_chain_frame_sz, 8); } } From patchwork Tue May 7 17:05:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE5501398 for ; Tue, 7 May 2019 17:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9845528879 for ; Tue, 7 May 2019 17:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CDC1288BA; Tue, 7 May 2019 17:06:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 2CC83288AF for ; Tue, 7 May 2019 17:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727318AbfEGRGu (ORCPT ); Tue, 7 May 2019 13:06:50 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41163 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGt (ORCPT ); Tue, 7 May 2019 13:06:49 -0400 Received: by mail-pf1-f195.google.com with SMTP id l132so4018400pfc.8 for ; Tue, 07 May 2019 10:06:49 -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=RG6TTEe10onRho7UWIoWs5g+MDWSxE1s51WAEHTfYQ4=; b=da4lpKA4nv14OZJX00jyvXcFI9VnC3D3b4GvuELO8jmgsRnI1ro97BfB78r2rUADmD Pp+ofrfBac08KSVKtFdPW/19aEtAgxOZDGvCeqXqKmmVYyerTDC2zT0V2AJhavG1Q6/3 mHuWgJpICDvlXTY5vFvANFiHm2iHrL9mvxNOQ= 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=RG6TTEe10onRho7UWIoWs5g+MDWSxE1s51WAEHTfYQ4=; b=HsIYR6SH7Pi7OqY96p/En5mqbhPBQeazNsI98h2lIwPrYIpAVducC3dGBTQpClM1E4 u8MZFeC6FnAvnY4s9A8/HDiAcxkjcMNVu47Zvyu9I23I/XxIbqpGsdqUM1TAyZ5AIRmK BjzfnkbFU0MBTCUbx2rG2YUV2+qvPUijR3tNrxNuS27MlznJOE39owDMEGNu3dQSzUSE ZfdG0WuAma+ilgEUJoBaX1+RNrX6rq8ovfbB7vLtV4NI8O14lV5+JQMhA6u2+WXo+I8Q KgZg5Cz3m9vA44NLjRcdIk5vlmDNAo4pDhDPjhtJ6VgFh79VPQSEn+kU+eTaYfYzj+rb FCjA== X-Gm-Message-State: APjAAAUQzocjjmxC0YLI5rkPakxWzuxhuSoNyTpuu/qS9HxLikuK7/c/ 12xHNOHKUaWhUfOUHupU0zqP9Fa77cfm3Kv/pPqe/epwgVlFlsPeOBa8BFgJzAkdsjJN8onM8mb zWusUkRn4vPlEtMiw65qPHHic9dkB5Z5cy+MwjtKQ3637p1PY6T/K54jMTAhtF7lvJLnJGjJN90 4rzgVbD+m5NP4Hr9jxIN/W X-Google-Smtp-Source: APXvYqxwaFIiVWzqsUQ2WiMBmkqqhqA6RlbQkEB4Wu+jHwZ8O7+nndynPucDXOI2TQNw46zo8ivmOQ== X-Received: by 2002:a62:56c8:: with SMTP id h69mr7209922pfj.49.1557248808622; Tue, 07 May 2019 10:06:48 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:47 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 11/21] megaraid_sas: Dump system interface regs from sysfs Date: Tue, 7 May 2019 10:05:40 -0700 Message-Id: <1557248750-4099-12-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add a sysfs interface to dump the controller's system interface registers. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- Changes in v2: Fixed the sparse warnings reported by kbuild_test_robot and removed the endianness conversion after readl. drivers/scsi/megaraid/megaraid_sas_base.c | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index d0fd307e30af..e2a89821bdd2 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2901,6 +2901,29 @@ megasas_dump_fusion_io(struct scsi_cmnd *scmd) } +/* + * megasas_dump_sys_regs - This function will dump system registers through + * sysfs. + * @reg_set: Pointer to System register set. + * @buf: Buffer to which output is to be written. + * @return: Number of bytes written to buffer. + */ +static inline ssize_t +megasas_dump_sys_regs(void __iomem *reg_set, char *buf) +{ + unsigned int i, sz = 256; + int bytes_wrote = 0; + char *loc = (char *)buf; + u32 __iomem *reg = (u32 __iomem *)reg_set; + + for (i = 0; i < sz / sizeof(u32); i++) { + bytes_wrote += snprintf(loc + bytes_wrote, PAGE_SIZE, + "%08x: %08x\n", (i * 4), + readl(®[i])); + } + return bytes_wrote; +} + /** * megasas_reset_bus_host - Bus & host reset handler entry point */ @@ -3223,6 +3246,17 @@ megasas_fw_cmds_outstanding_show(struct device *cdev, return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&instance->fw_outstanding)); } +static ssize_t +megasas_dump_system_regs_show(struct device *cdev, + struct device_attribute *attr, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(cdev); + struct megasas_instance *instance = + (struct megasas_instance *)shost->hostdata; + + return megasas_dump_sys_regs(instance->reg_set, buf); +} + static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR, megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store); static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO, @@ -3235,6 +3269,8 @@ static DEVICE_ATTR(ldio_outstanding, S_IRUGO, megasas_ldio_outstanding_show, NULL); static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO, megasas_fw_cmds_outstanding_show, NULL); +static DEVICE_ATTR(dump_system_regs, S_IRUGO, + megasas_dump_system_regs_show, NULL); struct device_attribute *megaraid_host_attrs[] = { &dev_attr_fw_crash_buffer_size, @@ -3243,6 +3279,7 @@ struct device_attribute *megaraid_host_attrs[] = { &dev_attr_page_size, &dev_attr_ldio_outstanding, &dev_attr_fw_cmds_outstanding, + &dev_attr_dump_system_regs, NULL, }; From patchwork Tue May 7 17:05:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90B42933 for ; Tue, 7 May 2019 17:06:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 795C428879 for ; Tue, 7 May 2019 17:06:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DAC3288BC; Tue, 7 May 2019 17:06:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 0E26828879 for ; Tue, 7 May 2019 17:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727324AbfEGRGx (ORCPT ); Tue, 7 May 2019 13:06:53 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43003 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRGx (ORCPT ); Tue, 7 May 2019 13:06:53 -0400 Received: by mail-pg1-f195.google.com with SMTP id p6so8604255pgh.9 for ; Tue, 07 May 2019 10:06:53 -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=dcu3BjDbzb6AS6deRu3+AnPwMTij9dA2O6fW6kspqME=; b=QMMbX7iWktzNrSydS8UIILTaTwk7e2Rq3mcyfRFr0BBNM4nMMDY8kicbR6U806nOgi Y5KyAei3iPX4IrqYhDDRh1/jdsy06iSwuPMXFUEki7mscE11GJKGRX1SkxtEf3J+rvtB Q2YpEQhB308niDZsbpP9nWxmx8VkCWBssLfss= 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=dcu3BjDbzb6AS6deRu3+AnPwMTij9dA2O6fW6kspqME=; b=gTnKSFi19vccIF9YyS2NekrAKJ2hr1MDr0F3DYzOMOHhSPRi5OwIQdvGHXZTqd0t3s 61qtX1PEOQnA16xvNeMIRNg8M2mkKceBiewOOpO9niUmZHnsdqDHCXaFjVa6lMTKuJnL ddgaa+Zj99z7tc0AhLLjWtoztkdRT8nGvdcPj8tOSn8ChcXWYzoqTE6M1YxcNYLs/qML SwtqBV3nGMWXgr2bqI0yAaHDK5x2O24NvnqxhMgeIKJmtmSY9b1N9A2cwZkCpXaVD273 qFENS6669P77MvVftups/JxHEk67BqUnzbonmNDvaraghAo6cjEmZkf+mV7jL0MS2S4G FliQ== X-Gm-Message-State: APjAAAVk3zylTVsERA+TtkZbb6Wq+6LcpakLExPxkZkJdsf/2MfdhXly 9LUz+diKFaZpEsVpr255Lc+x0egHYGsrgPy4n75j8g/sa0tkiG87LY+VzCDv/udSgJSpHdNF/qk 8LC61rSxFiwbQDJHrOJaAuKG1aiB13LOD1qtsbtyS3L/7EMZ5iYqcw0wP1WS0IfmA+qfy0uXTRj cagAD4A0pxe8krwaLfBiTs X-Google-Smtp-Source: APXvYqxXQv6yAaYw6AkkPog0t/PvBPaUp0pfm9GkuSlEGUcQCm6eRk4peCLzwAn/JKJRbaWnIS3iUg== X-Received: by 2002:a62:5653:: with SMTP id k80mr29007217pfb.144.1557248812357; Tue, 07 May 2019 10:06:52 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:51 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 12/21] megaraid_sas: Dump system registers for debugging Date: Tue, 7 May 2019 10:05:41 -0700 Message-Id: <1557248750-4099-13-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 When controller fails to transition to READY state during driver probe, dump the system interface register set. This will give snapshot of the firmware status for debugging driver load issues. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- Changes in v2: Fixed the sparse warning and removed the endianness conversion after readl. drivers/scsi/megaraid/megaraid_sas_base.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index e2a89821bdd2..905b45590c7e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2862,6 +2862,24 @@ megasas_dump(void *buf, int sz, int format) printk(KERN_CONT "\n"); } +/** + * megasas_dump_reg_set - This function will print hexdump of register set + * @buf: Buffer to be dumped + * @sz: Size in bytes + * @format: Different formats of dumping e.g. format=n will + * cause only 'n' 32 bit words to be dumped in a + * single line. + */ +inline void +megasas_dump_reg_set(void __iomem *reg_set) +{ + unsigned int i, sz = 256; + u32 __iomem *reg = (u32 __iomem *)reg_set; + + for (i = 0; i < (sz / sizeof(u32)); i++) + printk("%08x: %08x\n", (i * 4), readl(®[i])); +} + /** * megasas_dump_fusion_io - This function will print key details * of SCSI IO @@ -3891,8 +3909,11 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) max_wait = MEGASAS_RESET_WAIT_TIME; cur_state = MFI_STATE_FAULT; break; - } else + } else { + dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n"); + megasas_dump_reg_set(instance->reg_set); return -ENODEV; + } case MFI_STATE_WAIT_HANDSHAKE: /* @@ -4000,6 +4021,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) default: dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n", fw_state); + dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n"); + megasas_dump_reg_set(instance->reg_set); return -ENODEV; } @@ -4022,6 +4045,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) if (curr_abs_state == abs_state) { dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed " "in %d secs\n", fw_state, max_wait); + dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n"); + megasas_dump_reg_set(instance->reg_set); return -ENODEV; } From patchwork Tue May 7 17:05:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D93CC933 for ; Tue, 7 May 2019 17:06:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C124E28879 for ; Tue, 7 May 2019 17:06:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5B14288BA; Tue, 7 May 2019 17:06:57 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 6397F28879 for ; Tue, 7 May 2019 17:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbfEGRG5 (ORCPT ); Tue, 7 May 2019 13:06:57 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36377 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRG4 (ORCPT ); Tue, 7 May 2019 13:06:56 -0400 Received: by mail-pg1-f194.google.com with SMTP id 85so8619783pgc.3 for ; Tue, 07 May 2019 10:06:56 -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=aflJaYHZKPIXheu2HfY3QQIzr5YPwlOTARNWhhcuNxA=; b=di1hRnj+4vme81LL4UwGim3WRuP7qv3aSoW4fGKtsvihxrH59NgbXd2GPtq0plXnGP nLbFF30niIuWbeFAIGJnhq9maVS+pq4p3mYr5xvaL4tLb1aEVbdxBowyeqSTQaEAtw9S wrsrHy3bFQ3Kvo6Gz66xgtTX1J16lJJFrxjRo= 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=aflJaYHZKPIXheu2HfY3QQIzr5YPwlOTARNWhhcuNxA=; b=Q9bZ58mr2u+eT/T6KgrsCe66ghWUGYp1kZtafd9exH7X5pQjO99k66dz0wyvknun4v pjXdDZZFN5CX9N1U0QpGWjO7OYLg4ivOEkZ7YLR0OmJ/bxss1iv/SULfii/Tb1OxLnHt 4SVnBUNVw20u2Yu4PEoebBgtcM7VLs7mwak0o6DRtDVUpFFJbJkQBH9o2XKv6c7cgkBJ qmZYwCXW8PmBSYDJuqJ3fhYn57olF5z4+XpQRX6UmjCQOOlb5kpSabDyNlqNweA1/EdP 2Mj/4QUC2ltXd7XHg98gC7aSOfDLeSJP6widzaCfA3XXP0Rvratfoj4GZE8TM78tS0Qx Hyvg== X-Gm-Message-State: APjAAAUf9YaJnQzWNntMNrvLnczFAKgMnJlI0Y4MSpzvb9BC73JgLtxs p4FYQV6SCwzkpzkI3lR9VTS9RZ8Qlo99t6Mr01tny4+Fs9LPBwawLJ1y4G+uMXED0djpq5Jhgog Nr8y/yJlkyGDVejldwPAX/1lVyg7qqM/zlukXb9JVwrS9qVuO3aBVMeQNaUgG8bgbmyWUI9XnxQ R+cqnCydoZOyL7mcWMUgms X-Google-Smtp-Source: APXvYqw0z5/ufTgvGucDE73rEAa7eDjrV563Ye3rk4X3uN1PNxYlyZdiOrzS4i2tT8m2GvX7Olb6uA== X-Received: by 2002:a65:610a:: with SMTP id z10mr40917623pgu.54.1557248815783; Tue, 07 May 2019 10:06:55 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:54 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 13/21] megaraid_sas: Print BAR information from driver Date: Tue, 7 May 2019 10:05:42 -0700 Message-Id: <1557248750-4099-14-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add prints for BAR address information during driver load. This helps in debugging issues with BAR address changing during OS boot. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 905b45590c7e..18d142f2a2a2 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5625,6 +5625,7 @@ static int megasas_init_fw(struct megasas_instance *instance) u32 max_sectors_2, tmp_sectors, msix_enable; u32 scratch_pad_1, scratch_pad_2, scratch_pad_3, status_reg; resource_size_t base_addr; + void *base_addr_phys; struct megasas_ctrl_info *ctrl_info = NULL; unsigned long bar_list; int i, j, loop, fw_msix_count = 0; @@ -5650,6 +5651,11 @@ static int megasas_init_fw(struct megasas_instance *instance) goto fail_ioremap; } + base_addr_phys = &base_addr; + dev_printk(KERN_DEBUG, &instance->pdev->dev, + "BAR:0x%lx BAR's base_addr(phys):%pa mapped virt_addr:0x%p\n", + instance->bar, base_addr_phys, instance->reg_set); + if (instance->adapter_type != MFI_SERIES) instance->instancet = &megasas_instance_template_fusion; else { From patchwork Tue May 7 17:05:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93BE41398 for ; Tue, 7 May 2019 17:07:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C4DD288A2 for ; Tue, 7 May 2019 17:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7063B288BC; Tue, 7 May 2019 17:07:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 1F012288A2 for ; Tue, 7 May 2019 17:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727334AbfEGRHA (ORCPT ); Tue, 7 May 2019 13:07:00 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45567 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHA (ORCPT ); Tue, 7 May 2019 13:07:00 -0400 Received: by mail-pl1-f196.google.com with SMTP id a5so3544943pls.12 for ; Tue, 07 May 2019 10:07:00 -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=pXKzISJZP1hfca4sn8XSTMaP204q8qEUTDJkeALfHOs=; b=ahCF8SanL1HiiVm1MhMzRSbOLmvg8WnGrwmBLF7teZfuW8uaW0AcFGBSq2icyts4IQ /pE/8zcxm8jxZTovEGhku8Y5589FIAW/A7XWXYqfvzjahetJoxoqN30N5o8RKChbyRIj jEGZoyZXzYBh8wlqvpaktRLlDWJXhIPp3g098= 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=pXKzISJZP1hfca4sn8XSTMaP204q8qEUTDJkeALfHOs=; b=k+f3YlQlhbv+mXAxwVDdDRFQW52MH8stACVmWMtuBCMlMcfLF/yu+p4o6jRKJz9yZh 5azBXzQp0EKh3/+3ZcXw7B1YaleCEh+YS2myXW+Dalz4S8TP0p5XRtGtP47XF0f3dg73 IXVqj2Mzi71mg4TrkJDZ0tmbJkGvW3ZaagwNeiujU6rIz9fq4EKvzA3140yvcRUdXor4 XuFGUSIKF0ADlbFsdiaeNGrJdN7uy7bJCr4mTHPcIYzSzX+fJlKojdAEtSpqu80F2wk0 wZs0u9rBBeobrO+3mBSGZBLE7QWOrwQRmlF2j74rkB5umRCYAZcEFQZiIXJ5JHd34p5n y8Cg== X-Gm-Message-State: APjAAAX/QOrMOb8+gTUXITgFCSs8kkGNpxl8RIJc9tivht8iiXpgEe9Q Y+fa67TGe/+TXO1vCGviZ3uX95PEzGxDKwkHvMYa7QEC33qAVxr7WleBIinMQfZQ8XuLj5RbcvW kVkLIgQ6yuWm+pLf6KTfBpAmz4m5ANG+Nq+lGayMtus+7eqIrnEdZZSfEQmOUOnZ5DdDcpmXl4N x3ohZwKXRX2fMSyMsGXRUF X-Google-Smtp-Source: APXvYqxz5rN+eXLP0cXEBkezyIl+uLimg2q0NKD2zQ9i/sRJWJ0L+M2K/60MDafdVXJYY9h45E39Eg== X-Received: by 2002:a17:902:441:: with SMTP id 59mr41305585ple.242.1557248819420; Tue, 07 May 2019 10:06:59 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:06:58 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 14/21] megaraid_sas: Export RAID map id through sysfs Date: Tue, 7 May 2019 10:05:43 -0700 Message-Id: <1557248750-4099-15-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add a sysfs interface to get the raid map index that is being used by driver. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 18d142f2a2a2..c560d1e748f4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3275,6 +3275,18 @@ megasas_dump_system_regs_show(struct device *cdev, return megasas_dump_sys_regs(instance->reg_set, buf); } +static ssize_t +megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr, + char *buf) +{ + struct Scsi_Host *shost = class_to_shost(cdev); + struct megasas_instance *instance = + (struct megasas_instance *)shost->hostdata; + + return snprintf(buf, PAGE_SIZE, "%ld\n", + (unsigned long)instance->map_id); +} + static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR, megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store); static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO, @@ -3289,6 +3301,8 @@ static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO, megasas_fw_cmds_outstanding_show, NULL); static DEVICE_ATTR(dump_system_regs, S_IRUGO, megasas_dump_system_regs_show, NULL); +static DEVICE_ATTR(raid_map_id, S_IRUGO, + megasas_raid_map_id_show, NULL); struct device_attribute *megaraid_host_attrs[] = { &dev_attr_fw_crash_buffer_size, @@ -3298,6 +3312,7 @@ struct device_attribute *megaraid_host_attrs[] = { &dev_attr_ldio_outstanding, &dev_attr_fw_cmds_outstanding, &dev_attr_dump_system_regs, + &dev_attr_raid_map_id, NULL, }; From patchwork Tue May 7 17:05:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 843AB1398 for ; Tue, 7 May 2019 17:07:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D227288A2 for ; Tue, 7 May 2019 17:07:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 612F3288BC; Tue, 7 May 2019 17:07:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 E8334288A2 for ; Tue, 7 May 2019 17:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbfEGRHE (ORCPT ); Tue, 7 May 2019 13:07:04 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34355 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHE (ORCPT ); Tue, 7 May 2019 13:07:04 -0400 Received: by mail-pl1-f195.google.com with SMTP id ck18so8495610plb.1 for ; Tue, 07 May 2019 10:07:03 -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=Zqlad5jQIKPc+MIklfDYLl9c85Crem7srgoO0xdfp54=; b=R5nrM4M8jpV8DSiPebkp6UaVKxKeu3HBnebnW5jDHrUJRimZWGIEep4sRoOCOEsn5l GbQtzc9KIRNipbkzVUtjRjB7KE8ec1aZe5aO5/8PR0zwpbtwVm6se9EB3fMxpRoTZqKE rOeIOc+MEMukJKQ3+1ehAU1NNxmDaUHeHgBic= 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=Zqlad5jQIKPc+MIklfDYLl9c85Crem7srgoO0xdfp54=; b=PcVyenHiMf80zY9NvAVJwRMLu5gyFB4lD60xnMled4PH2gU0BFdnzLnfdLoqLvY/PF w67D76rQGN0n9H7cnVA4n4VW/cJb1nY/m3sRCXPQMgyFRZ5u3Mc4cyMQoG88cjXf+sE6 QieXqGbubIUujBkTFOayA0vl4KUlpk1JtupbxD6cHpowny3ZJuuWyfDgI/yMXye5RER8 Ujl1n4PDTN4VP/jjXhPS8u6OkANsHYydDo/9ChaAHfpYJ7LUzZuOakx5pWP3J5s8gTnP tqgQuYFVi6FEQ8X/uGOTkX6dRUDTqS+ek5klZ7fRixuzTlfp+lqyUnwn0D/GbUsW5sFk fftA== X-Gm-Message-State: APjAAAXwkflKWhlEIInsC+vMHvyxVv8ADFaoxfrYpxU0tQEHIMeDKfUY w/Fwaw4uhe7IKPVRMJrFRgbbF7ch63nDsdg3IpPSLx1c89EE/Kw94IPWgLOL8Lgy+jNlqbfBqnP XoYHzxi9FJbBn7J3454V51OMSw3PLOZhLxrWGQ81Gv8GXTHyiQZfZzkh6SEfDszH5A1CffPTrCB YKwV+CfG0Zy/690PeI1I3K X-Google-Smtp-Source: APXvYqyBweSnVT+dUqM0fEvipspc7VvlfH7kD/ppbTU9qNH4uO3GxuVXL4ow3gtheQbzg87j9cqsLg== X-Received: by 2002:a17:902:8609:: with SMTP id f9mr39343704plo.32.1557248822945; Tue, 07 May 2019 10:07:02 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.06.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:02 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 15/21] megaraid_sas: Print FW fault information Date: Tue, 7 May 2019 10:05:44 -0700 Message-Id: <1557248750-4099-16-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 When driver detects a firmware fault during load, dump additional information on fault code and subcode that will help in debugging. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 2 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 25 ++++++++++++++----------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 27980d68cf1b..8df6ef01785e 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -135,6 +135,8 @@ #define MFI_RESET_ADAPTER 0x00000002 #define MEGAMFI_FRAME_SIZE 64 +#define MFI_STATE_FAULT_CODE 0x0FFF0000 +#define MFI_STATE_FAULT_SUBCODE 0x0000FF00 /* * During FW init, clear pending cmds & reset state using inbound_msg_0 * diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index c560d1e748f4..4689909fa66b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3919,7 +3919,10 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) switch (fw_state) { case MFI_STATE_FAULT: - dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW in FAULT state!!\n"); + dev_printk(KERN_ERR, &instance->pdev->dev, + "FW in FAULT state, Fault code:0x%x subcode:0x%x func:%s\n", + abs_state & MFI_STATE_FAULT_CODE, + abs_state & MFI_STATE_FAULT_SUBCODE, __func__); if (ocr) { max_wait = MEGASAS_RESET_WAIT_TIME; cur_state = MFI_STATE_FAULT; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index b4f798b458f0..4c78e4caf910 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -3984,7 +3984,7 @@ megasas_check_reset_fusion(struct megasas_instance *instance, static inline void megasas_trigger_snap_dump(struct megasas_instance *instance) { int j; - u32 fw_state; + u32 fw_state, abs_state; if (!instance->disableOnlineCtrlReset) { dev_info(&instance->pdev->dev, "Trigger snap dump\n"); @@ -3994,11 +3994,13 @@ static inline void megasas_trigger_snap_dump(struct megasas_instance *instance) } for (j = 0; j < instance->snapdump_wait_time; j++) { - fw_state = instance->instancet->read_fw_status_reg(instance) & - MFI_STATE_MASK; + abs_state = instance->instancet->read_fw_status_reg(instance); + fw_state = abs_state & MFI_STATE_MASK; if (fw_state == MFI_STATE_FAULT) { - dev_err(&instance->pdev->dev, - "Found FW in FAULT state, after snap dump trigger\n"); + dev_printk(KERN_ERR, &instance->pdev->dev, + "FW in FAULT state Fault code:0x%x subcode:0x%x func:%s\n", + abs_state & MFI_STATE_FAULT_CODE, + abs_state & MFI_STATE_FAULT_SUBCODE, __func__); return; } msleep(1000); @@ -4010,7 +4012,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, int reason, int *convert) { int i, outstanding, retval = 0, hb_seconds_missed = 0; - u32 fw_state; + u32 fw_state, abs_state; u32 waittime_for_io_completion; waittime_for_io_completion = @@ -4029,12 +4031,13 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, for (i = 0; i < waittime_for_io_completion; i++) { /* Check if firmware is in fault state */ - fw_state = instance->instancet->read_fw_status_reg(instance) & - MFI_STATE_MASK; + abs_state = instance->instancet->read_fw_status_reg(instance); + fw_state = abs_state & MFI_STATE_MASK; if (fw_state == MFI_STATE_FAULT) { - dev_warn(&instance->pdev->dev, "Found FW in FAULT state," - " will reset adapter scsi%d.\n", - instance->host->host_no); + dev_printk(KERN_ERR, &instance->pdev->dev, + "FW in FAULT state Fault code:0x%x subcode:0x%x func:%s\n", + abs_state & MFI_STATE_FAULT_CODE, + abs_state & MFI_STATE_FAULT_SUBCODE, __func__); megasas_complete_cmd_dpc_fusion((unsigned long)instance); if (instance->requestorId && reason) { dev_warn(&instance->pdev->dev, "SR-IOV Found FW in FAULT" From patchwork Tue May 7 17:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 930B7933 for ; Tue, 7 May 2019 17:07:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B17C288A2 for ; Tue, 7 May 2019 17:07:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D637288BC; Tue, 7 May 2019 17:07:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 1A4E7288A2 for ; Tue, 7 May 2019 17:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727337AbfEGRHH (ORCPT ); Tue, 7 May 2019 13:07:07 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43356 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHH (ORCPT ); Tue, 7 May 2019 13:07:07 -0400 Received: by mail-pl1-f193.google.com with SMTP id n8so8486401plp.10 for ; Tue, 07 May 2019 10:07:07 -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=GH2McAjbHTTT+r3RUBdzwUwYCFkr8azQo8a6uOlOZ2o=; b=HeNcYkid6c3ntapQswQU1nXepNrX2NUr20+0iMwkIpB73qGQ+z64MR/kCMcu6k6j5w 9uX6fInLlthtVyUXtnhmwgaricxW6QzeuAWIj7C+7ayUTYOxiw2UnACsxKZWltQ35blG G3nytv0Ac6FKKOoRmbLjH2gD7Q0+URV3n7mns= 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=GH2McAjbHTTT+r3RUBdzwUwYCFkr8azQo8a6uOlOZ2o=; b=BAPaMcGX+TURxY6K6T4SvQFMj1kzvqI+IOnRcw+YZ91BrIIrqFjW8vp54HQqRuKQ22 GmQc/WUmSGa4e11elfSJce/2VOro+iLmpNA6s+r/GzlERrULiifzPVjpkWWnME00l8G9 eqf3z6BtuJxXjKSTRzl8lvB+o8/G59KLyFcK5CeVbGTi3JpYWzvvrVpXZ0Q2zJHmtnp+ T7jeHplG0L8GSff93LRb3xO+g9SxBewSRwGNG7evL11/aqtIdwTSJKeRgJtvwifbB3bW YP8LojV36RZt2WEIfzlriXxkRXhL/249p2LPkarH4IR/Ka8zPn3xaL325kJQzQi4fPuI 5VaQ== X-Gm-Message-State: APjAAAURxtZx9u3SFyR5gTRIqeOK2CaiZqV23+Y2zUc9ahSpu9CTWUwg i/qZ4NFMbwY8UJSkKEEtZgnreKr5NCyrxUxrywB/du+RKenCt36MRbdpOe3OqBFYGUj8kIP9xtN lWTVj8JFzP7D25p1Wapxpr8uVZzDvUjlM3MGrNNsEwbNw5GVpU86T3Mrsxe2LPtPqIv4ICwrbdH rj+yQmCKN0nCdvsfPGRhW+ X-Google-Smtp-Source: APXvYqw7V8G1EcgmvaoCuwjZtg9YvHU+guVs/shw0fBQDGY7MZCNGCf/2GT/tmydThUxU+ZGmy9T6A== X-Received: by 2002:a17:902:2a07:: with SMTP id i7mr36483523plb.125.1557248826487; Tue, 07 May 2019 10:07:06 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.07.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:05 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 16/21] megaraid_sas: Print firmware interrupt status Date: Tue, 7 May 2019 10:05:45 -0700 Message-Id: <1557248750-4099-17-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add a print to dump the interrupt status in system log for debugging. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 4c78e4caf910..ca489fed51a1 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -202,7 +202,8 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) writel(~MFI_FUSION_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask); /* Dummy readl to force pci flush */ - readl(®s->outbound_intr_mask); + dev_info(&instance->pdev->dev, "%s is called outbound_intr_mask:0x%08x\n", + __func__, readl(®s->outbound_intr_mask)); } /** @@ -213,14 +214,14 @@ void megasas_disable_intr_fusion(struct megasas_instance *instance) { u32 mask = 0xFFFFFFFF; - u32 status; struct megasas_register_set __iomem *regs; regs = instance->reg_set; instance->mask_interrupts = 1; writel(mask, ®s->outbound_intr_mask); /* Dummy readl to force pci flush */ - status = readl(®s->outbound_intr_mask); + dev_info(&instance->pdev->dev, "%s is called outbound_intr_mask:0x%08x\n", + __func__, readl(®s->outbound_intr_mask)); } int @@ -4895,9 +4896,9 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); - dev_info(&instance->pdev->dev, "Interrupts are enabled and" - " controller is OPERATIONAL for scsi:%d\n", - instance->host->host_no); + dev_info(&instance->pdev->dev, + "Adapter is OPERATIONAL for scsi:%d\n", + instance->host->host_no); /* Restart SR-IOV heartbeat */ if (instance->requestorId) { From patchwork Tue May 7 17:05:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEFEE1398 for ; Tue, 7 May 2019 17:07:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B79E7288BC for ; Tue, 7 May 2019 17:07:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA676288C6; Tue, 7 May 2019 17:07:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 880EF288BC for ; Tue, 7 May 2019 17:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbfEGRHL (ORCPT ); Tue, 7 May 2019 13:07:11 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36312 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHL (ORCPT ); Tue, 7 May 2019 13:07:11 -0400 Received: by mail-pf1-f193.google.com with SMTP id v80so8976552pfa.3 for ; Tue, 07 May 2019 10:07:10 -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=EzayKxQXuN2dwrBvykQbKk1qVbnmwjIJaXQycA6LH0Y=; b=B2v1xBarizmRfl7vhWrxk/zPa9t7lmcpHXVY9XbG2iWIJ9FdyxWGYvPfdSwJF01a/9 mg1hFvjsfvSMGOo727C8zvWzTmCZdZXwlAVlgffylz1t6gVu6YYeKGTEQKLBUMRGHBF7 UZdTU8hMC947wAIN3PJF1AXpULEulsAK8PCjI= 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=EzayKxQXuN2dwrBvykQbKk1qVbnmwjIJaXQycA6LH0Y=; b=Cbw0b2Iqje5esLrkPa6V69xsSdsV+50SdKqdui7qPOjXttl/AGDtTJ63PugHEZC8zd XXMHl9mAD2G9NB30OrBGj3NqYhuq7EdPYewB1Iij/Eny7PW6QKYozNbmHrRY7AixhUpl GiLp/8nUoF3JNmjEPBrqk+O7bNZTdsvCwZ96wQmv3bU3aMJ6cEzqrTb6+LQPNfkH84iQ huiOPktAb4fU6vrbVoGcttJGyUhR8PaY8Qkh6k371QoBsZzKZI0i5nLOtAGiDq7u2P3R 4h7jreUceT0V2i0r+Ben+yTxvSki1fKVcv/tTYloUyhi+aDkPAJN/gXqYeS5kCTg1ear az3Q== X-Gm-Message-State: APjAAAU8okqIzQ7jUZDDiUAeM9dXULn8eQgDlIXeIytfgqwBSLL2D0D9 WzUYtHSsU1jdfOHXMgA/jirDwMkt3WXtEzVCzkJAur00OyGgrG8zSwWxPbx15aXrG6sF2wPI6cq 2WLV3v1E5ExNXhCDrJRDuQCLopxnqkTMJP7YTMtNwnV9n8LPabIQo5p5dPUwkmR9gfUYzgdAvQL 23FFGnhHckl4+IPOAh0fC5 X-Google-Smtp-Source: APXvYqz6MCTjFFtgVtanja47p/VlkREzdW0iIYlzsNC7OZwVIkoa0TxaE8PGhw8T2mQmoSoOysHNnw== X-Received: by 2002:a62:575b:: with SMTP id l88mr42053149pfb.143.1557248830031; Tue, 07 May 2019 10:07:10 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.07.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:09 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 17/21] megaraid_sas: Add prints in suspend and resume path Date: Tue, 7 May 2019 10:05:46 -0700 Message-Id: <1557248750-4099-18-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add prints in resume/suspend path to help in debugging hibernation issues. The print gives an indication when the driver entry points are called. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 4689909fa66b..b40702e30e49 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7244,6 +7244,8 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) host = instance->host; instance->unload = 1; + dev_info(&pdev->dev, "%s is called\n", __func__); + /* Shutdown SR-IOV heartbeat timer */ if (instance->requestorId && !instance->skip_heartbeat_timer_del) del_timer_sync(&instance->sriov_heartbeat_timer); @@ -7298,6 +7300,7 @@ megasas_resume(struct pci_dev *pdev) pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); + dev_info(&pdev->dev, "%s is called\n", __func__); /* * PCI prepping: enable device set bus mastering and dma mask */ From patchwork Tue May 7 17:05:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 046201398 for ; Tue, 7 May 2019 17:07:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDEF9288BC for ; Tue, 7 May 2019 17:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D235C288C6; Tue, 7 May 2019 17:07:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 60FE9288BC for ; Tue, 7 May 2019 17:07:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727230AbfEGRHP (ORCPT ); Tue, 7 May 2019 13:07:15 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42387 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHO (ORCPT ); Tue, 7 May 2019 13:07:14 -0400 Received: by mail-pf1-f195.google.com with SMTP id 13so8664194pfw.9 for ; Tue, 07 May 2019 10:07:14 -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=6T7C4DHZfs5d/tAliVqBd8MYVdXzJSegSHZ8GtbFr3M=; b=QpIOQksvuJYEmYH30FYUszi1mg+s4iBb2r2sSkTuWjVcHb5EmJD0ru1KwCfwh3i7RK ZYrQcuo2wphFa/Bpc6dUsV2hb7a52hq5OkcWwcgN81HdgVAY1Z+draJhSPwmfZoJjEdI LsN2Fh09PLRTz8SB321bL/06B8+sou4OHLPNw= 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=6T7C4DHZfs5d/tAliVqBd8MYVdXzJSegSHZ8GtbFr3M=; b=Ig+digsuwSe/3LxsIgJ/AhNoHsn4OkZoZGhQnYl5cUqnUvvBIGL8X8Fg7JMP0NIBhb sq4qTBzCmbb1pyac1yFLO1v2HxCngCOTsjslGtOUMkLAE+C143VX/Pu+bzUr/t3aZbgD 57xAtUQjP0TkV1fbeZHTmmlxWgY9vpHE4sBqLzulmsZojl+DpjLzrbUuW5HF5DLO0wxU 0l7yTKlnAajs50JAAaIIwQXGEzaDlpwRMlg/sx/CrlgUyJSqB0jtx0ZoG+GRBOF5PeJX 8ddSahicGNJXAnx0CY5gTuupMmPoLLXAzIDDA6FZuoGR2E1g5lAPZygdbAp6RbMIUEi2 s91Q== X-Gm-Message-State: APjAAAX8v2sn2eLJeQd6xh/rSO3z4h9s7M3CyQAV9U0hOUlhp66kd9GI oYylt9d1qG8R5lcYJlak3yVFH7yFUo1nMWDK4JSuruXOe7KrC/AB9Tr6+ReeC+d7isMwcWYzHEX Z695QduqfAzfujutWhDSVW9yK4Sw+b07E4moAsHs5hcFbjhZbpU3xgFWANUbETMGHxInnKFbGQP Wm++BtnodBb67XeqgZwiIZ X-Google-Smtp-Source: APXvYqxfrgNfnZWM+SxHIrbaTkUy0QITafpCvyzXCpz59hnXndcBDybpJ91H8AJBjVXYZxaQ4MhZ6g== X-Received: by 2002:a65:4144:: with SMTP id x4mr41585145pgp.282.1557248833484; Tue, 07 May 2019 10:07:13 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.07.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:12 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 18/21] megaraid_sas: Add debug prints for device list Date: Tue, 7 May 2019 10:05:47 -0700 Message-Id: <1557248750-4099-19-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Add debug prints related to device list being returned by firmware. The a debug flag to activate these prints. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 35 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 8df6ef01785e..840506f2f33c 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1499,6 +1499,7 @@ struct megasas_ctrl_info { /* Driver's internal Logging levels*/ #define OCR_DEBUG (1 << 0) #define TM_DEBUG (1 << 1) +#define LD_PD_DEBUG (1 << 2) #define SCAN_PD_CHANNEL 0x1 #define SCAN_VD_CHANNEL 0x2 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index b40702e30e49..b9893f8ccf4d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4512,6 +4512,9 @@ megasas_get_pd_list(struct megasas_instance *instance) case DCMD_SUCCESS: pd_addr = ci->addr; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, sysPD count: 0x%x\n", + __func__, le32_to_cpu(ci->count)); if ((le32_to_cpu(ci->count) > (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) @@ -4527,6 +4530,11 @@ megasas_get_pd_list(struct megasas_instance *instance) pd_addr->scsiDevType; instance->local_pd_list[le16_to_cpu(pd_addr->deviceId)].driveState = MR_PD_STATE_SYSTEM; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "PD%d: targetID: 0x%03x deviceType:0x%x\n", + pd_index, le16_to_cpu(pd_addr->deviceId), + pd_addr->scsiDevType); pd_addr++; } @@ -4630,6 +4638,10 @@ megasas_get_ld_list(struct megasas_instance *instance) break; case DCMD_SUCCESS: + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, LD count: 0x%x\n", + __func__, ld_count); + if (ld_count > instance->fw_supported_vd_count) break; @@ -4639,6 +4651,10 @@ megasas_get_ld_list(struct megasas_instance *instance) if (ci->ldList[ld_index].state != 0) { ids = ci->ldList[ld_index].ref.targetId; instance->ld_ids[ids] = ci->ldList[ld_index].ref.targetId; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "LD%d: targetID: 0x%03x\n", + ld_index, ids); } } @@ -4742,6 +4758,10 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type) case DCMD_SUCCESS: tgtid_count = le32_to_cpu(ci->count); + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, LD count: 0x%x\n", + __func__, tgtid_count); + if ((tgtid_count > (instance->fw_supported_vd_count))) break; @@ -4749,6 +4769,9 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type) for (ld_index = 0; ld_index < tgtid_count; ld_index++) { ids = ci->targetId[ld_index]; instance->ld_ids[ids] = ci->targetId[ld_index]; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "LD%d: targetID: 0x%03x\n", + ld_index, ci->targetId[ld_index]); } break; @@ -4828,6 +4851,10 @@ megasas_host_device_list_query(struct megasas_instance *instance, */ count = le32_to_cpu(ci->count); + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, Device count: 0x%x\n", + __func__, count); + memset(instance->local_pd_list, 0, MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)); memset(instance->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT); @@ -4839,8 +4866,16 @@ megasas_host_device_list_query(struct megasas_instance *instance, ci->host_device_list[i].scsi_type; instance->local_pd_list[target_id].driveState = MR_PD_STATE_SYSTEM; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "Device %d: PD targetID: 0x%03x deviceType:0x%x\n", + i, target_id, ci->host_device_list[i].scsi_type); } else { instance->ld_ids[target_id] = target_id; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "Device %d: LD targetID: 0x%03x\n", + i, target_id); } } From patchwork Tue May 7 17:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEEBF933 for ; Tue, 7 May 2019 17:07:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96A5C288BC for ; Tue, 7 May 2019 17:07:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AF04288C6; Tue, 7 May 2019 17:07:19 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 32173288BC for ; Tue, 7 May 2019 17:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727340AbfEGRHT (ORCPT ); Tue, 7 May 2019 13:07:19 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42013 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHS (ORCPT ); Tue, 7 May 2019 13:07:18 -0400 Received: by mail-pg1-f194.google.com with SMTP id p6so8604854pgh.9 for ; Tue, 07 May 2019 10:07:18 -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=ACa/EqKVFsP5vrr7LtpumR+GacpoYOGUx7Xl18mbF94=; b=FG6QobRrnJU+PqgfMN9CAtupZd1ToAEyLpCXRjqJymTuxPiB3Fnd57bprujsowKwow BZ7YH/XmZtEupSOlUt8r7uXqfmPw8ySWW+dpntPDKE2qTrlQTiCoPufj042Vw3RCIDhF +ApXnYfC6ldJXut+7jVT23cmXsY0JcyIUJwbs= 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=ACa/EqKVFsP5vrr7LtpumR+GacpoYOGUx7Xl18mbF94=; b=WLWkYPjs/U4RxkeKIp+8pC9lljTWCCEfD0XIJ4Cfi5b8iYf76Ah6nnswekRqKhtq4W 70KcBU5D39kIIRSwtm1oIdeg2FIzD+OHWsWqJ5N0n0s1G0kMxZL9qgIgmEYvB4z73IpF KkzSA4K/E+2e0OKi2YLc0btgvRQ0h9knMgqT5VEQtcdlp2D/JyWJDQbtvdLvguv29nE1 4NSDMZV2/lXQy58uiIWx6OfHEavhAveegz5tPXeG0HKAWuikdPwYt4H6UE55c3RUIGQj KGjQHyjcVjfKsCLxK8/0Zt/KUh3AiIZqykY3iw+d/Gh67CMhG4XquaRz7oIV+cWP7mkK 7rrQ== X-Gm-Message-State: APjAAAV8NHOI/YpiY0gNi5X+eXuWT/yjAuguCcDwcXz0S5eYJjruh8i6 BaliWVSf0vVxgk/18W7CZqyoye7/ebFLA0ZlmmL5304K4+Zz1hIK2NZIxy7pfGWHd5WC1E9mz7c zakB88zD/fNscg5CHGcXzf3H54M4tSWZfSiejwZ1erZPL8YGCAETsFv36oMUgcgA5nYHuqDTd6j 8SYCSywAk1s4v2/U2JcKHq X-Google-Smtp-Source: APXvYqykaGVUi63gNYuu0HmHgVcf7xwaRUdhFu57okiVDeB2ZaHrf6fHM+GCqFZnxLrBqmml3Jhk0g== X-Received: by 2002:a63:5d3:: with SMTP id 202mr39595214pgf.363.1557248837696; Tue, 07 May 2019 10:07:17 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.07.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:16 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 19/21] megaraid_sas: Fix MSI-x vector print Date: Tue, 7 May 2019 10:05:48 -0700 Message-Id: <1557248750-4099-20-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Print FW supported MSI-x vector count only if FW supports MSI-x. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index b9893f8ccf4d..5f7842982d57 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5681,7 +5681,7 @@ static int megasas_init_fw(struct megasas_instance *instance) void *base_addr_phys; struct megasas_ctrl_info *ctrl_info = NULL; unsigned long bar_list; - int i, j, loop, fw_msix_count = 0; + int i, j, loop; struct IOV_111 *iovPtr; struct fusion_context *fusion; @@ -5802,7 +5802,6 @@ static int megasas_init_fw(struct megasas_instance *instance) /* Thunderbolt Series*/ instance->msix_vectors = (scratch_pad_1 & MR_MAX_REPLY_QUEUES_OFFSET) + 1; - fw_msix_count = instance->msix_vectors; } else { instance->msix_vectors = ((scratch_pad_1 & MR_MAX_REPLY_QUEUES_EXT_OFFSET) @@ -5837,7 +5836,6 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->smp_affinity_enable = false; } - fw_msix_count = instance->msix_vectors; /* Save 1-15 reply post index address to local memory * Index 0 is already saved from reg offset * MPI2_REPLY_POST_HOST_INDEX_OFFSET @@ -5850,6 +5848,10 @@ static int megasas_init_fw(struct megasas_instance *instance) + (loop * 0x10)); } } + + dev_info(&instance->pdev->dev, + "firmware supports msix\t: (%d)", + instance->msix_vectors); if (msix_vectors) instance->msix_vectors = min(msix_vectors, instance->msix_vectors); @@ -5892,8 +5894,6 @@ static int megasas_init_fw(struct megasas_instance *instance) megasas_setup_reply_map(instance); - dev_info(&instance->pdev->dev, - "firmware supports msix\t: (%d)", fw_msix_count); dev_info(&instance->pdev->dev, "current msix/online cpus\t: (%d/%d)\n", instance->msix_vectors, (unsigned int)num_online_cpus()); From patchwork Tue May 7 17:05:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1763C1398 for ; Tue, 7 May 2019 17:07:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F32F0288BC for ; Tue, 7 May 2019 17:07:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7B38288C6; Tue, 7 May 2019 17:07:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 2672E288BC for ; Tue, 7 May 2019 17:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727342AbfEGRHW (ORCPT ); Tue, 7 May 2019 13:07:22 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46945 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRHW (ORCPT ); Tue, 7 May 2019 13:07:22 -0400 Received: by mail-pg1-f196.google.com with SMTP id t187so4492020pgb.13 for ; Tue, 07 May 2019 10:07:22 -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=mjBm/G9jb/ie0LFa0cAX5VBnmTMZLp5bHfBrb3mYO14=; b=KMTZHSvV/RJNwJh+rRWpXTGujaoigfAUanUO8V4wx75daz9jgXgqRZECB2rCF8l64r ecE94jcww5sF30jBMbo4rU9dSdUXsm/mlb/MQItT/X7kW01b9+mdVk3fTvP5UwtS0iCL 6+6UloVeE/fwmSOz7AwnFUZxWll7wjpERWlQ4= 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=mjBm/G9jb/ie0LFa0cAX5VBnmTMZLp5bHfBrb3mYO14=; b=BUXNgOABqglSzSQXAvpycOjwVFE1C54TliEIWT4GuZXpK/8lL9IMp4sS8iRN6QE1iF ke1FQZdNANEEomUb6xdpbhRRhotdIyCyUksiodEeJNu46C/jpmFOrdcXdEv7jOQXeZdT P2L/kZ6jarUJKGfWpCxisszfVcuLtAaXS130Fmm942sMUSlRKqwwOQ6eySTRcNB013K5 enWA+TVzZS2GgfRgJvPYYy/EGazOQIHAbRpd64yQxfB/x4/rrEcXHbBoIfIXZLh2LQCC aXvsqmVMykMlWIa/ptiPBRlGs0jJL4cbIa8YcOrAsJq3UEjVhAtfrB+qVI+iz/vkWdfr 64LA== X-Gm-Message-State: APjAAAVQcrynOmASizO5SsoXD82oGDzEJ8swiP7Ppw3Ad2IkvMn+m3YI GZ+PeSg7ZTB+1cbnkjS3qN/RoxHGxJm+H4H2rk8I+AOrYOm0covAuVClqNNPiGquS7FdBOB3Tle +JM83xu64bPHfpQ7VxoDLVGoaRJNepgPuoQgOLpeNeOgV4zTR/CJdI6w66Yfx5ZJnTKDoFrO0ar gKP0TcLWeF/xRdlLIFajvV X-Google-Smtp-Source: APXvYqzGiymFnknoimUywxRBuXbgY49Q6GOwIbxKJXymyiX4PyDsDvKJ9SBiwdQIwctaAO/0rpfMCg== X-Received: by 2002:a65:64d3:: with SMTP id t19mr41292709pgv.57.1557248841218; Tue, 07 May 2019 10:07:21 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.07.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:20 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 20/21] megaraid_sas: Export RAID map through debugfs Date: Tue, 7 May 2019 10:05:49 -0700 Message-Id: <1557248750-4099-21-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Create a debugfs interface for megaraid_sas driver. Provide interface to dump driver RAID map in debugfs. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/Makefile | 2 +- drivers/scsi/megaraid/megaraid_sas.h | 4 + drivers/scsi/megaraid/megaraid_sas_base.c | 14 +++ drivers/scsi/megaraid/megaraid_sas_debugfs.c | 180 +++++++++++++++++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 5 + 5 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 drivers/scsi/megaraid/megaraid_sas_debugfs.c diff --git a/drivers/scsi/megaraid/Makefile b/drivers/scsi/megaraid/Makefile index 6e74d21227a5..12177e4cae65 100644 --- a/drivers/scsi/megaraid/Makefile +++ b/drivers/scsi/megaraid/Makefile @@ -3,4 +3,4 @@ obj-$(CONFIG_MEGARAID_MM) += megaraid_mm.o obj-$(CONFIG_MEGARAID_MAILBOX) += megaraid_mbox.o obj-$(CONFIG_MEGARAID_SAS) += megaraid_sas.o megaraid_sas-objs := megaraid_sas_base.o megaraid_sas_fusion.o \ - megaraid_sas_fp.o + megaraid_sas_fp.o megaraid_sas_debugfs.o diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 840506f2f33c..56b3204d3fc6 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2390,6 +2390,10 @@ struct megasas_instance { u8 task_abort_tmo; u8 max_reset_tmo; u8 snapdump_wait_time; +#ifdef CONFIG_DEBUG_FS + struct dentry *debugfs_root; + struct dentry *raidmap_dump; +#endif u8 enable_fw_dev_list; }; struct MR_LD_VF_MAP { diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5f7842982d57..1006364ce0d0 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -188,6 +188,12 @@ static bool support_nvme_encapsulation; /* define lock for aen poll */ spinlock_t poll_aen_lock; +extern struct dentry *megasas_debugfs_root; +extern void megasas_init_debugfs(void); +extern void megasas_exit_debugfs(void); +extern void megasas_setup_debugfs(struct megasas_instance *instance); +extern void megasas_destroy_debugfs(struct megasas_instance *instance); + void megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, u8 alt_status); @@ -7141,6 +7147,8 @@ static int megasas_probe_one(struct pci_dev *pdev, goto fail_start_aen; } + megasas_setup_debugfs(instance); + /* Get current SR-IOV LD/VF affiliation */ if (instance->requestorId) megasas_get_ld_vf_affiliation(instance, 1); @@ -7611,6 +7619,8 @@ static void megasas_detach_one(struct pci_dev *pdev) megasas_free_ctrl_mem(instance); + megasas_destroy_debugfs(instance); + scsi_host_put(host); pci_disable_device(pdev); @@ -8538,6 +8548,8 @@ static int __init megasas_init(void) megasas_mgmt_majorno = rval; + megasas_init_debugfs(); + /* * Register ourselves as PCI hotplug module */ @@ -8597,6 +8609,7 @@ static int __init megasas_init(void) err_dcf_attr_ver: pci_unregister_driver(&megasas_pci_driver); err_pcidrv: + megasas_exit_debugfs(); unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); return rval; } @@ -8619,6 +8632,7 @@ static void __exit megasas_exit(void) &driver_attr_support_nvme_encapsulation); pci_unregister_driver(&megasas_pci_driver); + megasas_exit_debugfs(); unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } diff --git a/drivers/scsi/megaraid/megaraid_sas_debugfs.c b/drivers/scsi/megaraid/megaraid_sas_debugfs.c new file mode 100644 index 000000000000..e52837bb6807 --- /dev/null +++ b/drivers/scsi/megaraid/megaraid_sas_debugfs.c @@ -0,0 +1,180 @@ +/* + * Linux MegaRAID driver for SAS based RAID controllers + * + * Copyright (c) 2003-2018 LSI Corporation. + * Copyright (c) 2003-2018 Avago Technologies. + * Copyright (c) 2003-2018 Broadcom Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: Broadcom Inc. + * Kashyap Desai + * Sumit Saxena + * Shivasharan S + * + * Send feedback to: megaraidlinux.pdl@broadcom.com + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "megaraid_sas_fusion.h" +#include "megaraid_sas.h" + +#ifdef CONFIG_DEBUG_FS +#include + +struct dentry *megasas_debugfs_root; + +static ssize_t +megasas_debugfs_read(struct file *filp, char __user *ubuf, size_t cnt, + loff_t *ppos) +{ + struct megasas_debugfs_buffer *debug = filp->private_data; + + if (!debug || !debug->buf) + return 0; + + return simple_read_from_buffer(ubuf, cnt, ppos, debug->buf, debug->len); +} + +static int +megasas_debugfs_raidmap_open(struct inode *inode, struct file *file) +{ + struct megasas_instance *instance = inode->i_private; + struct megasas_debugfs_buffer *debug; + struct fusion_context *fusion; + + fusion = instance->ctrl_context; + + debug = kzalloc(sizeof(struct megasas_debugfs_buffer), GFP_KERNEL); + if (!debug) + return -ENOMEM; + + debug->buf = (void *)fusion->ld_drv_map[(instance->map_id & 1)]; + debug->len = fusion->drv_map_sz; + file->private_data = debug; + + return 0; +} + +static int +megasas_debugfs_release(struct inode *inode, struct file *file) +{ + struct megasas_debug_buffer *debug = file->private_data; + + if (!debug) + return 0; + + file->private_data = NULL; + kfree(debug); + return 0; +} + +static const struct file_operations megasas_debugfs_raidmap_fops = { + .owner = THIS_MODULE, + .open = megasas_debugfs_raidmap_open, + .read = megasas_debugfs_read, + .release = megasas_debugfs_release, +}; + +/* + * megasas_init_debugfs : Create debugfs root for megaraid_sas driver + */ +void megasas_init_debugfs(void) +{ + megasas_debugfs_root = debugfs_create_dir("megaraid_sas", NULL); + if (!megasas_debugfs_root) + pr_info("Cannot create debugfs root\n"); +} + +/* + * megasas_exit_debugfs : Remove debugfs root for megaraid_sas driver + */ +void megasas_exit_debugfs(void) +{ + debugfs_remove_recursive(megasas_debugfs_root); +} + +/* + * megasas_setup_debugfs : Setup debugfs per Fusion adapter + * instance: Soft instance of adapter + */ +void +megasas_setup_debugfs(struct megasas_instance *instance) +{ + char name[64]; + struct fusion_context *fusion; + + fusion = instance->ctrl_context; + + if (fusion) { + snprintf(name, sizeof(name), + "scsi_host%d", instance->host->host_no); + if (!instance->debugfs_root) { + instance->debugfs_root = + debugfs_create_dir(name, megasas_debugfs_root); + if (!instance->debugfs_root) { + dev_err(&instance->pdev->dev, + "Cannot create per adapter debugfs directory\n"); + return; + } + } + + snprintf(name, sizeof(name), "raidmap_dump"); + instance->raidmap_dump = + debugfs_create_file(name, S_IRUGO, + instance->debugfs_root, instance, + &megasas_debugfs_raidmap_fops); + if (!instance->raidmap_dump) { + dev_err(&instance->pdev->dev, + "Cannot create raidmap debugfs file\n"); + debugfs_remove(instance->debugfs_root); + return; + } + } + +} + +/* + * megasas_destroy_debugfs : Destroy debugfs per Fusion adapter + * instance: Soft instance of adapter + */ +void megasas_destroy_debugfs(struct megasas_instance *instance) +{ + debugfs_remove_recursive(instance->debugfs_root); +} + +#else +void megasas_init_debugfs(void) +{ +} +void megasas_exit_debugfs(void) +{ +} +void megasas_setup_debugfs(struct megasas_instance *instance) +{ +} +void megasas_destroy_debugfs(struct megasas_instance *instance) +{ +} +#endif /*CONFIG_DEBUG_FS*/ diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 160ac16941fe..98738290c533 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -1360,6 +1360,11 @@ struct MR_SNAPDUMP_PROPERTIES { u8 reserved[12]; }; +struct megasas_debugfs_buffer { + void *buf; + u32 len; +}; + void megasas_free_cmds_fusion(struct megasas_instance *instance); int megasas_ioc_init_fusion(struct megasas_instance *instance); u8 megasas_get_map_info(struct megasas_instance *instance); From patchwork Tue May 7 17:05:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10933449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11C011398 for ; Tue, 7 May 2019 17:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF4A0288BC for ; Tue, 7 May 2019 17:07:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3F59288C6; Tue, 7 May 2019 17:07:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 73943288BC for ; Tue, 7 May 2019 17:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727350AbfEGRH0 (ORCPT ); Tue, 7 May 2019 13:07:26 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43143 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbfEGRH0 (ORCPT ); Tue, 7 May 2019 13:07:26 -0400 Received: by mail-pf1-f196.google.com with SMTP id c6so3769622pfa.10 for ; Tue, 07 May 2019 10:07:25 -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=4z2u4bzz9iAHqXSwhW/gdsQ9hBMNYvHh74EOpQ3IDEw=; b=f/1kVZ38I1V3jEaUJquoMGU+8VWaqHwuHYIvoPvttFGhoB8EJfsRjsalbpAGNFfhPZ 1+aO/2umqmXWefUiUuOzGQHM029b3fijICa2DwRabRebzr8gBFGCZ9yJGK94Y+D+66Es 5Cl8WpsszKk3kWa5OXr8aq92PIpOjfHkAkP1Y= 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=4z2u4bzz9iAHqXSwhW/gdsQ9hBMNYvHh74EOpQ3IDEw=; b=m5Mr49Rc4NqeYaq+TIJ/PKKWQkmpKEtMkgQzHrHlnZYzXsVJa4g33SG4WO7gBJ+13q ErGy1T5LJe6lfbaAt6NY6SF3uVv7kJZtkcvVdGnzP1R5Ah9gDZQU2CxQeHMWeD/QtLC+ UoZoGwE3SUNIZ6yl+/7fhyIQuJkMLEity/343tfKVc4+VFQsCgKCqgf90LU/yDbnSIH+ IkSjC3C4xGLq9nREnURIFfMJlmxyVUug2akkJh1ZXvM70S7lXpcbYG4GDEUMl+KXVGwN wUSlP6BeyNOmpSJcHm5J2nFASIX/e5Cb1pooMeMsbHess022lQ4PsrNqJh2Mi+WNUwbT D3oQ== X-Gm-Message-State: APjAAAWa2qnDRvTw3sQRLDrGpATeimXyTWG3Tf4PtGYW2tKKIWTG0kGA VcFhaV2tcNRhvAtwY9dx1WEL6XvvOk1YUc/6Kkt8QaY1XB4nBLEQQjrpbpHjJeUo4FFcn/d5OAj E4MG6yFha8dQp3eEGAn4wTKJ6qh/+IfaBJJD/iC5+XXN19v77koSNiWHBLzZdSEg/atf4nJDCTp qlwSlnFmITHNkDyReAIdjv X-Google-Smtp-Source: APXvYqwI0pB/QQFDvD8gHjCN81aRF1xZOr/tqyoaLZfF4uGahdDE5gaZ9e+8R8tP9wfbUd8Iqr2sZg== X-Received: by 2002:a62:f245:: with SMTP id y5mr42333584pfl.12.1557248844651; Tue, 07 May 2019 10:07:24 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r74sm17527791pfa.71.2019.05.07.10.07.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 10:07:23 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, Shivasharan S Subject: [PATCH v2 21/21] megaraid_sas: Update driver version to 07.708.03.00 Date: Tue, 7 May 2019 10:05:50 -0700 Message-Id: <1557248750-4099-22-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1557248750-4099-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1557248750-4099-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 Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 56b3204d3fc6..e138d1447e43 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -33,8 +33,8 @@ /* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION "07.707.51.00-rc1" -#define MEGASAS_RELDATE "February 7, 2019" +#define MEGASAS_VERSION "07.708.03.00-rc1" +#define MEGASAS_RELDATE "March 14, 2019" /* * Device IDs