Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp190488pxb; Thu, 30 Sep 2021 04:10:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9qKRVS6jgkqBedpddFGcCWpyQJ7ZJEVrZGJoSg1mFY6xxrQgj9jHxZf40L4QBw9+oIBhi X-Received: by 2002:a50:8206:: with SMTP id 6mr6433305edf.220.1633000231558; Thu, 30 Sep 2021 04:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633000231; cv=none; d=google.com; s=arc-20160816; b=CKYHfjLS+3beh+GPSRAfLri9R5UaGDHWZZ3JmWrsDfdnm27mhGl7U6iLD8nV/oeNrM /vhdn0I4P4y1Sxz9ySpgp2urd6ij7IYKpVlDXqmmzntvATgpulUF81FlX7KhmdCORqix mEMHwpuxf4cFITch2AvjK8GTSiL0u/DCsQjEF4EivpzuTrzWQItW5MrAgads5j/zeKbQ ci5eGnD/xbU1JGNArsTQNLpHoiQXgNYv0/GHaE3KgQMJ8mBRHPcbVcaQnLh+VGbRDyy0 kb9TKl7YSXLNyibbe1Q/BKT8/F7PIt2G3fw9uedGBDPjsCcl8vRHwdqIh3WBx8R6Uox1 BFtQ== 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=Hx1z0Pj0GS4/tUfd4pnSP67CAPCyRWqRNmIUPcowuII=; b=le0jmmvBOmrezPfCi1TJ7bo+h7tWH5OX0paQBh1iDEeAbfXX1eXkkLXfzgjktQatVx oy96uOUTKxI3p9MqDoWwxDXyDjuvWqQ3JyXnifm77WnwPk5k8DXTttGyehojJNCcieFE 1gS4V6lruhu2CNHwHHVQLR3fCrgDOZIlCryidVW0rzpavHQf7hmreUlovdheU4srKoIl iKkxAFE/G5x2sCY1bEm0bVLRST7+JNlgxl8DvLxp252oZ0C59mnhVQ/DtlineL/+y9zX vR8KM3u5KUWC2B+7lAfwkrO5wxUrjSX9FhuuBPY3AnkmXXAK6I9Sfi635hDKI+EkV+nE kqiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=OJ4uZsJw; 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 c24si3078968ejj.636.2021.09.30.04.09.52; Thu, 30 Sep 2021 04:10:31 -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=OJ4uZsJw; 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 S1350373AbhI3LIS (ORCPT + 99 others); Thu, 30 Sep 2021 07:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350375AbhI3LIP (ORCPT ); Thu, 30 Sep 2021 07:08:15 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01916C06176D for ; Thu, 30 Sep 2021 04:06:32 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id j5so18788565lfg.8 for ; Thu, 30 Sep 2021 04:06:32 -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=Hx1z0Pj0GS4/tUfd4pnSP67CAPCyRWqRNmIUPcowuII=; b=OJ4uZsJwV182DcalBRZYBoqbUwKgzPLb3AvWlbx0nO9e5rIolS8SlVDutUiTeD1C/X fS9bjA78G2HNmjq0+vZdZESEkSMR9lug5mBNuCKRaKwGV0LqTAkGHRiuHnsThS43TvD8 YoGUTl8edDquVLUToIqvF/573jxlP0yNvPrSL0BfP3V66/fQsx2JEQxR25WNl7F7ldPd 0cp/7NM8U+yV0emLsUOlUBtiIe0Nr9qNmHAKUEyaVrYGz5lbYwvv4uX+TDQbCFxxCsAv /SPxyUEMSJwrPDXmuaWCxw5j2rqEIGkfU6w1wEnnbp1PlE0+J5TBJpa4Q4TkXJ1i8P4r s83w== 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=Hx1z0Pj0GS4/tUfd4pnSP67CAPCyRWqRNmIUPcowuII=; b=EWPu3XCJM75Gs4MMW6mS+l70cmvOTHi5Zrr1zGbJEK+GDpSn/zR7st8/Tc307t94pK Oii1cjHYnZPXmOWQUrENkjQsWjXS9MjiJv96Gtzc21WKNqIm0op5MlU6EfyhHfvxhfn6 FB3nYlG6GZDpyMUeDYW7rrKxP/2nCmHLvkXMRF/d3DLsEYqL/lyJQOPrBElGNtrnwyKB uLpd0FBZxXkMWkXdYQAjYbg/lExMu8e66LvTw0/iXpc/sNzx2QX96INXvMcLBfNiaTBS I6+ofvehnK+uPJkhs1Q5D4/wEmXrewczD4gTQq5ejxDZ4o2yUTPQBEim0TcsjXMpB0uA Wmwg== X-Gm-Message-State: AOAM533RcJzGLqHNHQ8oOhbF7Qa92KV9T3XUKlJ0y7JL6gPPBtOBkRZf Zgj3XLjvdrZmUm/peOH63nGCGdv70HLujY1wLKu6GA== X-Received: by 2002:ac2:4d99:: with SMTP id g25mr5255275lfe.175.1632999991335; Thu, 30 Sep 2021 04:06:31 -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:06:17 +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) 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 wrote: > > > > > > > > Implement a new provider method for dma-buf base memory registratio= n. > > > > > > > > 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 offset, > > > > + size_t length, uint64_t iov= a, 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 allocat= es > > 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? > > 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. Thanks, Shunsuke