Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp819787pxb; Wed, 8 Sep 2021 13:09:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCMzsSSjeX7XObQU7Ixyo8pmFArYSDfQZowZOPCMoY6teVqjxmBfzokkKLnBX+XdO1AJLr X-Received: by 2002:a05:6402:34c5:: with SMTP id w5mr18381edc.67.1631131784139; Wed, 08 Sep 2021 13:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631131784; cv=none; d=google.com; s=arc-20160816; b=o8NIUQENRTGkJY5ouJW5xz4po3sJXw8xqQV+7/jDlpEFaJLU3yPSx6uV9umZhguOMC HfSkSGX/J1mjVKZpKYO2JmZd+Yndk7JIiQBedQgIVNUU7yZ28T0GOuy0GNYQYSJ8wTQu TV1VJh4OwKbQXNcOpr0DzI2a/eutsJCpbnvfMVTzOvew1kApbc+SSo8QVfdH/z/Kc6nt AkNq2+tqXW2suYDMzjlAkf5DoXwklMQXqHcaIpbPVVu0BKC1Sv2AFs2XZNCtpJIygL3y gGfJo+uqUynOJJQW/1gZsBIy1W6XJYuRTc98tg+6yAH5j6+wzEeqgGySA5eBeAnWTakB bpKw== 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=61wtExygeBHNU8JF1VKoq8GwGXMXla9fnLJNWz4U874=; b=Sf09oeB8+3PGmGrwnXMw+CaGJPm5IOPS9ZUvYxsY2MkFeplpQrRvfdlKLlfyLStgEI DxfFq9nUf17OcJzO9mAOEcg8IhXyEiM2BGFyeg9lVHoSytrnpFPRZSv1JNW7vCEVYuQ4 fSueBA00jdIECnuOrnNiQlhL1CmNl7WG1aysig0+mBuoLBU2kELQFauNxyvcFQHTYlfM IRMc/1J/dlGB7sBoDUzMArcLCys1MdfQJUCa2jUuS92OPCIv1heufrLDbOW0245LeO/7 o95nXDtW9d0vb8h4oTOQhFz0f3R0+4eCQCBJt/HytiDOJDUE1V+ci1XeXLv6E6QaJhL8 NaJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=Qkoyhe9Z; 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 h20si9516ejt.70.2021.09.08.13.08.52; Wed, 08 Sep 2021 13:09:44 -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=Qkoyhe9Z; 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 S1349847AbhIHTX6 (ORCPT + 99 others); Wed, 8 Sep 2021 15:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240049AbhIHTX5 (ORCPT ); Wed, 8 Sep 2021 15:23:57 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3172C061575 for ; Wed, 8 Sep 2021 12:22:49 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id bd1so4457198oib.5 for ; Wed, 08 Sep 2021 12:22:49 -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=61wtExygeBHNU8JF1VKoq8GwGXMXla9fnLJNWz4U874=; b=Qkoyhe9Z1+0BPnng/Vdy7xf4dQsH7MUTBdaZI9INIgnp8jPW8UvHsIV+/SLr1kumRx RWELex1z74aqpLUB/5ap0BCWYE7chvPYDFixzzTLhO1/caJZVbqPV/Cr4ScDuKdBaYJR p9T25XKOTz/tFO5XYp6qAa8sIqTdSRnSz0prs= 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=61wtExygeBHNU8JF1VKoq8GwGXMXla9fnLJNWz4U874=; b=3Z8iXnri8Tg9LCIv9QjTk43IZrqswj6G6mAEOzMsUf7QcqEpE8Z7DgoSF0tQsQOUZV IFTPZA/V0iuP/qJue1pNcPbcD+mxvRXogQnHkhbyBWEX7oaF6DurjnLnVrh6OcK9ez9u 7bFn68ELMFoOHK4EAagKofOJearf+Sd7RIi2TjR+E4Bc5R9hGfEoiCPC2GYefRb+uZH8 Iy3tf1flsann1aC4ru0Tj3vbqWWK7YWLKgllxwGj7aOdEIYqGMuOzcV2uNmMdPeKPK6i sp6tNvwChZ5ViAogTIx543/ipngf3T5ZWT1q2gHestnw9CMAQtznEFyybAt1jKHQbvj6 /oqA== X-Gm-Message-State: AOAM530cGmVgC4VhT9POWVLawpa64tunYdKf9C/rkpIzVjnG4kTmYnRT GhSUPhTvjZAh8r1spe1A7FScWa1Q54VOeKR90g0a/g== X-Received: by 2002:aca:3954:: with SMTP id g81mr3572533oia.101.1631128969002; Wed, 08 Sep 2021 12:22:49 -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> In-Reply-To: <1c0356f5-19cf-e883-3d96-82a87d0cffcb@amd.com> From: Daniel Vetter Date: Wed, 8 Sep 2021 21:22:37 +0200 Message-ID: Subject: Re: [RFC PATCH 1/3] RDMA/umem: Change for rdma devices has not dma device To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Jason Gunthorpe , Shunsuke Mie , 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 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 Hellwig <= hch@infradead.org>: > >>> 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 wrote: > >>>>>> 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 thos= e 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 e= ver > >>>>> 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=3Dhttps%3A%2= F%2Flwn.net%2FArticles%2F489703%2F&data=3D04%7C01%7Cchristian.koenig%40= amd.com%7C4d18470a94df4ed24c8108d972ba5591%7C3dd8961fe4884e608e11a82d994e18= 3d%7C0%7C0%7C637666967356417448%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDA= iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=3DARwQyo%2= BCjMohaNbyREofToHIj2bndL5L0HaU9cOrYq4%3D&reserved=3D0 > >>> Which means for rxe you'd also have to pass the one for the underlyin= g > >>> net device. > >> I thought of that way too. In that case, the memory region is constrai= ned by the > >> net device, but rxe driver copies data using CPU. To avoid the constra= ints, 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 fill 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 want 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 buffer 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. -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch