Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp235436pxb; Mon, 13 Sep 2021 17:57:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOWNUQexP1lyr28jKdwDJFsWjjoKWqC8kItsVadEHBBFuj9CVGJJJF45aGAvoiC5F6vPEu X-Received: by 2002:aa7:cf15:: with SMTP id a21mr16232106edy.152.1631581066370; Mon, 13 Sep 2021 17:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631581066; cv=none; d=google.com; s=arc-20160816; b=HQ4LKytAQXDLVdIozvkjgHxrym4leUoIhikus7OACZ+kfmQ4nINz/W7PwS5FxsnLUg LVw6nR8ZoddFfDPkvcJzOckcBuKjWdriRIdrHOhcm3HBJRqFq+nqQVUrBE+7qTvF991g PFtIuGNA4E4uDbHmuQMHm3ccOWy1YsiwDzkcafP3vVXdE4cxfna0G1IJ4qgRINQhi0Om 25rSTZzw3fy3XMcaU3PqU8QxxGUg01pMyr3u7ckxf8o9z6AP3r+3hrxu/cy2n5xyuJda POwc+q2DGGtZZp/2MnbCeOcJBTZTNm23Uo3RcviUUCPAIvmNFVjXOBbS59IZAiEC8YPo KQ+Q== 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=HM9AKRoKfSfRGazDVWKMB6T2NDUKs9/EKkIlbsQJ7Uc=; b=pFqe2Mwfjoi1hl2ENwn1ReAgvMjZ+aafZmnznxuW8cQEkDvSuS7/f8jz4f1U0tup+s UJo138zOfq0O3t4zfdhRuRpW1WkX6HgRE9fR1CHT9iT91iiw/YGfr3GRS3hDfXkL9npR azToBkU3F0WEGpcr64+o2B4JsftMgAxtj4CGePmZXKrc89WJzL453UlbF1V5EuAcwX3/ 9KKCUgwHh3bj1PVm3L8J9UFvG51ZYX8wd2HTK5WNGXQjlrF6pM/7KfcfEc6V+hyuz0Zu BVOq/cB7vAz2ER6kXjhzsZ/k5SL17XqvuO112eLNiCIzNJ+DsZiHlst1hb5S96Uk6bK5 +t1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=ioWH9sjM; 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 ga2si9573995ejc.213.2021.09.13.17.57.22; Mon, 13 Sep 2021 17:57:46 -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=@ffwll.ch header.s=google header.b=ioWH9sjM; 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 S241881AbhIMTYV (ORCPT + 99 others); Mon, 13 Sep 2021 15:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240837AbhIMTYU (ORCPT ); Mon, 13 Sep 2021 15:24:20 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D8FC061574 for ; Mon, 13 Sep 2021 12:23:04 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id i8-20020a056830402800b0051afc3e373aso14880064ots.5 for ; Mon, 13 Sep 2021 12:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HM9AKRoKfSfRGazDVWKMB6T2NDUKs9/EKkIlbsQJ7Uc=; b=ioWH9sjMHm4OXe5UAs73f2LzwqRWvK9JxD6WiCECAdV3XprxcdW/wQnRz533DERIl1 85ZarTVYpTnl9FPafYaUA6fdao4BXI9Npld6i4E5KeOJitA3beUpuZZVW9S9QhlDVznl GylgeAgD8eqGBjYSRJaorOustTRLS7dZESJ5k= 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=HM9AKRoKfSfRGazDVWKMB6T2NDUKs9/EKkIlbsQJ7Uc=; b=xqXOb16WfNSBS1KCUktXk9tfr3xq5Rl/h2xo1EWz+tBC2n7iLdLbZJMgg2i7rARx+Q MDHOyBxwn8DOzaaQ0QRc97ACrmoBJ/k0jukw2rlZ1PfjXAlATQOf8zwUyDnITDHegmNZ vzkDumqb8XbxcLYSwRJC7F+7excHw0X9qRCZbQoJgRbbN3XqBjjfbQ3JzPJT8JxmzI+/ P6pPz0JdaNF2TSGu7evLdisj7ry9y0SV0l9+xJmXJ7+P6pjSH5mjAL+G/8DavLFj/JnW Ow5QStR8e1jO4ohBw7ipzHVorh28nxbN5WyE+iQFBuO5sE70RmVhSiJ/77URPcL/iiqn ZwQg== X-Gm-Message-State: AOAM532QWuXTd/dQZUq5+ijjwk0iR62rDofg7Vg16SFF/q2/rvNZOq+x qF6IykPt1TaXO30zDdv0uRdvZR8OIFoovTCzQLtWFA== X-Received: by 2002:a9d:67c1:: with SMTP id c1mr11052955otn.239.1631560983868; Mon, 13 Sep 2021 12:23:03 -0700 (PDT) MIME-Version: 1.0 References: <20210908061611.69823-1-mie@igel.co.jp> <20210908061611.69823-2-mie@igel.co.jp> <20210908111804.GX1200268@ziepe.ca> <1c0356f5-19cf-e883-3d96-82a87d0cffcb@amd.com> <20210908233354.GB3544071@ziepe.ca> In-Reply-To: From: Daniel Vetter Date: Mon, 13 Sep 2021 21:22:52 +0200 Message-ID: Subject: Re: [RFC PATCH 1/3] RDMA/umem: Change for rdma devices has not dma device To: Shunsuke Mie Cc: Jason Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= , Christoph Hellwig , Zhu Yanjun , Alex Deucher , Doug Ledford , Jianxin Xiong , Leon Romanovsky , Linux Kernel Mailing List , linux-rdma , 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 On Fri, Sep 10, 2021 at 3:46 AM Shunsuke Mie wrote: > > 2021=E5=B9=B49=E6=9C=889=E6=97=A5(=E6=9C=A8) 18:26 Daniel Vetter : > > > > On Thu, Sep 9, 2021 at 1:33 AM Jason Gunthorpe wrote: > > > On Wed, Sep 08, 2021 at 09:22:37PM +0200, Daniel Vetter wrote: > > > > On Wed, Sep 8, 2021 at 3:33 PM Christian K=C3=B6nig wrote: > > > > > Am 08.09.21 um 13:18 schrieb Jason Gunthorpe: > > > > > > On Wed, Sep 08, 2021 at 05:41:39PM +0900, Shunsuke Mie wrote: > > > > > >> 2021=E5=B9=B49=E6=9C=888=E6=97=A5(=E6=B0=B4) 16:20 Christoph H= ellwig : > > > > > >>> On Wed, Sep 08, 2021 at 04:01:14PM +0900, Shunsuke Mie wrote: > > > > > >>>> Thank you for your comment. > > > > > >>>>> On Wed, Sep 08, 2021 at 03:16:09PM +0900, Shunsuke Mie wrot= e: > > > > > >>>>>> To share memory space using dma-buf, a API of the dma-buf = requires dma > > > > > >>>>>> device, but devices such as rxe do not have a dma device. = For those case, > > > > > >>>>>> change to specify a device of struct ib instead of the dma= device. > > > > > >>>>> So if dma-buf doesn't actually need a device to dma map why= do we ever > > > > > >>>>> pass the dma_device here? Something does not add up. > > > > > >>>> As described in the dma-buf api guide [1], the dma_device is= used by dma-buf > > > > > >>>> exporter to know the device buffer constraints of importer. > > > > > >>>> [1] https://nam11.safelinks.protection.outlook.com/?url=3Dht= tps%3A%2F%2Flwn.net%2FArticles%2F489703%2F&data=3D04%7C01%7Cchristian.k= oenig%40amd.com%7C4d18470a94df4ed24c8108d972ba5591%7C3dd8961fe4884e608e11a8= 2d994e183d%7C0%7C0%7C637666967356417448%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4= wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=3D= ARwQyo%2BCjMohaNbyREofToHIj2bndL5L0HaU9cOrYq4%3D&reserved=3D0 > > > > > >>> Which means for rxe you'd also have to pass the one for the u= nderlying > > > > > >>> net device. > > > > > >> I thought of that way too. In that case, the memory region is = constrained by the > > > > > >> net device, but rxe driver copies data using CPU. To avoid the= constraints, I > > > > > >> decided to use the ib device. > > > > > > Well, that is the whole problem. > > > > > > > > > > > > We can't mix the dmabuf stuff people are doing that doesn't fil= l in > > > > > > the CPU pages in the SGL with RXE - it is simply impossible as = things > > > > > > currently are for RXE to acess this non-struct page memory. > > > > > > > > > > Yeah, agree that doesn't make much sense. > > > > > > > > > > When you want to access the data with the CPU then why do you wan= t to > > > > > use DMA-buf in the first place? > > > > > > > > > > Please keep in mind that there is work ongoing to replace the sg = table > > > > > with an DMA address array and so make the underlying struct page > > > > > inaccessible for importers. > > > > > > > > Also if you do have a dma-buf, you can just dma_buf_vmap() the buff= er > > > > for cpu access. Which intentionally does not require any device. No > > > > idea why there's a dma_buf_attach involved. Now not all exporters > > > > support this, but that's fixable, and you must call > > > > dma_buf_begin/end_cpu_access for cache management if the allocation > > > > isn't cpu coherent. But it's all there, no need to apply hacks of > > > > allowing a wrong device or other fun things. > > > > > > Can rxe leave the vmap in place potentially forever? > > > > Yeah, it's like perma-pinning the buffer into system memory for > > non-p2p dma-buf sharing. We just squint and pretend that can't be > > abused too badly :-) On 32bit you'll run out of vmap space rather > > quickly, but that's not something anyone cares about here either. We > > have a bunch of more sw modesetting drivers in drm which use > > dma_buf_vmap() like this, so it's all fine. > > -Daniel > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > http://blog.ffwll.ch > > Thanks for your comments. > > In the first place, the CMA region cannot be used for RDMA because the > region has no struct page. In addition, some GPU drivers use CMA and shar= e > the region as dma-buf. As a result, RDMA cannot transfer for the region. = To > solve this problem, rxe dma-buf support is better I thought. > > I'll consider and redesign the rxe dma-buf support using the dma_buf_vmap= () > instead of the dma_buf_dynamic_attach(). btw for next version please cc dri-devel. get_maintainers.pl should pick it up for these patches. -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch