From patchwork Fri Apr 22 21:16:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 8915711 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 91D999F372 for ; Fri, 22 Apr 2016 21:16:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94B60201F2 for ; Fri, 22 Apr 2016 21:16:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 981E5201EF for ; Fri, 22 Apr 2016 21:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751794AbcDVVQi (ORCPT ); Fri, 22 Apr 2016 17:16:38 -0400 Received: from mail-by2on0086.outbound.protection.outlook.com ([207.46.100.86]:9280 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751742AbcDVVQh (ORCPT ); Fri, 22 Apr 2016 17:16:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PDNjX7GlarhmRJtGx+cisisYAxEGv21cuk5sjV9RR7w=; b=R56tT/YzUKb/ASbw4jg09OZQN1mskLidyVkqBaTwg8tmesbgnC24EZqbK91II3XtP6TG0JVwk9eW+MLfi/y/hHHnGSYV65KizgFQN6bHw4z40JWAMsuHW/HRM/OJZ2ep0yTzb67QdRSmeB1BXD9FAMUChm4mr+LIYnkq4MJ3JtA= Received: from BY2PR02CA0023.namprd02.prod.outlook.com (10.141.216.13) by BY2PR0201MB1925.namprd02.prod.outlook.com (10.163.75.155) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 22 Apr 2016 21:16:35 +0000 Received: from BL2FFO11FD054.protection.gbl (2a01:111:f400:7c09::131) by BY2PR02CA0023.outlook.office365.com (2a01:111:e400:2c40::13) with Microsoft SMTP Server (TLS) id 15.1.477.8 via Frontend Transport; Fri, 22 Apr 2016 21:16:35 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BL2FFO11FD054.mail.protection.outlook.com (10.173.161.182) with Microsoft SMTP Server (TLS) id 15.1.472.8 via Frontend Transport; Fri, 22 Apr 2016 21:16:34 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [172.22.12.162]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 5F.77.03047.D449A175; Fri, 22 Apr 2016 14:14:53 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.279.2; Fri, 22 Apr 2016 14:16:31 -0700 X-AuditID: ac160c69-996e898000000be7-3e-571a944d21b6 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 8C.2E.02566.FA49A175; Fri, 22 Apr 2016 14:16:31 -0700 (PDT) Subject: [PATCH 11/11] IB/srp: Prevent mapping failures To: Doug Ledford References: <571A936F.7040409@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , Laurence Oberman , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <571A94AF.7000609@sandisk.com> Date: Fri, 22 Apr 2016 14:16:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <571A936F.7040409@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsWyRoxnka7vFKlwg3U3LS1env/AarFy9VEm i2eHelkszn94xWSx7vV7FgdWj/P3NrJ47L7ZwObxft9VNo/Pm+QCWKK4bFJSczLLUov07RK4 Mha8vclUMEmwYuufBrYGxna+LkZODgkBE4lplx6ydDFycQgJzGWS2Nx7ihHC2cEo8ePhKiaY quNHVjNBJJYySnx5+5IFJCEsYC5xc/ELZhBbREBNYtOrRewgtpCAlsTSib9ZQRqYBVYDNSx7 BTaJTcBI4tv7mWDNvEBFh142g9ksAqoSRy/OZAOxRQUiJFavu8YMUSMocXLmE7AaTgFtieed 84HiHEBDNSXW79IHCTMLyEtsfzuHGWSXhMAmVoljD88xQhyhLnFyyXymCYzCs5CMmoXQPgtJ +wJG5lWMYrmZOcW56akFhqZ6xYl5KZnF2XrJ+bmbGCFRkbmD8e4T70OMAhyMSjy8Hxokw4VY E8uKK3MPMUpwMCuJ8E6eIBUuxJuSWFmVWpQfX1Sak1p8iFGag0VJnNft3pcwIYH0xJLU7NTU gtQimCwTB6dUA2PrEfFX0/exXqnZwLH9gUVLwetlf9W9b9fHes1wUr7vU5izyWW6fsVxl5jC ri86PddiuDasZDPdGhogvOnYVoHJdpbWcUpqnZYtymEHkiQVL/X4dd2ds8d71jPldMb9Hutl P++c/m7zx20Gi90qO2U7HKLv12ZGaK15JWuU18M1/ew98xP22kosxRmJhlrMRcWJABOE2BWG AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFJMWRmVeSWpSXmKPExsXCtZEjRXf9FKlwg9YJ/BYvz39gtVi5+iiT xbNDvSwW5z+8YrJY9/o9iwOrx/l7G1k8dt9sYPN4v+8qm8fnTXIBLFFcNimpOZllqUX6dglc GQve3mQqmCRYsfVPA1sDYztfFyMnh4SAicTxI6uZuhi5OIQEFjNKtDWfZQVJCAuYS9xc/IIZ xBYRUJPY9GoRO4gtJKAlsXTib1aQBmaB1YwS9/p+MYIk2ASMJL69n8kCYvMCFR162Qxmswio Shy9OJMNxBYViJBYve4aM0SNoMTJmU/AajgFtCWed84HizMLqEv8mXcJypaX2P52DvMERr5Z SFpmISmbhaRsASPzKkax3Myc4tz0zAJDQ73ixLyUzOJsveT83E2M4NDkjNzB+HSi+SFGJg5O qQbGXQfSGyUvtR/yNP33TWST9ZYU9quWipduzVt1dKbjbs24qfP/HTA3437uUM8TNiNJPJLD pkAyVm1GSOpMp+n2L1XnHJi6jPlm8L8mSx8Hlj/Hqt6cWimlkFrj8dD8c0xfx9oazoid4UHM GrPeZBkxqDmvdXz2mtv73CavFX6hQey2sQtqV91VYinOSDTUYi4qTgQASxBIOP0BAAA= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(2980300002)(438002)(189002)(199003)(87936001)(23676002)(50466002)(86362001)(11100500001)(2906002)(229853001)(33656002)(230700001)(81166005)(36756003)(5003600100002)(106466001)(2950100001)(2270400002)(65816999)(80316001)(47776003)(1096002)(19580395003)(1220700001)(4326007)(54356999)(77096005)(87266999)(586003)(92566002)(83506001)(50986999)(6806005)(76176999)(4001350100001)(65806001)(110136002)(65956001)(189998001)(64126003)(5008740100001)(59896002)(19580405001)(53416004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1925; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD054; 1:6g7GSwi2aKJQuUJGaaTjhi2j7EKZ0wLZf1I1zAx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3dLpyRJuROxrYj9F9F6lL0mG3GXNlBSKl2J4GgLeVavZTD0H6/k0N/PdrHa+ddXbzHOf1JlFbaB2LVkjgii+weWJ9/P37HrJbfjOecm/04yFVGVWhv8ZcgS/9I6v4sbm1IxL/RxG5/V9tPaFaxFztFA/7GGrZ+1hWS3si8p+jTdC3Ldr9KdPrepcUtILVDMkiut2aGWlBPagUCmvxq+4sP1sMrYQZRS0SzR26U IE5Dha1wZqI4w3ep/3qRDWoQNiyH X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(13018025)(13016025)(3002001)(10201501046); SRVR:BY2PR0201MB1925; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB1925; X-Forefront-PRVS: 0920602B08 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjAyMDFNQjE5MjU7MjM6eGpnUkVRd2VVSFM3dGNuRFNvUnZGTVc2?= =?utf-8?B?RmhQY0RNaGdvSk13OVY4elBhQnZtV0pteU9OZjhJaVNzYy9Cb3BCbm5ZVFIz?= =?utf-8?B?NGFUY0lZQ1dMNDhtNVoxVTd2WndHbnZrWDh6NTNUcDVSaUJpM095MVN6SFdS?= =?utf-8?B?QzI1YzNpWHo2OXdGZ2JheWlhU0ZvdFh2SEpBbVk1WEM5NXdRRC85dGthay9O?= =?utf-8?B?MStxRjRVUy8vZ2NNTXh6UnpLUG5RY3NGQWdQcG9PRTJRZVNmU2VkOEN4RzJJ?= =?utf-8?B?V0EwYUZYRm1ualFPZnA2eHlpaU9MZXZDcFpQTllPSHY2TjZnYTJmS092MFpE?= =?utf-8?B?VTJuUGtKNWZBM1h2TlJ2NWcxOXVQRFJsRG1BUDJGdUhmWndsZHpLMUZLRDl2?= =?utf-8?B?ZGRFaERMbTE3VGtnOXVuZWdvaEJhOXZ5UGtPVGNGaG4vNTlGQnp4T0xhV1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/zx7WKDb3Z/zQ=; 20:S+JYJBvQq0VjQg5lnfgj5cuqa+SjsRGLqSoCm46bg8TdCGxEsLaxoOEEoj0xd9hFahXkHr9ef4G07Fdi6BfoGZiekDtsRYLtana02W61iYhMEhLpz/u14Z/NsPKkRJaFDhuWDrPocqLnS1RFSFLyz5mNnMHHt4fZvXfihoWbBYb9+Tnj9NRRGvW5g1AUipDBmXqsTD4H+heTOaMTYCqaaodIVBVBOv5OHHeVtM1SGDeTZkhVAz4wDs43l6LXMkiW SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2016 21:16:34.7173 (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.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1925 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 If both max_sectors and the queue_depth are high enough it can happen that the MR pool is depleted temporarily. This causes the SRP initiator to report mapping failures. Although the SRP initiator recovers from such mapping failures, prevent that this can happen by limiting max_sectors. Reported-by: Laurence Oberman Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srp/ib_srp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index a173ec4..ebd4d90 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3172,6 +3172,7 @@ static ssize_t srp_create_target(struct device *dev, struct srp_device *srp_dev = host->srp_dev; struct ib_device *ibdev = srp_dev->dev; int ret, node_idx, node, cpu, i; + unsigned int max_max_sectors; bool multich = false; target_host = scsi_host_alloc(&srp_template, @@ -3228,6 +3229,25 @@ static ssize_t srp_create_target(struct device *dev, target->sg_tablesize = target->cmd_sg_cnt; } + if (srp_dev->use_fast_reg || srp_dev->use_fmr) { + /* + * FR and FMR can only map one HCA page per entry. If the + * start address is not aligned on a HCA page boundary two + * entries will be used for the head and the tail although + * these two entries combined contain at most one HCA page of + * data. Hence the "- 1" in the calculation below. + */ + max_max_sectors = (srp_dev->max_pages_per_mr - 1) << + (ilog2(srp_dev->mr_page_size) - 9); + if (target->scsi_host->max_sectors > max_max_sectors) { + shost_printk(KERN_WARNING, target->scsi_host, + PFX "Reducing max_sectors from %d to %d\n", + target->scsi_host->max_sectors, + max_max_sectors); + target->scsi_host->max_sectors = max_max_sectors; + } + } + target_host->sg_tablesize = target->sg_tablesize; target->mr_pool_size = target->scsi_host->can_queue; target->indirect_size = target->sg_tablesize *