From patchwork Tue Aug 11 00:07:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 6987011 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 93BCF9F373 for ; Tue, 11 Aug 2015 00:07:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 673372010C for ; Tue, 11 Aug 2015 00:07:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BEAE20595 for ; Tue, 11 Aug 2015 00:07:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933360AbbHKAHx (ORCPT ); Mon, 10 Aug 2015 20:07:53 -0400 Received: from mail-bl2on0099.outbound.protection.outlook.com ([65.55.169.99]:14944 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933067AbbHKAHw (ORCPT ); Mon, 10 Aug 2015 20:07:52 -0400 Received: from BY2PR02CA0044.namprd02.prod.outlook.com (10.141.216.34) by BN1PR0201MB0740.namprd02.prod.outlook.com (10.160.169.27) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 11 Aug 2015 00:07:49 +0000 Received: from BN1BFFO11OLC004.protection.gbl (2a01:111:f400:7c10::1:193) by BY2PR02CA0044.outlook.office365.com (2a01:111:e400:2c40::34) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 11 Aug 2015 00:07:49 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; obsidianresearch.com; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BN1BFFO11OLC004.mail.protection.outlook.com (10.58.145.15) with Microsoft SMTP Server id 15.1.243.9 via Frontend Transport; Tue, 11 Aug 2015 00:07:47 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id BC.EB.04667.2DC39C55; Mon, 10 Aug 2015 17:07:46 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.224.2; Mon, 10 Aug 2015 17:06:59 -0700 X-AuditID: ac160a68-f790b6d00000123b-eb-55c93cd2020d Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id AB.33.04661.2DC39C55; Mon, 10 Aug 2015 17:07:46 -0700 (PDT) Subject: [PATCH 4/8] IB/srp: Remove the memory registration backtracking code To: Jason Gunthorpe References: <55BBF4B8.2050700@sandisk.com> <20150803152420.GA24193@infradead.org> <55BFB40F.8000500@sandisk.com> <20150804180933.GB5038@obsidianresearch.com> <1438756876.5698.2.camel@haswell.thedillows.org> <20150805195122.GA31595@obsidianresearch.com> <55C2840C.5050301@sandisk.com> <55C2912A.50709@sandisk.com> <20150806001006.GD2483@obsidianresearch.com> <55C2A7FE.7020904@sandisk.com> <20150806043642.GA14153@obsidianresearch.com> <55C93C61.9010508@sandisk.com> CC: "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <55C93CD2.8050704@sandisk.com> Date: Mon, 10 Aug 2015 17:07:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55C93C61.9010508@sandisk.com> X-Brightmail-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kBJOAW2JxqmyEBPVJf7MuwQ1XV5i+9s5zBMY+Wch6ZiFpGwWkrIFjMyrGMVyM3OKc9Mz CwyN9IoT81Iyi7P1kvNzNzGCA48zagfj9YnmhxiZODilGhiVNbv/ver5slx87stIHt0Njbes DSY8e37L7pTyl8XHjlzo0U9nfrww4vg/3eqv/lU1R7wOc14r0bk/YeJMQ7aNTvm2hqJzpA+d d/zU3upolJ3c8/lGpe4sNpkKR6uFs2RWPzm6JDXqShVPefe9Ze88ytdobBFu6d8jdt9nchZX 88/7m/IvNW1QYinOSDTUYi4qTgQABGPA+ewBAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11OLC004; 1:0C9E91aMnnncg87Hm2PeS/vZACVtamMA8K2DVhiIVswog2ic3u5vMLOuwAd29EK+c4rj9J8uNrB0nbu2+D0ZZPOehg+NNIgyw+++bUmg+0hV0C7gRM7R9LSfqnS/TrwFMWeJm3EeDPQKsxlRAa9M7ihugMO5qVSgEa2aaOQ+EUm3MsGSSqJKOa0w+hj9V7pAu8UlsZSPIJ8OO+55+b57gXFOpMvL10GBqGS8Y2yxYsCyjjmdQoAOTJYXoM+k4nmXZjTa5XgmShOlquCjBNAMxeLnMD0B4Qti033wLtM6sWBEvNai5lvIAwNxdTZ5Cy8fAPTrTsHhvr1mUhofMs+2Fg== X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(3050300001)(199003)(189002)(68736005)(33656002)(2950100001)(62966003)(93886004)(77156002)(106466001)(36756003)(77096005)(92566002)(5001860100001)(229853001)(110136002)(189998001)(64126003)(47776003)(59896002)(4001540100001)(23676002)(65806001)(87266999)(76176999)(54356999)(64706001)(69596002)(86362001)(87936001)(65816999)(5001960100002)(83506001)(19580405001)(4001350100001)(81156007)(50986999)(19580395003)(5001830100001)(97736004)(46102003)(80316001)(50466002)(65956001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0740; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0740; 2:BS/0uaebEx8I66PF+7xsfuq8ZYJGoOdaeNI00vVAY+JBuTQtG4hzkkoaBX2x8RSY7zzDC4v/96ToMxN4nnwO2OVc/xE79oyjVnnFOMq4wmZEXY+dpOSKccXZCZKv1Y4qAWql+nnk+grOQasDeFRNyFUWwezwi4p0gcbA3oNST+k=; 3:DrvQqPFMNr1vYVLrH46UyPhJoDtzL+EF7c6mH4Z0mFfreWmht2V0PyKnENl6UjO5vC6rBs0+G5S93MJigGhaoArtqlSu2inbDYMsSGci3dauYN4hHCt8cz3q9pghASPxcwoeLrhq3L6mBopbRQCdK5jisOmTy5dJl4ncsW6eCpOZqTIJhLsPlxe9mgp3VA+qfu4RMSuhZEtcny7P3LqEpTdG2ctn5L4s5UaTOFN9Zci0CZrkjb2oexRdp0GXEk1T; 25:zS8mlHP6FPn0VHjGtMJwxzRq7vrC+TKpO+BlvM0HbgsR5vjAT7cQfYKvOnItiLZd/I0uaYXgSBQmcYrZas23/zS9H3Th/YMJLF6x64tO0CBP2V9/D4IiydD0SprtiSgxF71VdU6EKULA/a5poUUyU7MU7vYCve7E0158Nr1C9R9+iRTVVRasjLX95b+jVpsCVSp7+z+c9zHBbHS/VMAyFx+FWgLNmHiv+kn9DIjNfo4xDJminEAmfGHwlyEANBeN1xjk63Px5aIvewvQ4ST2cw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0201MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0740; 20:8DN/vgZicqA8zyp5OumVGkXQF8ZGCdFEHUWrznaUcc6sU4gymZTE5sEAUgz3meXuqAKswSJ1C1+OKebVdOGCbWjTPhXNpWCctuPaLUMG8pGXBA/Utn4AxZ/dA2b2PmMRzMVfNsbcY/v5siFKUC74T62+BdtNCpci4ZFdhXOLauSMkjI4VAn44ePpVFwi8VO1CG4L0BQ8jyFQ3xTjuigufM3X4eX10LJpv2WXaAFsL+lDTcArMzE6JRLQW0TshJ+PxLOoOhhMqvW0LeeuRFry7e2ptX6AofdTlF5o8/bReyOa5gxMb+vWn33zn24RlTh1pivGFjJgSaJIoqWnJ/E60b0Qafv3Yp5Aesz+0Nfdzmuwx+QTynJkjiiLueS8r24rLpxnOILrKYEAkS/ZA6YtI/7wN9fkbplh1Xuw39Gcjl3SvCgNSjKjHjwVo0hWDSNBJDqwoZdmGKSBjrOOe9h6w0Ri0MGitNUiFOMwiqLhRnJqsBh4ypV1Vv495BP4NO9E; 4:OCYBY/ghUpPnETTNsBhe1XS7RGerfOcc/elYvMiGrUptipq8tWcOHvsMJWSuUYhw8sSV/dcfBaahl42d8IPTrEorUAg3vNn7kYs6M4vg01zyUzz9aPYhYJ8Xpr/hVZuqhFV+cHo0OoyhJxJmo95n3vWjRkGildVWMXDe4Nm8HCQwJEp5Z+BjzNZq3IeNh63QqYRqhva9geI5aBTTAzYAiH6rHp0MXHgyNq+vzy3oM+W7nPrSSFl/cJhinxliZckLzcZHWWMNJFa2nAHigoP3oPRJn9glDmHOXIV1TxymAd0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN1PR0201MB0740; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0740; X-Forefront-PRVS: 066517B35B X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjFQUjAyMDFNQjA3NDA7MjM6VkdocWwzVG9HRnRiaFFaanVWQWZTN2Vm?= =?utf-8?B?ajVLa1hPOGx4SzByekNGbUNkTGtSem9qWDNnTGpEeG52M2wyRkxoeSs1eVRh?= =?utf-8?B?SEFDbXc5OE5PVkM3S1ZFWnlJbnB6eVArYWgrZExUeTdNeDE1UkxtN1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:cogUv2zClyNVbLCvBc7zCJ+jmGmjHe8rdaiOyfobyyrKeMdU5sPt//pOBqQ+RslqI18l6jxcqaS2gskffHquVzPxr4L1aZNLPMYh/nepVc8ZaQ9O+peWQxZWcEfVQvSEWoa23mlYKLwjobMrAN6KC3fQnNhT/u9x/GQa2p9A/qQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2015 00:07:47.5102 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0740 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Mapping a discontiguous sg-list requires multiple memory regions and hence can exhaust the memory region pool. The SRP initiator already handles this by temporarily reducing the queue depth. This means that it is safe to remove the memory registration backtracking code. This patch has been tested with direct I/O sizes up to 256 MB. Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srp/ib_srp.c | 62 ++++++++----------------------------- drivers/infiniband/ulp/srp/ib_srp.h | 6 ---- 2 files changed, 13 insertions(+), 55 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index f9fa220..660a4a4 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1364,15 +1364,6 @@ static int srp_finish_mapping(struct srp_map_state *state, return ret; } -static void srp_map_update_start(struct srp_map_state *state, - struct scatterlist *sg, int sg_index, - dma_addr_t dma_addr) -{ - state->unmapped_sg = sg; - state->unmapped_index = sg_index; - state->unmapped_addr = dma_addr; -} - static int srp_map_sg_entry(struct srp_map_state *state, struct srp_rdma_ch *ch, struct scatterlist *sg, int sg_index, @@ -1399,23 +1390,12 @@ static int srp_map_sg_entry(struct srp_map_state *state, return 0; } - /* - * If this is the first sg that will be mapped via FMR or via FR, save - * our position. We need to know the first unmapped entry, its index, - * and the first unmapped address within that entry to be able to - * restart mapping after an error. - */ - if (!state->unmapped_sg) - srp_map_update_start(state, sg, sg_index, dma_addr); - while (dma_len) { unsigned offset = dma_addr & ~dev->mr_page_mask; if (state->npages == dev->max_pages_per_mr || offset != 0) { ret = srp_finish_mapping(state, ch); if (ret) return ret; - - srp_map_update_start(state, sg, sg_index, dma_addr); } len = min_t(unsigned int, dma_len, dev->mr_page_size - offset); @@ -1434,11 +1414,8 @@ static int srp_map_sg_entry(struct srp_map_state *state, * boundaries. */ ret = 0; - if (len != dev->mr_page_size) { + if (len != dev->mr_page_size) ret = srp_finish_mapping(state, ch); - if (!ret) - srp_map_update_start(state, NULL, 0, 0); - } return ret; } @@ -1448,9 +1425,8 @@ static int srp_map_sg(struct srp_map_state *state, struct srp_rdma_ch *ch, { struct srp_target_port *target = ch->target; struct srp_device *dev = target->srp_host->srp_dev; - struct ib_device *ibdev = dev->dev; struct scatterlist *sg; - int i; + int i, ret; bool use_mr; state->desc = req->indirect_desc; @@ -1466,34 +1442,22 @@ static int srp_map_sg(struct srp_map_state *state, struct srp_rdma_ch *ch, } for_each_sg(scat, sg, count, i) { - if (srp_map_sg_entry(state, ch, sg, i, use_mr)) { - /* - * Memory registration failed, so backtrack to the - * first unmapped entry and continue on without using - * memory registration. - */ - dma_addr_t dma_addr; - unsigned int dma_len; - -backtrack: - sg = state->unmapped_sg; - i = state->unmapped_index; - - dma_addr = ib_sg_dma_address(ibdev, sg); - dma_len = ib_sg_dma_len(ibdev, sg); - dma_len -= (state->unmapped_addr - dma_addr); - dma_addr = state->unmapped_addr; - use_mr = false; - srp_map_desc(state, dma_addr, dma_len, target->rkey); - } + ret = srp_map_sg_entry(state, ch, sg, i, use_mr); + if (ret) + goto out; } - if (use_mr && srp_finish_mapping(state, ch)) - goto backtrack; + if (use_mr) { + ret = srp_finish_mapping(state, ch); + if (ret) + goto out; + } req->nmdesc = state->nmdesc; + ret = 0; - return 0; +out: + return ret; } static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 2ab73bc..1e42418 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -276,9 +276,6 @@ struct srp_fr_pool { * @npages: Number of page addresses in the pages[] array. * @nmdesc: Number of FMR or FR memory descriptors used for mapping. * @ndesc: Number of SRP buffer descriptors that have been filled in. - * @unmapped_sg: First element of the sg-list that is mapped via FMR or FR. - * @unmapped_index: Index of the first element mapped via FMR or FR. - * @unmapped_addr: DMA address of the first element mapped via FMR or FR. */ struct srp_map_state { union { @@ -299,9 +296,6 @@ struct srp_map_state { unsigned int npages; unsigned int nmdesc; unsigned int ndesc; - struct scatterlist *unmapped_sg; - int unmapped_index; - dma_addr_t unmapped_addr; }; #endif /* IB_SRP_H */