From patchwork Tue Sep 14 10:55:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 512701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD53EC4332F for ; Tue, 14 Sep 2021 10:55:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4034610FB for ; Tue, 14 Sep 2021 10:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbhINK5L (ORCPT ); Tue, 14 Sep 2021 06:57:11 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:42346 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231732AbhINK5H (ORCPT ); Tue, 14 Sep 2021 06:57:07 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id C85A941E83; Tue, 14 Sep 2021 10:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1631616947; x=1633431348; bh=3uof/WYmN8pkogEl14wt0VHVbH++rlYsqbL vT+pPh+U=; b=EshRlj22/tXAXW+WiQz3zdpYbykbbips2HgoRt+UzF9m2bAfTn2 YtAqGFIyWOZYu5e87Q0iP7O/vQmUzIHm6mI5XSgoIwCouZ2U0HZhoRNAeg0Oq4P/ TfjwaIYdHgKwMyy+l9ngvEuV2G0xTnUgP8R+PYgBYG7gHN8qw9DDT/uI= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qytEVc-o97Xg; Tue, 14 Sep 2021 13:55:47 +0300 (MSK) Received: from T-EXCH-04.corp.yadro.com (t-exch-04.corp.yadro.com [172.17.100.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id DD93141E95; Tue, 14 Sep 2021 13:55:47 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.0.9) by T-EXCH-04.corp.yadro.com (172.17.100.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Tue, 14 Sep 2021 13:55:46 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: , , James Smart , Dmitry Bogdanov Subject: [PATCH 1/3] scsi: efct: add state in nport sm trace printout Date: Tue, 14 Sep 2021 13:55:37 +0300 Message-ID: <20210914105539.6942-2-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210914105539.6942-1-d.bogdanov@yadro.com> References: <20210914105539.6942-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.0.9] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-04.corp.yadro.com (172.17.100.104) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Similar to other state machine traces and to make debug easier add the state name to nport sm trace printout. Signed-off-by: Dmitry Bogdanov --- drivers/scsi/elx/libefc/efc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/elx/libefc/efc.h b/drivers/scsi/elx/libefc/efc.h index 927016283f41..468ff3cc9c00 100644 --- a/drivers/scsi/elx/libefc/efc.h +++ b/drivers/scsi/elx/libefc/efc.h @@ -47,6 +47,6 @@ enum efc_scsi_del_target_reason { #define nport_sm_trace(nport) \ efc_log_debug(nport->efc, \ - "[%s] %-20s\n", nport->display_name, efc_sm_event_name(evt)) \ + "[%s] %-20s %-20s\n", nport->display_name, __func__, efc_sm_event_name(evt)) \ #endif /* __EFC_H__ */ From patchwork Tue Sep 14 10:55:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 512700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8982C433F5 for ; Tue, 14 Sep 2021 10:55:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACB5961107 for ; Tue, 14 Sep 2021 10:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231975AbhINK5N (ORCPT ); Tue, 14 Sep 2021 06:57:13 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:42366 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231938AbhINK5I (ORCPT ); Tue, 14 Sep 2021 06:57:08 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id D8DBA41EC4; Tue, 14 Sep 2021 10:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1631616948; x=1633431349; bh=zTLGgES6oKEQKMMqAUGCsoKTd4sVMY3wPb2 26/A9TeA=; b=GPJCkKLHSE5F3WXu3GIG2mw8e8y2Wwg7tAbN2vggoqArs9UpO5q nI2G1DojE8h/njHg5TrxgjOvwvtipNuT5DcoMXzrtnGbkM/FbdSf7U8VBfGfJqEj Cb43qnlHyBHT7Uy+V9z/Nl2WKD/YdlfOpASxXucPy50+lg1WgnGvInX8= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n_Awqr-nv2Ha; Tue, 14 Sep 2021 13:55:48 +0300 (MSK) Received: from T-EXCH-04.corp.yadro.com (t-exch-04.corp.yadro.com [172.17.100.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 23A0C41ECB; Tue, 14 Sep 2021 13:55:48 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.0.9) by T-EXCH-04.corp.yadro.com (172.17.100.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Tue, 14 Sep 2021 13:55:47 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: , , James Smart , Dmitry Bogdanov Subject: [PATCH 2/3] scsi: efct: fix nport free Date: Tue, 14 Sep 2021 13:55:38 +0300 Message-ID: <20210914105539.6942-3-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210914105539.6942-1-d.bogdanov@yadro.com> References: <20210914105539.6942-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.0.9] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-04.corp.yadro.com (172.17.100.104) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org nport_free for an empty nport hangs the state machine waiting for mbox completion if nport is not yet attached thinking that it is attaching right now. Add a check for nport attaching state and complete nport free. Signed-off-by: Dmitry Bogdanov Reviewed-by: Ram Vegesna --- drivers/scsi/elx/libefc/efc_cmds.c | 7 ++++++- drivers/scsi/elx/libefc/efclib.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/elx/libefc/efc_cmds.c b/drivers/scsi/elx/libefc/efc_cmds.c index 37e6697d86b8..f8665d48904a 100644 --- a/drivers/scsi/elx/libefc/efc_cmds.c +++ b/drivers/scsi/elx/libefc/efc_cmds.c @@ -249,6 +249,7 @@ efc_nport_attach_reg_vpi_cb(struct efc *efc, int status, u8 *mqe, { struct efc_nport *nport = arg; + nport->attaching = false; if (efc_nport_get_mbox_status(nport, mqe, status)) { efc_nport_free_resources(nport, EFC_EVT_NPORT_ATTACH_FAIL, mqe); return -EIO; @@ -286,6 +287,8 @@ efc_cmd_nport_attach(struct efc *efc, struct efc_nport *nport, u32 fc_id) if (rc) { efc_log_err(efc, "REG_VPI command failure\n"); efc_nport_free_resources(nport, EFC_EVT_NPORT_ATTACH_FAIL, buf); + } else { + nport->attaching = true; } return rc; @@ -302,8 +305,10 @@ efc_cmd_nport_free(struct efc *efc, struct efc_nport *nport) /* Issue the UNREG_VPI command to free the assigned VPI context */ if (nport->attached) efc_nport_free_unreg_vpi(nport); - else + else if (nport->attaching) nport->free_req_pending = true; + else + efc_sm_post_event(&nport->sm, EFC_EVT_NPORT_FREE_OK, NULL); return 0; } diff --git a/drivers/scsi/elx/libefc/efclib.h b/drivers/scsi/elx/libefc/efclib.h index ee291cabf7e0..dde20891c2dd 100644 --- a/drivers/scsi/elx/libefc/efclib.h +++ b/drivers/scsi/elx/libefc/efclib.h @@ -142,6 +142,7 @@ struct efc_nport { bool is_vport; bool free_req_pending; bool attached; + bool attaching; bool p2p_winner; struct efc_domain *domain; u64 wwpn; From patchwork Tue Sep 14 10:55:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 511374 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D98FC433EF for ; Tue, 14 Sep 2021 10:55:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AFA0610FB for ; Tue, 14 Sep 2021 10:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231972AbhINK5M (ORCPT ); Tue, 14 Sep 2021 06:57:12 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:42358 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231849AbhINK5I (ORCPT ); Tue, 14 Sep 2021 06:57:08 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id C1C2F41EC9; Tue, 14 Sep 2021 10:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1631616948; x=1633431349; bh=blLD9pRpWmgUzJUdfSAValefXtQx1U3Sgue uthUrbVo=; b=Drl6I5IGWX0ZSOhWycnXhkNH4x60VrVUuYm2HE/2n7yo1DsXgOa 2HZWdIzrCVczOlD+rsAyvFlwaSslxpmE+EqVUNJV88j38SCmsw6Ljzy5SMOY45Xy 8Rv7tw9yHjdb0nhvem4s/5H0/0+s2dtAngRbI29p7maiDQdph1YDms8o= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B0uhCGR3oU1a; Tue, 14 Sep 2021 13:55:48 +0300 (MSK) Received: from T-EXCH-04.corp.yadro.com (t-exch-04.corp.yadro.com [172.17.100.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 75EB341EC5; Tue, 14 Sep 2021 13:55:48 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.0.9) by T-EXCH-04.corp.yadro.com (172.17.100.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Tue, 14 Sep 2021 13:55:47 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: , , James Smart , Dmitry Bogdanov , Roman Bolshakov Subject: [PATCH 3/3] scsi: efct: decrease area under spinlock Date: Tue, 14 Sep 2021 13:55:39 +0300 Message-ID: <20210914105539.6942-4-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210914105539.6942-1-d.bogdanov@yadro.com> References: <20210914105539.6942-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.0.9] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-04.corp.yadro.com (172.17.100.104) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Under session level spinlock node->active_ios_lock in efct_scsi_io_alloc() there is a getting other spinlock of port level. That lead to competition between sessions and even between IOs in the same session due too much instructions under spinlock. This change reduces spinlock area just to active_ios list for which active_ios_lock is intended. Spinlock CPU usage is decreased from 18% down to 13% in efct driver. IOPS are increased from 220 kIOPS upto 264 kIOPS for one lun on my setup. Reviewed-by: Roman Bolshakov Signed-off-by: Dmitry Bogdanov Reviewed-by: Ram Vegesna --- drivers/scsi/elx/efct/efct_scsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_scsi.c b/drivers/scsi/elx/efct/efct_scsi.c index 40fb3a724c76..8535bb7eabd8 100644 --- a/drivers/scsi/elx/efct/efct_scsi.c +++ b/drivers/scsi/elx/efct/efct_scsi.c @@ -38,8 +38,6 @@ efct_scsi_io_alloc(struct efct_node *node) xport = efct->xport; - spin_lock_irqsave(&node->active_ios_lock, flags); - io = efct_io_pool_io_alloc(efct->xport->io_pool); if (!io) { efc_log_err(efct, "IO alloc Failed\n"); @@ -66,6 +64,7 @@ efct_scsi_io_alloc(struct efct_node *node) /* Add to node's active_ios list */ INIT_LIST_HEAD(&io->list_entry); + spin_lock_irqsave(&node->active_ios_lock, flags); list_add(&io->list_entry, &node->active_ios); spin_unlock_irqrestore(&node->active_ios_lock, flags);