From patchwork Wed May 3 08:18:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9708979 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 4CDF460385 for ; Wed, 3 May 2017 08:18:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37CF328520 for ; Wed, 3 May 2017 08:18:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2706128576; Wed, 3 May 2017 08:18:46 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 744AC28520 for ; Wed, 3 May 2017 08:18:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751696AbdECISo (ORCPT ); Wed, 3 May 2017 04:18:44 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35203 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbdECISm (ORCPT ); Wed, 3 May 2017 04:18:42 -0400 Received: by mail-wm0-f66.google.com with SMTP id d79so10837545wmi.2 for ; Wed, 03 May 2017 01:18:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=jfKSzaxa7umvKxc84z2lxJ4DBVZVhwKhwee9Q0ZG60c=; b=lpkX8Cdmz+/QtrfjiGvvU5yPjpNR2s7Gp23Tb5bei+824SYTS1n+X25EnLuH/EamZo s/0KlcAfys62ID5VpX+YMmBXrBg6nnDQsomQNI6eaaOq/FaR/Z9ivArBlz3FQkLB37hn 8qHYorDPhKCjgIjdV+nbot02JxWv4okOl7l56TrpblY0+lBUVLFEzq++rL3EQ2sIuDQe KH1CzNqiLfgh4KSwGnMzeMnw+pb3AGtgzRaHunAnVigxSXDAqeAYwbK7rBLnvtrn9NoR bpFCOkvLSqowA38OJA11/5h5ku60DSTco4c/De4366onOQTdt1YJ6BP1pT7elQsmd5Vw Gr5w== X-Gm-Message-State: AN3rC/4FULXjykPk64+hQyK+WYrOFa7pQ8Qm86fXwycvjVwssh232iCA v6KFN0nnahry/Q== X-Received: by 10.28.129.201 with SMTP id c192mr875043wmd.22.1493799521299; Wed, 03 May 2017 01:18:41 -0700 (PDT) Received: from [192.168.64.116] (bzq-82-81-101-184.red.bezeqint.net. [82.81.101.184]) by smtp.gmail.com with ESMTPSA id e23sm26899348wre.54.2017.05.03.01.18.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 May 2017 01:18:40 -0700 (PDT) Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array To: Leon Romanovsky , Laurence Oberman References: <8992bd28-667f-94b1-e582-106e6b41aa4b@sandisk.com> <20170425175849.GS14088@mtr-leonro.local> <438230391.2090966.1493152655709.JavaMail.zimbra@redhat.com> <20170426061640.GV14088@mtr-leonro.local> Cc: Bart Van Assche , Doug Ledford , Max Gurtovoy , Israel Rukshin , linux-rdma@vger.kernel.org From: Sagi Grimberg Message-ID: Date: Wed, 3 May 2017 11:18:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170426061640.GV14088@mtr-leonro.local> 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 >> 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 >> >> 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 > > Parsed version: > hw_error_syndrome : 0xf > hw_syndrome_type : 0x0 > vendor_error_syndrome : 0x78 > syndrome : MEMORY_WINDOW_BIND_ERROR (0x6) > s_wqe_opcode : UMR (0x25) > opcode : REQUESTOR_ERROR (0xd) > cqe_format : NO_INLINE_DATA (0x0) > owner : 0x0 > > Description: > umr.klm_octoword_count > mkey.mtt_octoword_count > > Sagi, Max, > Any idea where can it be? Laurence, Max, We need to make sure that we never overflow number of mapping elements. Looking at the code, it seems that some of it was reworked by Artemy for ODP. Laurence, can you try and retest the below patch: --- static void set_linv_mkey_seg(struct mlx5_mkey_seg *seg) -- -- 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/qp.c b/drivers/infiniband/hw/mlx5/qp.c index ad8a2638e339..76f3857ecd53 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -3224,22 +3224,19 @@ static void set_reg_mkey_seg(struct mlx5_mkey_seg *seg, struct mlx5_ib_mr *mr, u32 key, int access) { - int ndescs = ALIGN(mr->ndescs, 8) >> 1; + int size = mr->ndescs * mr->desc_size; memset(seg, 0, sizeof(*seg)); if (mr->access_mode == MLX5_MKC_ACCESS_MODE_MTT) seg->log2_page_size = ilog2(mr->ibmr.page_size); - else if (mr->access_mode == MLX5_MKC_ACCESS_MODE_KLMS) - /* KLMs take twice the size of MTTs */ - ndescs *= 2; seg->flags = get_umr_flags(access) | mr->access_mode; seg->qpn_mkey7_0 = cpu_to_be32((key & 0xff) | 0xffffff00); seg->flags_pd = cpu_to_be32(MLX5_MKEY_REMOTE_INVAL); seg->start_addr = cpu_to_be64(mr->ibmr.iova); seg->len = cpu_to_be64(mr->ibmr.length); - seg->xlt_oct_size = cpu_to_be32(ndescs); + seg->xlt_oct_size = cpu_to_be32(get_xlt_octo(size)); }