Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp256224pxb; Thu, 30 Sep 2021 05:32:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1UsXMfTY9/ayVuCa9t+fv4gq6B6jt8sMNc9dxFr9/RyPUYdxyYBUisBxXhkGDiEP1rN3g X-Received: by 2002:a17:906:e4b:: with SMTP id q11mr2354655eji.234.1633005144433; Thu, 30 Sep 2021 05:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633005144; cv=none; d=google.com; s=arc-20160816; b=YpR/7cXJFIUJlAjdnlsiab9docK6yJtzpBrzXNpDBc+aZecnDjQRwIZb7GPVovuKC+ iB8y9HS7fJ4f0p+31WGbbnJEXUYYVIU4LFwKx0TdhjCzxBhOjN2iIKndIHdS+5lhOHw4 97u3hyMHAnLmo/QZUYEKwNfRAb5jsa3xrbDw85kb9tCye+BpUV6pgMxbMpMYr/NyQ06K btoYd6CBxmGnqpozKqGvO5SPwW28JKnTkbi4afAzFIWeELLPyE7x0DZtooaIDCRsQ8X2 UzqgCV1MKIetKGvxkUKmSB2v3PfXm16hi6RUKTfYb37ESjv5SJ1G3Obahxv+fQmKWcEg 1vhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uXuubpiaHvCGjqJffAaQTQ1G86vGkNu1fG+McR/4pJE=; b=hzJQKScDlxtPR8lkR4IPuot3Scyr0Tj27byFEHLA2CjNDip35E2C4GIXrgQQGQk/cu ZtK8GPxbVqAIQBN5KMBthoMDy7qh19UtEoiZG6LJOGCHmjWvg0d6svq+PUtgSyGoOpbD D5PApt8+oUW6nkCeQYLiIjacJ67Q0DEXhyDIkrEF0wlcf/v93uejLTSh7kg25k3jReK4 16hHZUC3tvtVUuEDnrLWhx1zixeSvh+G+XGuKMasLjZ1y1t4nyTUOCl9ghEWGhWRWirN ofpCcLkvP01f8HvyIAUjpOke1e3QO2th2stsRP59T8MLOryHV1UyaFeI0o/O40cCqNK7 EdXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=1YXxmYyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si2976798edf.629.2021.09.30.05.31.59; Thu, 30 Sep 2021 05:32:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=1YXxmYyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350408AbhI3L0n (ORCPT + 99 others); Thu, 30 Sep 2021 07:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350403AbhI3L0m (ORCPT ); Thu, 30 Sep 2021 07:26:42 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D14AFC06176D for ; Thu, 30 Sep 2021 04:24:59 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id y26so23827864lfa.11 for ; Thu, 30 Sep 2021 04:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uXuubpiaHvCGjqJffAaQTQ1G86vGkNu1fG+McR/4pJE=; b=1YXxmYyDwyXa/pLD69OSg2dh2mD/CUMQXRNl40rzYEuhbROwsKquSxKvdFuafnh9vu vYUv21YMe6/waaoWrHcGy9OAvWlWqt+7dQwi4CwP7Ou/STf13JOOpmLQUE/rQ70KI9CI KdhgUmW8bEVEEcVf9ek3SNqrlb6QD4+nD3cWr0fLeTWesHQsbzWK0vj/6Bq6gHy6zov3 WDcdEgbBKrYpRCx/lgkqmSkSdWfy/ee6civKUNyF51TXweZEq9IS8wZ4eoWb+HvTKOo6 8jKkubBqoMB8V8kxGb0nPYbNuLDNlG6siN2Q6X4afp3NO8jFV2mPIDxL0UDVeOOgG4xB uayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uXuubpiaHvCGjqJffAaQTQ1G86vGkNu1fG+McR/4pJE=; b=HfVroEKOtCpPDhCeORGgu7UkZvYyP4p3dQyWUdFbkT0ed2tsCuaW8mdjGyJAQRzAx7 aYsV6lMyrQsC2y25P65JHQaWQww8KNKZHipwpYBy0+uxci5+zGdIIHT2e6oIwclBrXVN la+NsQwzR1Mkc7xtCNB9aKZUIfj72sMC+ds+T+ARBmYb9VW0Rw8kCCniQDJfIsZinG01 oigZ1VbdANBy794K9rn1eU6lYH4cbCzDScFcrboY5+6WhPAtQpSSdBRNG4xwpONfTOL1 jTuNEAicJNaOorXD007gGxEp11S898uVZzcOw/kveE1/3DIKSNwl+f3U2Q7Q/CGi16kP dzIA== X-Gm-Message-State: AOAM5336QP3ZpMDz6NDlJzNtcT1lVEdA633UpWc5tINUeNrPjoX74ZHG enYHvi9ws6MDD5mk5mLmYKnqPnLPY8R9IMhMbJU8WQ== X-Received: by 2002:a2e:904a:: with SMTP id n10mr5131362ljg.124.1633001098105; Thu, 30 Sep 2021 04:24:58 -0700 (PDT) MIME-Version: 1.0 References: <20210930062014.38200-1-mie@igel.co.jp> <20210930062014.38200-2-mie@igel.co.jp> In-Reply-To: From: Shunsuke Mie Date: Thu, 30 Sep 2021 20:24:46 +0900 Message-ID: Subject: Re: [RFC PATCH v2 1/1] Providers/rxe: Add dma-buf support To: Zhu Yanjun Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Alex Deucher , Daniel Vetter , Doug Ledford , Jason Gunthorpe , Jianxin Xiong , Leon Romanovsky , Maor Gottlieb , Sean Hefty , Sumit Semwal , dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, LKML , RDMA mailing list , Damian Hobson-Garcia , Takanari Hayama , Tomohito Esaki Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2021=E5=B9=B49=E6=9C=8830=E6=97=A5(=E6=9C=A8) 20:18 Zhu Yanjun : > > On Thu, Sep 30, 2021 at 7:06 PM Shunsuke Mie wrote: > > > > 2021=E5=B9=B49=E6=9C=8830=E6=97=A5(=E6=9C=A8) 16:23 Zhu Yanjun : > > > > > > On Thu, Sep 30, 2021 at 2:58 PM Shunsuke Mie wrote: > > > > > > > > 2021=E5=B9=B49=E6=9C=8830=E6=97=A5(=E6=9C=A8) 15:37 Zhu Yanjun : > > > > > > > > > > On Thu, Sep 30, 2021 at 2:20 PM Shunsuke Mie wro= te: > > > > > > > > > > > > Implement a new provider method for dma-buf base memory registr= ation. > > > > > > > > > > > > Signed-off-by: Shunsuke Mie > > > > > > --- > > > > > > providers/rxe/rxe.c | 21 +++++++++++++++++++++ > > > > > > 1 file changed, 21 insertions(+) > > > > > > > > > > > > diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c > > > > > > index 3c3ea8bb..84e00e60 100644 > > > > > > --- a/providers/rxe/rxe.c > > > > > > +++ b/providers/rxe/rxe.c > > > > > > @@ -239,6 +239,26 @@ static struct ibv_mr *rxe_reg_mr(struct ib= v_pd *pd, void *addr, size_t length, > > > > > > return &vmr->ibv_mr; > > > > > > } > > > > > > > > > > > > +static struct ibv_mr *rxe_reg_dmabuf_mr(struct ibv_pd *pd, uin= t64_t offset, > > > > > > + size_t length, uint64_t= iova, int fd, > > > > > > + int access) > > > > > > +{ > > > > > > + struct verbs_mr *vmr; > > > > > > + int ret; > > > > > > + > > > > > > + vmr =3D malloc(sizeof(*vmr)); > > > > > > + if (!vmr) > > > > > > + return NULL; > > > > > > + > > > > > > > > > > Do we need to set vmr to zero like the following? > > > > > > > > > > memset(vmr, 0, sizeof(*vmr)); > > > > > > > > > > Zhu Yanjun > > > > Thank you for your quick response. > > > > > > > > I think it is better to clear the vmr. Actually the mlx5 driver all= ocates > > > > the vmr using calloc(). > > > > > > > > In addition, rxe_reg_mr() (not rxe_reg_dmabuf_mr()) is used the mal= loc > > > > and not clear the vmr. I think It has to be fixed too. Should I mak= e > > > > another patch to fix this problem? > > > > > > Yes. Please. > > > > > > Zhu Yanjun > > > > > > > > > > > Thanks a lot. > > > > Shunsuke > > > > > > > > ~ > > > > I looked into the vmr more, but there was no need to clear it. Moreover= , > > some implementations also use malloc without memory clear. > > > > I confronted a lot of problems with memory not initialization. > And a latest bug is https://www.spinics.net/lists/linux-rdma/msg105001.ht= ml > > So it is a good habit to clear a newly allocated memory. > > Zhu Yanjun > > > Thanks, > > Shunsuke Ok, I understand that thought. I'll send a patch. Shunsuke.