From patchwork Wed Apr 26 12:25:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Gurtovoy X-Patchwork-Id: 9701309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7883D60245 for ; Wed, 26 Apr 2017 12:25:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C7B728399 for ; Wed, 26 Apr 2017 12:25:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D6128488; Wed, 26 Apr 2017 12:25:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13F3E28399 for ; Wed, 26 Apr 2017 12:25:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1431758AbdDZMZu (ORCPT ); Wed, 26 Apr 2017 08:25:50 -0400 Received: from mail-he1eur01on0065.outbound.protection.outlook.com ([104.47.0.65]:3136 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1033774AbdDZMZs (ORCPT ); Wed, 26 Apr 2017 08:25:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=b4e7JO02tlMKvItNVNI2SdnrUIKv8tb46qSQOB3JEkA=; b=wqll3aRO1zdQBPQvZmreca8EUmGOThjbBv8l05+HR3r0Fyqacv2eDktbaiC7Te9M23/WcYRSqRsijzPxjxI8koUBOTZrQ8uR/lbEiRSlWphV65mQ9QUMRtCpPDGRaME88vPnEj7J+w64J4nJriG2Y6bxsti+d6vXdxwMna3P0K0= Received: from HE1PR0501CA0028.eurprd05.prod.outlook.com (10.168.27.166) by AM5PR0502MB2930.eurprd05.prod.outlook.com (10.175.45.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Wed, 26 Apr 2017 12:25:34 +0000 Received: from AM1FFO11FD029.protection.gbl (2a01:111:f400:7e00::178) by HE1PR0501CA0028.outlook.office365.com (2603:10a6:3:1a::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12 via Frontend Transport; Wed, 26 Apr 2017 12:25:33 +0000 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=mellanox.com; Received-SPF: Pass (protection.outlook.com: domain of mellanox.com designates 193.47.165.134 as permitted sender) receiver=protection.outlook.com; client-ip=193.47.165.134; helo=mtlcas13.mtl.com; Received: from mtlcas13.mtl.com (193.47.165.134) by AM1FFO11FD029.mail.protection.outlook.com (10.174.64.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Wed, 26 Apr 2017 12:25:32 +0000 Received: from MTLCAS13.mtl.com (10.0.8.78) by mtlcas13.mtl.com (10.0.8.78) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 26 Apr 2017 15:25:32 +0300 Received: from MTLCAS01.mtl.com (10.0.8.71) by MTLCAS13.mtl.com (10.0.8.78) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Wed, 26 Apr 2017 15:25:32 +0300 Received: from [10.223.3.143] (10.223.3.143) by MTLCAS01.mtl.com (10.0.8.71) with Microsoft SMTP Server (TLS) id 14.3.301.0; Wed, 26 Apr 2017 15:25:30 +0300 Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array To: Laurence Oberman References: <8992bd28-667f-94b1-e582-106e6b41aa4b@sandisk.com> <20170425175849.GS14088@mtr-leonro.local> <438230391.2090966.1493152655709.JavaMail.zimbra@redhat.com> <896e9a9e-43b6-7a21-e41b-861e4f795436@mellanox.com> <288883138.2280971.1493207257218.JavaMail.zimbra@redhat.com> <497950649.2287440.1493209093092.JavaMail.zimbra@redhat.com> CC: Leon Romanovsky , Bart Van Assche , Doug Ledford , "Sagi Grimberg" , Israel Rukshin , From: Max Gurtovoy Message-ID: <16ea1371-84a5-c055-5b0c-fdc6d355276a@mellanox.com> Date: Wed, 26 Apr 2017 15:25:30 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <497950649.2287440.1493209093092.JavaMail.zimbra@redhat.com> X-Originating-IP: [10.223.3.143] X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:193.47.165.134; IPV:NLI; CTRY:IL; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39840400002)(39860400002)(39450400003)(39400400002)(39850400002)(39410400002)(2980300002)(438002)(199003)(189002)(377454003)(13464003)(24454002)(9170700003)(93886004)(229853002)(33646002)(54906002)(8656002)(86362001)(77096006)(6306002)(65806001)(47776003)(65956001)(575784001)(23676002)(31696002)(110136004)(6246003)(53546009)(54356999)(76176999)(50986999)(106466001)(38730400002)(31686004)(36756003)(5660300001)(4001350100001)(65826007)(2906002)(2950100002)(6916009)(356003)(305945005)(7736002)(8936002)(8676002)(81166006)(83506001)(4326008)(50466002)(189998001)(64126003)(6116002)(3846002)(230700001)(15760500002)(3940600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0502MB2930; H:mtlcas13.mtl.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD029; 1:c3AIjEFcJ+y5mt6qNNaaMFk6zFBGQtCNBaIUSNeC/yiX00NdKD569KBYiPMaKUqSHolSbat6+7Vl/x9bKQJsF6PrNiAygnt6TIJAmnAQtTyK7kmvQpFSLpdZT7UaNa3pKqL3M19aT7NvCXOIk8TL5F5IINmnfzwgHiWHKO/T57uJuYF/0pPBDih1jYZBz+feTOk9kqzmyYmbhg/7UGh+2bvwh5MvEbiKMr7dWZOKmda6ftQG/sL1qRF1ss5xeK8bKp4qs9o7mNjXghjREAA1ccQL9+S/X8r5c9CC8FwFzLiOLYRiOqrMtt3b2DBf/gxrg3xLzJUgOZQ7dbzu+7NyzwPhyiW/iBrycSgf/F2W+7bEE2GhV+sWXgCeoSD+SUH1I/6dsxm6R2d5EzVjeq1zy3TLkiVZSnRkudvj9MWCbKiVbyF3H5/yNs/656b1nuAyTmUCLjJY30fmGcObQqfJajpvG/Tn/+ZXioZNAzdHcyungsLwl7eMR7OiZaq/CBMVhoYcGqsgcd88wk1f7iERyPkHi8uDyi0diFOdr9XgS+HqhWSvT7UrrsSyJAWVh3PzowhPnCpN5nxzJqcnM+BcoQ== X-MS-Office365-Filtering-Correlation-Id: 33115399-b2c2-4088-5279-08d48c9f55c9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:AM5PR0502MB2930; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0502MB2930; 3:S1Tgjx6Pp1qxGlfV5EXNfco1TrHRu8u8pnDvp8XrlbljSakRpGSaaz11ZclcGPrO2679ik5wubGdSepYuU5BhEGqHZ03ALqahdBX0Em36kCp5HBHDBAu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FBn8mYBFiiYIHT2ayqevnXbvEs/WR3DITcmLzbgf1r9Tc8oRktbnG/DkEQrzXo/SfjwAg3w7COK4hSQHfPgp3ITjG34gluVPQgHFTG+cPMTyJQV8x7v19mZ4bafzrU= X-Microsoft-Exchange-Diagnostics: 1; AM5PR0502MB2930; 20:ki67vceVFnMDfZ2lNey5qNJymLE+GWd7XzrnKWZwbeQdIqGzbuZQfwZRcT1d3ca2mZbvr9e4Una/SBFjMR9p/CWJd7Zzt7jqgrI2uBj25xUKuLqFJTEHdUWfPMx7xyKgG7UAKalAgVO8Qs2vQsPMbNLb6p4C07MOP3BY9A4CL/Oqjt3FmAORXX32PC5t29bWb/kWSde0P05u/TRqrpwbJGESKAB0F0SLJS5upxpWm6rYI35042NhjLNrnxP1ymlAfXeg7jKQwTbPTBS/DBMhyr8V2XEUZTJdPR4br3pbE5Nxx094boxpzH25d7KYnYcCWQjBNso0tOLSzGBr2SRdce+XmHcu85lfndzxMGDKNGrYQ56GZrX3kJRpfq7Gr5E7nkDyCAz2VjKg2OHw/ZkLfi5OH1QWrpWHhZcuOxmyi3f1ki7Cb7tckDdoW/Sv1+PNcBvBsb5m02Djuqj5o+UqVfcztyZk6rDa0kV6i4EO+YWwDtmqjqWUCCK7TVE6fCzh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(9452136761055)(131327999870524)(265634631926514)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(8121501046)(13016025)(5005006)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123558100)(20161123555025)(20161123562025)(6072148); SRVR:AM5PR0502MB2930; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0502MB2930; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTVQUjA1MDJNQjI5MzA7NDp6TTBXcVNnQkRVWjFx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GXhWI5qc2L8Pzdw== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2017 12:25:32.9908 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b; Ip=[193.47.165.134]; Helo=[mtlcas13.mtl.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0502MB2930 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 4/26/2017 3:18 PM, Laurence Oberman wrote: > > > ----- Original Message ----- >> From: "Laurence Oberman" >> To: "Max Gurtovoy" >> Cc: "Leon Romanovsky" , "Bart Van Assche" , "Doug Ledford" >> , "Sagi Grimberg" , "Israel Rukshin" , >> linux-rdma@vger.kernel.org >> Sent: Wednesday, April 26, 2017 7:47:37 AM >> Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array >> >> >> >> ----- Original Message ----- >>> From: "Max Gurtovoy" >>> To: "Laurence Oberman" , "Leon Romanovsky" >>> >>> Cc: "Bart Van Assche" , "Doug Ledford" >>> , "Sagi Grimberg" >>> , "Israel Rukshin" , >>> linux-rdma@vger.kernel.org >>> Sent: Wednesday, April 26, 2017 4:31:57 AM >>> Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() >>> overflows the klms[] array >>> >>> >>> >>> On 4/25/2017 11:37 PM, Laurence Oberman wrote: >>>> >>>> >>>> ----- Original Message ----- >>>>> From: "Leon Romanovsky" >>>>> To: "Bart Van Assche" >>>>> Cc: "Doug Ledford" , "Max Gurtovoy" >>>>> , "Sagi Grimberg" , >>>>> "Israel Rukshin" , "Laurence Oberman" >>>>> , linux-rdma@vger.kernel.org >>>>> Sent: Tuesday, April 25, 2017 1:58:49 PM >>>>> Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() >>>>> overflows the klms[] array >>>>> >>>>> On Mon, Apr 24, 2017 at 03:15:28PM -0700, Bart Van Assche wrote: >>>>>> ib_map_mr_sg() can pass an SG-list to .map_mr_sg() that is larger >>>>>> than what fits into a single MR. .map_mr_sg() must not attempt to >>>>>> map more SG-list elements than what fits into a single MR. >>>>>> Hence make sure that mlx5_ib_sg_to_klms() does not write outside >>>>>> the MR klms[] array. >>>>>> >>>>>> Fixes: b005d3164713 ("mlx5: Add arbitrary sg list support") >>>>>> Signed-off-by: Bart Van Assche >>>>>> Reviewed-by: Max Gurtovoy >>>>>> Cc: Sagi Grimberg >>>>>> Cc: Leon Romanovsky >>>>>> Cc: Israel Rukshin >>>>>> Cc: >>>>>> --- >>>>>> drivers/infiniband/hw/mlx5/mr.c | 2 +- >>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>> >>>>> >>>>> Bart, >>>>> >>>>> Thanks a lot, it indeed looks right. >>>>> Acked-by: Leon Romanovsky >>>>> >>>>> Thanks >>>>> >>>> >>>> >>>> Hello Bart, Leon, Max and Israel. >>>> >>>> I cloned off Barts tree. >>>> >>>> git clone https://github.com/bvanassche/linux >>>> cd linux >>>> git checkout block-scsi-for-next >>>> >>>> I checked all patches were in for this test. >>>> >>>> a83e404 IB/srp: Reenable IB_MR_TYPE_SG_GAPS >>>> dfa5a2b mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array >>>> f759c80 mlx5: Fix mlx5_ib_map_mr_sg mr lengt >>> >>> Hi, >>> copying Sagi's request from different thread: >>> >>> " >>> Can you please enable srp_add_one debug: >>> >>> echo "func srp_add_one +p" > /sys/kernel/debug/dynamic_debug/control >>> >>> In addition apply the following: >>> -- >>> diff --git a/drivers/infiniband/hw/mlx5/mr.c >>> b/drivers/infiniband/hw/mlx5/mr.c >>> index d9c6c0ea750b..040fbc387e4f 100644 >>> --- a/drivers/infiniband/hw/mlx5/mr.c >>> +++ b/drivers/infiniband/hw/mlx5/mr.c >>> @@ -1403,6 +1403,8 @@ mlx5_alloc_priv_descs(struct ib_device *device, >>> int add_size; >>> int ret; >>> >>> + WARN_ON_ONCE(ndescs > device->attr.max_fast_reg_page_list_len); >>> + >>> add_size = max_t(int, MLX5_UMR_ALIGN - ARCH_KMALLOC_MINALIGN, 0); >>> >>> mr->descs_alloc = kzalloc(size + add_size, GFP_KERNEL); >>> >>> " >>> >>> Max. >>> >>>> >>>> Built and tested the kernel. >>>> >>>> However this issue is not resolved :( >>>> >>>> [ 2707.931909] scsi host1: ib_srp: failed RECV status WR flushed (5) for >>>> CQE ffff8817edca86b0 >>>> [ 2708.089806] mlx5_0:dump_cqe:262:(pid 20129): dump error cqe >>>> [ 2708.121342] 00000000 00000000 00000000 00000000 >>>> [ 2708.147104] 00000000 00000000 00000000 00000000 >>>> [ 2708.172633] 00000000 00000000 00000000 00000000 >>>> [ 2708.198702] 00000000 0f007806 2500002a 14a527d0 >>>> [ 2732.434127] scsi host1: ib_srp: reconnect succeeded >>>> [ 2733.048023] scsi host1: ib_srp: failed RECV status WR flushed (5) for >>>> CQE ffff8817ed0a9c30 >>>> >>>> [root@localhost ~]# [ 2746.413277] mlx5_0:dump_cqe:262:(pid 15877): dump >>>> error cqe >>>> [ 2746.443240] 00000000 00000000 00000000 00000000 >>>> [ 2746.469323] 00000000 00000000 00000000 00000000 >>>> [ 2746.495310] 00000000 00000000 00000000 00000000 >>>> [ 2746.521407] 00000000 0f007806 25000032 003c7ad0 >>>> [ 2752.445899] scsi host1: ib_srp: reconnect succeeded >>>> [ 2752.481835] scsi host1: ib_srp: failed RECV status WR flushed (5) for >>>> CQE ffff8817ed0a9cf0 >>>> [ 2763.267386] mlx5_0:dump_cqe:262:(pid 15877): dump error cqe >>>> [ 2763.297826] 00000000 00000000 00000000 00000000 >>>> [ 2763.323352] 00000000 00000000 00000000 00000000 >>>> [ 2763.348722] 00000000 00000000 00000000 00000000 >>>> [ 2763.374681] 00000000 0f007806 2500003a 00084bd0 >>>> >>>> [root@localhost ~]# [ 2769.385203] fast_io_fail_tmo expired for SRP >>>> port-1:1 / host1. >>>> [ 2769.415956] scsi host1: ib_srp: reconnect succeeded >>>> [ 2769.450258] scsi host1: ib_srp: failed RECV status WR flushed (5) for >>>> CQE ffff8817ed0a9cf0 >>>> [ 2780.064627] mlx5_0:dump_cqe:262:(pid 18771): dump error cqe >>>> [ 2780.093520] 00000000 00000000 00000000 00000000 >>>> [ 2780.120067] 00000000 00000000 00000000 00000000 >>>> [ 2780.145575] 00000000 00000000 00000000 00000000 >>>> [ 2780.171153] 00000000 0f007806 25000042 000833d0 >>>> [ 2785.923399] scsi host1: ib_srp: reconnect succeeded >>>> [ 2785.957504] scsi host1: ib_srp: failed RECV status WR flushed (5) for >>>> CQE ffff8817ed0a9cf0 >>>> [ 2796.463426] mlx5_0:dump_cqe:262:(pid 18771): dump error cqe >>>> [ 2796.495257] 00000000 00000000 00000000 00000000 >>>> [ 2796.521506] 00000000 00000000 00000000 00000000 >>>> [ 2796.547640] 00000000 00000000 00000000 00000000 >>>> [ 2796.573120] 00000000 0f007806 2500004a 00083bd0 >>>> [ 2802.562578] scsi host1: ib_srp: reconnect succeeded >>>> [ 2802.596880] scsi host1: ib_srp: failed RECV status WR flushed (5) for >>>> CQE ffff8817ed0a9cf0 >>>> >>>> Regards >>>> Laurence >>>> >>> >> Doing this now >> Thanks >> Laurence > > Max > > The Patch is not correct. > > drivers/infiniband/hw/mlx5/mr.c: In function 'mlx5_alloc_priv_descs': > drivers/infiniband/hw/mlx5/mr.c:1406:30: error: 'struct ib_device' has no member named 'attr' > WARN_ON_ONCE(ndescs > device->attr.max_fast_reg_page_list_len); > ^ > ./include/asm-generic/bug.h:117:27: note: in definition of macro 'WARN_ON_ONCE' > int __ret_warn_once = !!(condition); \ > > I think you meant to give me > > WARN_ON_ONCE(ndescs > ib_device_attr->attr.max_fast_reg_page_list_len); > > Can you confirm Hi Laurence, should be device->attrs.max_fast_reg_page_list_len. please check this one that might solve the issue (on top of everything): mlx5_klm)); if (err) thanks, Max. > > Thanks > Laurence > --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index b8f9382..063d116 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1559,7 +1559,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, mr->max_descs = ndescs; } else if (mr_type == IB_MR_TYPE_SG_GAPS) { mr->access_mode = MLX5_MKC_ACCESS_MODE_KLMS; - + MLX5_SET(mkc, mkc, translations_octword_size, ALIGN(max_num_sg + 1, 4)); err = mlx5_alloc_priv_descs(pd->device, mr, ndescs, sizeof(struct