From patchwork Fri Dec 4 23:08:15 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: 7772801 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 C1A2E9F350 for ; Fri, 4 Dec 2015 23:08:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C00002063E for ; Fri, 4 Dec 2015 23:08:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAF182063C for ; Fri, 4 Dec 2015 23:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755303AbbLDXIm (ORCPT ); Fri, 4 Dec 2015 18:08:42 -0500 Received: from mail-by2on0082.outbound.protection.outlook.com ([207.46.100.82]:2912 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755114AbbLDXIk (ORCPT ); Fri, 4 Dec 2015 18:08:40 -0500 Received: from BY2PR02CA0094.namprd02.prod.outlook.com (10.242.32.52) by CY1PR0201MB0826.namprd02.prod.outlook.com (10.160.141.27) with Microsoft SMTP Server (TLS) id 15.1.331.20; Fri, 4 Dec 2015 23:08:38 +0000 Received: from BY2FFO11OLC001.protection.gbl (2a01:111:f400:7c0c::158) by BY2PR02CA0094.outlook.office365.com (2a01:111:e400:2c2a::52) with Microsoft SMTP Server (TLS) id 15.1.337.19 via Frontend Transport; Fri, 4 Dec 2015 23:08:38 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; infradead.org; dkim=none (message not signed) header.d=none;infradead.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 BY2FFO11OLC001.mail.protection.outlook.com (10.1.15.185) with Microsoft SMTP Server id 15.1.337.8 via Frontend Transport; Fri, 4 Dec 2015 23:08:37 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id C2.92.32178.FDC12665; Fri, 4 Dec 2015 15:08:15 -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; Fri, 4 Dec 2015 15:08:15 -0800 X-AuditID: ac160a69-f79f76d000007db2-f9-56621cdf129a Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id A7.F7.17166.FDC12665; Fri, 4 Dec 2015 15:08:15 -0800 (PST) Subject: Re: [PATCH 0/6] SRP initiator related bug fixes To: Doug Ledford References: <565DE3EC.2070002@sandisk.com> CC: Sagi Grimberg , Christoph Hellwig , Sebastian Parschauer , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56621CDF.3070604@sandisk.com> Date: Fri, 4 Dec 2015 15:08:15 -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: <565DE3EC.2070002@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42JZI8azSPe+TFKYwfdjShYvz39gtTg9YRGT xbNDvSwWr48/ZbI4eZvfgdVj+oxNrB6bV2h5/Pnzmdnj/b6rbB6fN8kFsEZx2aSk5mSWpRbp 2yVwZTy5Po+54IRExfJ/t1kbGDtFuhg5OSQETCT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93ECA5b zqgdjNcnmh9iZOLglGpgjKlk9Z8fGtFrn3o/PSrv+OpHUmmSE6e0LeJ+9WWLypILu5/EHGD7 fpk7IFs1/cfE9AU6zGwTufKrz1isZ+CfJcaQ+lRD751mfmGbaK9wRm5BVqxW3qaG5Z88133f +s2m2NE2QTXihHjp/t8r3cPeTj3MM/G53MrsZvap2V8/XWeusRWc9q9BiaU4I9FQi7moOBEA o0dYpQsCAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC001; 1:Gj+tIWwnrKUDTl3Um18QlbAcJKEVwRZ3m9bZECxDtCpkFDKwYv+sj48rmjLlrxhkWWmAbHy8H7c5LQG/O44Guj9VOBVD/6eAcfQuLWOkGlspR9W8Jxkd41rGIO7bNZJZX/CKpCC18hziXQbRvfcz99SfM7xsFeeMb61HMeaKunw3ZUkdXoBtReyEWCGANyAvJSxE0rHB501l1ugbX3/si1oPCUZA+VvaVyS8M5S+7v4UqzZJPz5jb/j0h8bwtvFBsiMY2rwdEKeDO05n61ZgxHKvGSSMY6eG08+/tpTNn7qU5erUqjdEzaLKurc3O4RTG7IvkZMn4W0/pOpEzc0Y48TZl31hQz3fFhlbYb7B0Lee/pu+8VkIs9RqqDegIqouHE5Y7pxRVBn8qSLvW1+U02rznoyc+/DYsCNlLtV5q4U= X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(479174004)(377454003)(189002)(24454002)(164054003)(4001350100001)(81156007)(23676002)(106466001)(77096005)(97736004)(2950100001)(5001960100002)(64126003)(110136002)(33656002)(83506001)(50466002)(54356999)(92566002)(99136001)(87266999)(65816999)(80316001)(86362001)(189998001)(65956001)(87936001)(47776003)(65806001)(69596002)(50986999)(36756003)(76176999)(59896002)(230700001)(586003)(1096002)(1220700001)(5008740100001)(11100500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0826; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0826; 2:I1GH4h1hIC6Q+QwMsWAQKBy2C3SpbvzzZpRTxPFnJih1yCaFxYJcVbe+C2G50hAGw1inojGq1b8GGJckiuo2SSomvjOvMXtNY1vgurRWW8179CgvyCBGnDofyTTWjmCRh6m/ZQ4abLsIoTTwM0dp3Q==; 3:AGkP2Gpm+Wp/NqqypOriSVft9aO9v8a1U7atf+h876fm+SvSGAyYX5I5GhTpvvXcEddwRvDNkC/71Qu8kmWlaWKm7dXFu7g9q5/M/UaTJh4wHqxb6bkIPb+C6RzLwo09nkZ8YHIrIkjZ3AKC4At5W92f0XFWQmO8qSRCjsVIcnE7IAR2DaSPJbrSwbwqp+//y8Z/N+osjIz36fa1IclP0lIeW9IMBgPo4pIfyI4B0JamK04Cf4pIl4i9G6WqWSi7MJ+st4R0PQBKeBWDJFrmMw==; 25:3hlBnPfbYhLli30Hh+VPUx7CeACUap/0bO2v9i93AhEvG5rFV4grLwhvnY6F/LknvGtJgBVxjPYO8u+uIQ6W1eu3gbkTvgZsJw6xzQbj4HPJo8wQ2czFJvk6AzgTn9ADMzJCwvG9TPK3BpJ4gyynrWwF8qoAmJE4tzqZZH9ucO/kHEowp1HoEzeWoM9w1YuF6YU4fwJCdxpAwYtZeshV7um8n/XtQDgw+pa4AgH0LPTdnseddbMePV7T+i1B9Vkb976RmcwTXDQvIxREww1lhw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:CY1PR0201MB0826; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0826; 20:565+ZmOhMH/eZ9409wVjzRSYaHQO61OQJH/L1n/H1FxojKolzb0RbBMJYGV/tT17Dle0ZWhe3hYmsIIdgQkKPq9PYSJ/HVcYaoWp9Q1ZghBFjN4r87I+t2qwilRMCIwGJ9wO42EtBZ/KhpS/xmasT5N/89t4rr79v0+FWqppcU+J4mz+Pz3sMY+B1RCsR4OU8mYEVqd1vkuBecaM/B3Ri/nWCDQFhwa2pTebm9mwvMPmZOJxbw/UGa+zUz6U5DKDq+a0Bq6CFjwceAYw+l5V0I/AC6yPOH2jndJVQ/TKhsptTA5DBXWGp9eoPLnoa7G2T8kJyUVNTYNrkyrq0T5bxqdeCab8f7Z84VJVm1IT8ZkLLQEopFsnEXXCQS6dWc5GViONzPIKX2si90ZiF3Wactb9REYujx+H/WeiwLVGn9eFIX4gC/9E1/iVVVzSf35RZvu9zgdKlmDex7VGzaf90gnWJ9+qvnPwSqPeC+ujkcZOAn0jVLmPFseJ8sV3IrqI; 4:9KxYQ358ltc/NxpxVaNNM81R/8tz0mhkWH7t6XeDduDH6pQLmauPRfhbjJIdMT6tgIDp6FwqJk6vMI+P1zv0WEbzoXggf/kFYBux7W7AyYJUcaijLWVkDAI9Atq823e7R58NECoSxYjGY9ThKfL6CCD+kC2X5ZfQyw9Rb+Y7VUPVAaHUsMcq9hCz5eM+iFFyxbE8tlbuTujD3GwAx7da6/SYXcigzFkVhJpcWNX0TqenkaM9oz8f7ybOjJVBow0N8q+DxY3l4z3M7H/NZKQzJ1oU/dGfhYnhbzVD3LXRanUVUzaKFxnq5xpELs0uF6FLlJZLvsSyDSXDCiCRPR3GzPCGk6JLDJGtRRp8ib+/VAUVaDhOGySrrWuCNzTXcjdZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:CY1PR0201MB0826; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB0826; X-Forefront-PRVS: 07807C55DC X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyMDFNQjA4MjY7MjM6ZEttc2J5REIvQ2s1OHcvTC9Sd1ZEQnIx?= =?utf-8?B?Nit4ZjZteW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i9m8D4=; 20:QZiJbjghyDpg06ZsXv3xgnW0bIQVzHNKuquzp+iIauKY5BWCiBuncTRM0TlGjnkfSCrsadfwg8TgzvXwxduv9pKO1NA8qZsu+E1Q3UkcSe9lOZi62awmspd0UDT+Q8KR8jj8iDo3SA6br6Dk7zPTNxw320pNDbFJobbrwc3e43J/kowBw5u4X5hfIGtvIIaXM8urwPmg8Opj7q6husOYlCrkm5C7Yk4Eux9RzZhzbNlM9x790guqYB8D1jXXkrp2 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2015 23:08:37.9864 (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: CY1PR0201MB0826 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, T_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 12/01/2015 10:16 AM, Bart Van Assche wrote: > [ ... ] Hello, While preparing this patch series I noticed that none of the SCSI RDMA initiator drivers syncs RDMA buffers before performing RDMA. Does anyone know why something like the code below is not present in these drivers and why no dma_sync_sg operations are present in struct ib_dma_mapping_ops ? Thanks, Bart. [PATCH] IB/srp: Sync scatterlists before and after DMA --- drivers/infiniband/ulp/srp/ib_srp.c | 10 ++++++++++ include/rdma/ib_verbs.h | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 3db9a65..23e3c25 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1780,6 +1780,7 @@ static int srp_post_recv(struct srp_rdma_ch *ch, struct srp_iu *iu) static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp) { struct srp_target_port *target = ch->target; + struct ib_device *dev = target->srp_host->srp_dev->dev; struct srp_request *req; struct scsi_cmnd *scmnd; unsigned long flags; @@ -1828,6 +1829,11 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp) else if (unlikely(rsp->flags & SRP_RSP_FLAG_DOOVER)) scsi_set_resid(scmnd, -be32_to_cpu(rsp->data_out_res_cnt)); + if (scmnd->sc_data_direction != DMA_NONE) + ib_dma_sync_sg_for_cpu(dev, scsi_sglist(scmnd), + scsi_sg_count(scmnd), + scmnd->sc_data_direction); + srp_free_req(ch, req, scmnd, be32_to_cpu(rsp->req_lim_delta)); @@ -2112,6 +2118,10 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) ib_dma_sync_single_for_device(dev, iu->dma, target->max_iu_len, DMA_TO_DEVICE); + if (scmnd->sc_data_direction != DMA_NONE) + ib_dma_sync_sg_for_device(dev, scsi_sglist(scmnd), + scsi_sg_count(scmnd), + scmnd->sc_data_direction); if (srp_post_send(ch, iu, len)) { shost_printk(KERN_ERR, target->scsi_host, PFX "Send failed\n"); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 9a68a19..5f9cba7 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2796,6 +2796,22 @@ static inline void ib_dma_sync_single_for_device(struct ib_device *dev, dma_sync_single_for_device(dev->dma_device, addr, size, dir); } +/* Prepare DMA region to be accessed by CPU */ +static inline void ib_dma_sync_sg_for_cpu(struct ib_device *dev, + struct scatterlist *sg, int nelems, + enum dma_data_direction dir) +{ + dma_sync_sg_for_cpu(dev->dma_device, sg, nelems, dir); +} + +/* Prepare DMA region to be accessed by HCA */ +static inline void ib_dma_sync_sg_for_device(struct ib_device *dev, + struct scatterlist *sg, int nelems, + enum dma_data_direction dir) +{ + dma_sync_sg_for_device(dev->dma_device, sg, nelems, dir); +} + /** * ib_dma_alloc_coherent - Allocate memory and map it for DMA * @dev: The device for which the DMA address is requested