From patchwork Thu Nov 26 01:17:38 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: 7704031 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 1BE7F9F1BE for ; Thu, 26 Nov 2015 01:17:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBE5D207BA for ; Thu, 26 Nov 2015 01:17:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5748A207B9 for ; Thu, 26 Nov 2015 01:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751847AbbKZBRn (ORCPT ); Wed, 25 Nov 2015 20:17:43 -0500 Received: from mail-bn1bon0091.outbound.protection.outlook.com ([157.56.111.91]:31165 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751009AbbKZBRm (ORCPT ); Wed, 25 Nov 2015 20:17:42 -0500 Received: from BY2PR02CA0082.namprd02.prod.outlook.com (10.242.32.40) by BY2PR02MB298.namprd02.prod.outlook.com (10.141.140.21) with Microsoft SMTP Server (TLS) id 15.1.331.20; Thu, 26 Nov 2015 01:17:39 +0000 Received: from BY2FFO11FD015.protection.gbl (2a01:111:f400:7c0c::183) by BY2PR02CA0082.outlook.office365.com (2a01:111:e400:2c2a::40) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Thu, 26 Nov 2015 01:17:39 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BY2FFO11FD015.mail.protection.outlook.com (10.1.14.131) with Microsoft SMTP Server id 15.1.331.11 via Frontend Transport; Thu, 26 Nov 2015 01:17:38 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 82.A1.32178.2BD56565; Wed, 25 Nov 2015 17:17:38 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Wed, 25 Nov 2015 17:17:39 -0800 X-AuditID: ac160a69-f79f76d000007db2-95-56565db2e5ac Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id EF.C5.17166.2BD56565; Wed, 25 Nov 2015 17:17:38 -0800 (PST) Subject: Re: srp state in current mainline To: Christoph Hellwig , Sagi Grimberg References: <20151110171509.GA27781@infradead.org> <20151122135343.GA11703@infradead.org> <20151122143215.GA14667@infradead.org> <5651D775.9090500@dev.mellanox.co.il> <20151122151034.GA29240@infradead.org> <5651DEA4.8040506@dev.mellanox.co.il> <20151122153106.GA26919@infradead.org> <5653B9E8.7020907@sandisk.com> <56560D46.1070904@sandisk.com> CC: "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56565DB2.5090505@sandisk.com> Date: Wed, 25 Nov 2015 17:17:38 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <56560D46.1070904@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRmVeSWpSXmKPExsWyRoxnke6m2L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QlI2C0nZAkbmVYxi uZk5xbnpmQWGRnrFiXkpmcXZesn5uZsYwSHJGbWD8fpE80OMTBycUg2MSy13HLusoThj+78C I8uva9n6La3PPQk0fZb2cGFHysZlj1iDNjZzW5WeFPVW4furdXvruSdvVje/Vz9Zybmdyef1 ixtVHuqiBw8eWNg+s0WpdKZnWqfl7rCYfu9QnX2S98zuPNSacyJE23rtNZ3HbfWet2ZdqrgS feiPUNDBZSIXU5+fE2VYp8RSnJFoqMVcVJwIAL2ZwDP5AQAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD015; 1:Pu7fgxWt7LvrZbCJ0XGAMHyptouJB2jdADbTZLDixKLT/my2geyP2NF12NtGEbUQMFfA40peTRifHmoAqpjwdgOv6/f8F0/s50IRI6L4YwrZvwFESbWpyErZzpf34qD5eSZs1Xg5kW7SfnPw24MalgBh9zsZzn1952uM1sp5ewsPY2LECS+L3o8y8Y/reHDxEVTsNS9Vpp/RAdNCVJ7MWagkQSYdViCcJ9AtWx78jy+xamF6YSnkiJZ6lI/Ayl9MgnAkccqdj2Cx8jbk75EaYMYZxt118C5eCC43FHOInfK3W2xR6H+PjhbGRNFM4rv5NBqjM7AD1UAiFqPY5UC+sU43qx7DfPjtsSDetQ/NIcYhvcpc65iUNoBls3XY3t3PpdlKzSDSXHwZ7XWvcIHFz6+sM1YLIvledAsO/Gh9trA= X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(479174004)(24454002)(377454003)(199003)(81156007)(11100500001)(5001960100002)(36756003)(33656002)(54356999)(4001350100001)(97736004)(76176999)(77096005)(65816999)(23676002)(92566002)(189998001)(83506001)(1096002)(65806001)(5001770100001)(65956001)(47776003)(19580395003)(19580405001)(50466002)(586003)(2950100001)(99136001)(230700001)(93886004)(69596002)(86362001)(106466001)(87266999)(80316001)(64126003)(5008740100001)(87936001)(59896002)(1220700001)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB298; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB298; 2:ly2LQvkiKekNCTmanDBEZFetl1xt7p2U1w7gb75pUIHpJ/hVN78UrJfJBTdfT/YjFtPq33J15H+s0mevI/pVgdreRNnZkl37Qfz2nzR924D3BKjR5/KKB9tYh0gOaZEFR3ciOwxF7Dbrb1oLgMA5Dw==; 3:l6SkS1yiPeiHqBrhJmgDcqsxB37WuuU6SXswyPmcouqWviRUHs3u4CFNfwxyJGfE3r5XVl/FlAU3Ib+4LHHv6mlQfACS7tYOUtE0KMDnulH/dOa2JTuJswN0CANekn/wPPRYvdAcRe1zP3um92Nqylh6DIFP95Y+R93mk/bpV25StDt8QmRv+OZsF78oTIgc4vqMZ/suUx4l70Ey4GD7WSmTrx3OxB1WZrFjn2WSz8EKarFM19jlDP/nrPAmk9FJgadtZFP5aclI2Wnid4oO/w==; 25:sRsgQX05tgg4PBePY65e79gPM8ZJgLkiMd8meUgrQBTYzUhuC5TPNBYgSRQZttPIHpKsjWEVpf+IRzsn1BFVS36TZQQSpKKYLWoS78exTjVlWuGyD/k+n3/meD4X5tPs694luuxLHsNEJJ19d8EzjwdHaAttTDIGCgj41EZ9rn1gYxckKtj8omH8v43UU1lmYDZFGrhs2VyFhYg6FqTtbaM1IeX9c3oH+dxYZxHbVs4WcEWwZE8gMYSzDZIpl6svi+5kLDOlNqs6Tu2OceneCw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BY2PR02MB298; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB298; 20:/HyEPSVCU+aUuxsbOlccg1U3IYxaaL8G4Y8pk/nV14D5sjhz3gQ92I/CKxu5P0UmgdWWeeEF74mLeajznK9ICCl3CPQ96a9uoKvTd212YJtt8e8pzrJIUNzFfl4sv1K6llXlRNEcsY5YdKRD0CHz0h3Ivnv9qy21OaAnaC9rfGXqtd7lQyUF4BXZBN5WtnH45XdxpqMMuq+ZSOKNiTWfmOT2k6n3Kpp0PdOmxj0lM/FsQvwQ93LBl8MHL9kAJC90JJthlw26tnR8NVymRxmMGHdU4kKAYFrWKQkd/1Mee8JIqltS/FfEiWsH58EfeO+dpMQnEDRmJzxQqP31j5DzmbTo/RY5klK+pgh0KquZKb1npfBQLLUYqCttF2qhy/b6mNlZBCAiqsmVDhchq1tAwNnxx4jDxwsUfDhtmiwtx2jFooMzvToj+RghQ+zFhbSNEmne26oFiRJ1F8YmM9O08qFwox/2WGc91lgKQU8IL3dObY0TQp4q8MqGB8puyp6X; 4:JchpqGl8/gjCa4sjbP1z0c3vgVMVemmrkIe3+V8xiY7bnEGdA312B6a+OFfpNk2DKmZ7X++KWTGQeAqNfQJ41YRZYSY0ObSgmR+XBEQQUpM9c8Q29Hsx2QjI4F2lF+RhjVt69xp0+wezITp1qdy9a+SJJc/WvsGU1O+cVrvB68enb/t5pHVOBHq1q5h67DnKtZeC9kV4ZT1RqF6bz3J84cPIdh1o9MvcN24ffT7uhRDE/5hP4j8OraKF4HosTsbuhgyS+P7qfjDHNIUCLeA29FJwyQ8Kjq4JrEOj1DNbJWTLRwugsZRFFxxGR/arLJyBETSkBtXeevPrZYTXV1N4xAUAKjDv7zg/ZnyRVHLklsdNh6qgz5aEf5l7BvNLZvnbxoUIc9LyQR1TYcYUwpgm5iz+zZbWSK/pkha4WQC ilmNXVXOIxePtPyhSbb5rmeZ6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:BY2PR02MB298; BCL:0; PCL:0; RULEID:; SRVR:BY2PR02MB298; X-Forefront-PRVS: 0772E5DAD5 X-Microsoft-Exchange-Diagnostics: =?utf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poi2WhXsfZ19lK9mi6p4gw7n/N+FPugkmhjGa94nG0dOs0gNuGqCif0Q==; 24:YrhPFAS2tkJ3HMoZMvFU9hoTUJ1t8P+KyM8hXJFRnQGXn2+eZShz0oWIKqgEfQMOTmKJ9CFBOLsMzbLOS5aMWQuE8fyz3K6HUwE2zzdJ4Z4=; 20:JGBsZTMWVFfMdVYGS9hXrYEYUt+ZgqQoc/FkUiNvEpbZsz2gMRibNryyuHml5MhP1VRM+ZZ/teXOPpS9ng8R0gczWfpqRD8B5YRXBL1oag5ib/C85gj2/Lqo3P4iCtn6IAwEAat9uWwIud7EXYvdRincgJlx2IqRoElwZ6iHT+52xeWEH/hjKvbMX4+1Ie1UuHevZXuwa9tL7N/TSIJHaJ3x1YxSWyU+VM6g03CETS0LpLjlgI9aliU/Se6BUYEE SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2015 01:17:38.9406 (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.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB298 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.5 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 On 11/25/2015 11:34 AM, Bart Van Assche wrote: > On 11/23/2015 05:14 PM, Bart Van Assche wrote: >> On 11/22/2015 07:31 AM, Christoph Hellwig wrote: >>> On Sun, Nov 22, 2015 at 05:26:28PM +0200, Sagi Grimberg wrote: >>>>> No. register_always=Y is already broken in 4.3, but >>>>> register_always=N is >>>>> now also broken in 4.4. >>>> >>>> OK, I'm confused so please let me understand slowly :) >>>> >>>> Your patch "ib_srp: initialize dma_length in srp_map_idb" solves >>>> the register_always=Y dma_length = 0 WARN_ON() on 4.4-rc, does it solve >>>> the data integrity errors too? >>> >>> No, it doesn't. >>> >>>> This code path is specific to srp because all other ULPs guarantee >>>> no-gaps... >>> >>> Yes. Life would be simpler if we could just set the virt_boundary >>> on SRP, and Bart has indicated that he's willing to at least looks at >>> this for the next merge window. >> >> Hello Christoph, >> >> Tomorrow I will try to reproduce this behavior on my test setup. I >> prepared a setup with kernel v4.4-rc2 and on which the SRP initiator and >> target are running on the same server. Tomorrow I will install xfstests >> and see whether these tests pass fine against an XFS filesystem. > > (replying to my own e-mail) > > I can reproduce this behavior with both LIO and SCST. I have modified > initiator and target code such that the target appends a data CRC at the > end of the SRP_RSP IU and such that the initiator checks that CRC. A CRC > mismatch was reported for the following SG-list by the initiator: > > scsi host10: srp_check_crc: bufflen 1024; resid 0; sg-list len 2; dir > DMA_TO_DEVICE; CRC mismatch (0x7916620b <> 0xde97b796); sg-list: > [0] ffff880407378348 len 512 > [1] ffff880407378000 len 512 > > I will check the memory registration code next. (again replying to my own e-mail) The patch below helps somewhat but is not sufficient to make the XFS tests pass. On Monday I will continue to work on this. Bart. [PATCH] IB core: Fix ib_sg_to_pages() Fix the code for detecting gaps and disable the code for chunking. Fixes: "IB/core: Introduce new fast registration API" (commit 4c67e2bfc8b7) Signed-off-by: Bart Van Assche --- drivers/infiniband/core/verbs.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 043a60e..3f9c820 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1530,7 +1530,6 @@ int ib_sg_to_pages(struct ib_mr *mr, int (*set_page)(struct ib_mr *, u64)) { struct scatterlist *sg; - u64 last_end_dma_addr = 0, last_page_addr = 0; unsigned int last_page_off = 0; u64 page_mask = ~((u64)mr->page_size - 1); int i; @@ -1544,23 +1543,9 @@ int ib_sg_to_pages(struct ib_mr *mr, u64 end_dma_addr = dma_addr + dma_len; u64 page_addr = dma_addr & page_mask; - if (i && page_addr != dma_addr) { - if (last_end_dma_addr != dma_addr) { - /* gap */ - goto done; - - } else if (last_page_off + dma_len <= mr->page_size) { - /* chunk this fragment with the last */ - mr->length += dma_len; - last_end_dma_addr += dma_len; - last_page_off += dma_len; - continue; - } else { - /* map starting from the next page */ - page_addr = last_page_addr + mr->page_size; - dma_len -= mr->page_size - last_page_off; - } - } + /* gap */ + if (i && (last_page_off || page_addr != dma_addr)) + goto done; do { if (unlikely(set_page(mr, page_addr))) @@ -1569,8 +1554,6 @@ int ib_sg_to_pages(struct ib_mr *mr, } while (page_addr < end_dma_addr); mr->length += dma_len; - last_end_dma_addr = end_dma_addr; - last_page_addr = end_dma_addr & page_mask; last_page_off = end_dma_addr & ~page_mask; }