From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69967C433EF for ; Thu, 30 Sep 2021 11:06:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 529B760F41 for ; Thu, 30 Sep 2021 11:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350345AbhI3LIS (ORCPT ); Thu, 30 Sep 2021 07:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350373AbhI3LIP (ORCPT ); Thu, 30 Sep 2021 07:08:15 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F16B5C06176A for ; Thu, 30 Sep 2021 04:06:32 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id g41so23604502lfv.1 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=7ONihL1L7RpjI1AdQ5RqYA1kjECELVgc5BE8w9/ZEY1FunnRh7BjSjyZ1s5u3hBDjm GXQz86KU1eSqBxEOrHLuvEJj+FXZ1ssW3mwmK6AGieauu+ZylYwzxgR8nhDtyC2oGn7P ful6vozMGgokR0VL+k/e3f/EPaFpZQPba0tMffWPBPZ43CxilDZIc0XwWW9TzE4h3Q7V BDxH+FTciGoVVbwQIg9726KPwRmav0iJjhcKHsdjM0xlt9hswFOAl7KvJp4FiBCwY29C sm6vtuTZnp86YgklguS01eMOROqSJisMaHoqNcbHJY0/JKSJBg2JrYFcW+dDBSRZhblq kexw== X-Gm-Message-State: AOAM531tv7uiTMc0u6HKS+i2t9saCYL36Pr38lEI+hugu0QdUV+1lPvu Fzk5mc4ePOoWjbrs/trw6W2tnwBLCu5kbH1HuxULHA== X-Google-Smtp-Source: ABdhPJxKPRxrbe5NsZ+oT2GuKcakf16+GbMKbAstyqKx6i7dnCgOjsjnMxJC7/+s61S9e60hDcCFzI+NqatuX6dwj8Y= 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-rdma@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