Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp33275pxb; Wed, 29 Sep 2021 23:59:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd0ejZzLLrsnu/wWq5ExgdUgI2iGBOjoHKhgv7zLgE6eXGSrkJP7sDWsGxBYejM2zJbv8x X-Received: by 2002:a17:90a:3b09:: with SMTP id d9mr11190336pjc.128.1632985191460; Wed, 29 Sep 2021 23:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632985191; cv=none; d=google.com; s=arc-20160816; b=EmV8EhpXo50+fLeS1+O7Ys0lKpGOSgMptMpwtS4a9h1knPTzPeD7rTDDdJlL+UFOAB CwP/69opzY0vE6bsXAljMSP6Z+cUXK8mECsVQ218h9T8FG9KZ/cd8w+XYMvmf3ZAPzRA pAZygd4CSZtSb5oxpcReNd6s3mlBfpzg+wgml8Tc3SxrUuhCz6XGZP148ydDT7E+pbo3 aMruRBAwRxwrcqdgJZW+8d/dqtv9CLTVLwVtaBAw6pvpv3ExMnuT9uYf0Eupqo9GO4Ux WRWsVqOEC8GlmefuCop52XNVec8/isY9+Tcey82CWZYE6DS1lS0bRrQkKQCAqLsnJuDk tO1w== 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=AM58cnJzWheq7pN6e6L+Di8EyxwT/TZuwdLAOFe5lTM=; b=zcpjk/Khshd3Wg0ugImsMDuMPVQUXT8zJIyqlwnwnXEkfJqxFhxbh622NG8YSM303p z854xIUpdEmiE9PGzTPkGGAlbSFWHrYc3u8ZoEhp3yivLLCtSpyA04VNtrbyOnNHbM8I /lgDW112zFECwbUpmRGJ5GN/LtlkoxzmrGsifByMu0VZrz1z8iEPBa2n1xSv3JItb7+5 St0vW17netEh5eFmU8Ur2eMt7tjwm8aTau6GoGC7FzQzAXgfx4IpkceVOnEDliDlF9kW W/aqUoZyhoy8oAQSCBBap2l8Lv5xVtwtrN0RG/rUXyDcb4FWVgXRjLbTkxfNWl6TW/2x UsLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=zUA02mDi; 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 l11si2591602pgp.521.2021.09.29.23.59.38; Wed, 29 Sep 2021 23:59:51 -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=zUA02mDi; 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 S1348437AbhI3G76 (ORCPT + 99 others); Thu, 30 Sep 2021 02:59:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348434AbhI3G74 (ORCPT ); Thu, 30 Sep 2021 02:59:56 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D5E9C06176A for ; Wed, 29 Sep 2021 23:58:13 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id z24so21005813lfu.13 for ; Wed, 29 Sep 2021 23:58:13 -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=AM58cnJzWheq7pN6e6L+Di8EyxwT/TZuwdLAOFe5lTM=; b=zUA02mDiD7ySh4VXdtJEkfF+YdiTY26SnB/zKlU6AV6H7K06hWuMhIkqyICSRgwmLh mMJqj75qYMRjZUryj8QznGOt1/uDr4q20FUyRlmfjvyWGDa9fNh1/KqmeTmllPC6LWsE x4UA5ycScWSfPjOhkCW04pIaQRZYoSk1kxBDhV5iIfdgOPXgQIurppjGXWQBQKV44tdK e3xYCw8TWtFK4EQHVWDRiAj+PrQUHjPo23h+iyjT1HwajPzvid5J/T6xDSKDma7HJFnH Cj5iu6tWUHc/wClUvPhMJJqFlksmjgvu0yQ5HqUPJilAeIxDFCaEgOlTE9y+38eHL9g4 81Cw== 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=AM58cnJzWheq7pN6e6L+Di8EyxwT/TZuwdLAOFe5lTM=; b=0tKq9QDMnmQdIYcWR/Bcr+fg52U/jZCbBjy1CaXjzmGpUOLYgjRUph2c7rTHG7g/4i kPPQ4+BS+AzMjoBHud5fGYDj3ZyM9fwCvOEF8j5xBWjG4x/+w3KxUyvEiyFcSgxIQZyQ ywZ71y7VDiX8OonIqXNVLFHzCZ0VZ5hKf85PxIhaCPxTL1WmEc/BfTxtx2EMv1ib7BMT CKPrxi4IP1PyZE4xfhT9CfesGAvWwExWKRD8ppGNPzcAX1boKwe5FdoJJl7H2pxFphFk BvGUenTLGqEQLiTyBYGyrkGhGk6vYCgUfstNNQr+38hHZ9BZgKzYnTp1u78rdbF2YaNo 8PDg== X-Gm-Message-State: AOAM532kro/nxyjRBkVCkau1Qgl9ySmOMi1x9X6JWZ4oZPGMrCgfu4pg u/TZ1bdhONrKszdWRHN/SBzhMHEkZeKJGHTVOOI80A== X-Received: by 2002:a19:f507:: with SMTP id j7mr4119788lfb.645.1632985091555; Wed, 29 Sep 2021 23:58:11 -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 15:58:00 +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) 15:37 Zhu Yanjun : > > On Thu, Sep 30, 2021 at 2:20 PM Shunsuke Mie wrote: > > > > Implement a new provider method for dma-buf base memory registration. > > > > 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 ibv_pd *pd= , void *addr, size_t length, > > return &vmr->ibv_mr; > > } > > > > +static struct ibv_mr *rxe_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t of= fset, > > + size_t length, uint64_t iova, i= nt 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 allocates the vmr using calloc(). In addition, rxe_reg_mr() (not rxe_reg_dmabuf_mr()) is used the malloc and not clear the vmr. I think It has to be fixed too. Should I make another patch to fix this problem? Thanks a lot. Shunsuke ~