Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4807205pxj; Tue, 22 Jun 2021 08:25:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8yw8FUHRDoAvMtsASzP+uJPMsJqOzPCZHplCATC084OwzYnQcF+5r5HPhhWsdgh9X1IRM X-Received: by 2002:a05:6602:3155:: with SMTP id m21mr647923ioy.145.1624375559284; Tue, 22 Jun 2021 08:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624375559; cv=none; d=google.com; s=arc-20160816; b=WwOUfov+dRy4wXAfEy/OKl8CSFirj+kmzsYJ/CTG7wkF60fC52RMnHh9tqrxZIMDHp 0TM7/AqBLSjNmxAqm0Uep4S2Tz0GTTr5FWxhi4gybJY8ezg0rPmiUl6ZOvPnoMfbE23m MXFAnYnJxEMdGeI0+BnD9ELVUQht2OOiyf1pq+RqXiYKhchCdaqqCq1Yp8D34I8I0b5D sLznlp3LcKqhJebPL58YUCSIhHWZOMA2hPPeb4qgUxhh6Wc/RUvlJUAuJFZ07mSx8aIg or3FwxHMsMuF32+QjWD0/m0igesjAC0UqOdQ3+YOziPycKX0/imIdRlTaT2CzgOpOPtv 1hdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4X+AcHyDDe3HhjQCq2G+eaJ8kvsIjHhuoyLFdEACcnQ=; b=Ii6NPWp8d5y5Lx+Bq9h6WOAKEYb7mYkvp3MZtS6ohGdfxksNC6hZWBwm1yq/TS2dU2 hd3OfriIkV2tokh7072EJsPRmurE/9n7jSIMDP17EFTNh4p6Xafjv4jY15tPdxDu891O ZBfp+kI6YFBf86dVBXs32FMHEK483fg9tI1Ayo2AuYYyGoIciCdP9Kl2KRAK4AKnPc4y 4Tv9KmEGegg6X+tOd91AKw+PMyu+5bNKhXvbj9JGCMtkMLqYEK2a0qvXH7o5bX/KW5ar O+MUC4YAEEJjQb6rI/n5zrGwqyoPMN8+d0JzO/4BMKnYrnzAWuhGWoOsL+li7vV25lKi 6TOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F9cy62wh; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si22215881ioj.5.2021.06.22.08.25.47; Tue, 22 Jun 2021 08:25:59 -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=@gmail.com header.s=20161025 header.b=F9cy62wh; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232284AbhFVP1P (ORCPT + 99 others); Tue, 22 Jun 2021 11:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbhFVP1L (ORCPT ); Tue, 22 Jun 2021 11:27:11 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096F5C061574; Tue, 22 Jun 2021 08:24:56 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id h24-20020a9d64180000b029036edcf8f9a6so21606083otl.3; Tue, 22 Jun 2021 08:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4X+AcHyDDe3HhjQCq2G+eaJ8kvsIjHhuoyLFdEACcnQ=; b=F9cy62wh9RybK9h82fBHPpp8hPDnZx1s+Z0/GOTSU92eNMyNLfj1mmqR2+r3kT8aM1 xYDm3xoWuWMpBQnf+yCUtYaytLMGRdU+gDGi6swnU2/1W4YjA3DmVGgEJEhpqqWEJhiE 01z+W8Xkif0R9mOOrdnFJqQd5G+uUqQGTMfvsT/2xP5BWwkuBCnE6fDDDeJPKFj99hpa IUTx7/RubZA8kR6BUpUTkctQ7E0FSq1LJm9p8lS8IeiHhgNrTRG9ObqVGWK0oLwjI4ER nWl4Jh30VyNTX8WV9ruVKyd0scG13WLdSbrapyE0pKhuHbHyEx+IQYLAiGL9vT11KyaE aOoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4X+AcHyDDe3HhjQCq2G+eaJ8kvsIjHhuoyLFdEACcnQ=; b=Eh7SchjWN0/sC0XIQzwQqaR68iJ7uySxMQOMVWXWPWnQvNUU0Bl/nSndklPp89sDP+ EQKA/lCyqbNfyJkPcuk/nk0iUe9rtQRP7h5k5OTAG1jma9KJ/DWaAgGXCCv+CcfmmgJn 4zMRX4gOYDQO1i2oUL2jp/1aPqG1MGxnmfoNXCuuk5lClx4Tyw5N6o2zjDw2Wv8sbeiX nir0xFCiqZ7WD/sfjC8ZHUkkV0pHjDH7mAxFPTBLx0+X5ayDARRZUq+Eo1gm7FO9eISZ qfuXyW1dmOon2POLz/AtV89aCRXLLCjydIX1iQiPmdUGV+0+LqpdNYZlTex2XY5gwd8G Q8qg== X-Gm-Message-State: AOAM531LgEQnidWugvgE6zkPnQUUUfJYBiMHvv+sXZ5JIuGZlocLAEUv 11mZ3F+Bdkb0EYByogZKAiL80L/sqcxpNtOSUXk= X-Received: by 2002:a9d:4581:: with SMTP id x1mr3651165ote.145.1624375495284; Tue, 22 Jun 2021 08:24:55 -0700 (PDT) MIME-Version: 1.0 References: <20210621175511.GI1096940@ziepe.ca> <20210621232912.GK1096940@ziepe.ca> <20210622120142.GL1096940@ziepe.ca> <20210622121546.GN1096940@ziepe.ca> <20210622151142.GA2431880@ziepe.ca> In-Reply-To: <20210622151142.GA2431880@ziepe.ca> From: Oded Gabbay Date: Tue, 22 Jun 2021 18:24:28 +0300 Message-ID: Subject: Re: [Linaro-mm-sig] [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF To: Jason Gunthorpe Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Gal Pressman , sleybo@amazon.com, linux-rdma , Oded Gabbay , Christoph Hellwig , Linux Kernel Mailing List , dri-devel , =?UTF-8?Q?Christian_K=C3=B6nig?= , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Doug Ledford , Tomer Tayar , amd-gfx list , Greg KH , Alex Deucher , Leon Romanovsky , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 22, 2021 at 6:11 PM Jason Gunthorpe wrote: > > On Tue, Jun 22, 2021 at 04:12:26PM +0300, Oded Gabbay wrote: > > > > 1) Setting sg_page to NULL > > > 2) 'mapping' pages for P2P DMA without going through the iommu > > > 3) Allowing P2P DMA without using the p2p dma API to validate that it > > > can work at all in the first place. > > > > > > All of these result in functional bugs in certain system > > > configurations. > > > > > > Jason > > > > Hi Jason, > > Thanks for the feedback. > > Regarding point 1, why is that a problem if we disable the option to > > mmap the dma-buf from user-space ? > > Userspace has nothing to do with needing struct pages or not > > Point 1 and 2 mostly go together, you supporting the iommu is not nice > if you dont have struct pages. > > You should study Logan's patches I pointed you at as they are solving > exactly this problem. Yes, I do need to study them. I agree with you here. It appears I have a hole in my understanding. I'm missing the connection between iommu support (which I must have of course) and struct pages. > > > In addition, I didn't see any problem with sg_page being NULL in the > > RDMA p2p dma-buf code. Did I miss something here ? > > No, the design of the dmabuf requires the exporter to do the dma maps > and so it is only the exporter that is wrong to omit all the iommu and > p2p logic. > > RDMA is OK today only because nobody has implemented dma buf support > in rxe/si - mainly because the only implementations of exporters don't Can you please educate me, what is rxe/si ? > set the struct page and are thus buggy. ok... so how come that patch-set was merged into 5.12 if it's buggy ? Because the current exporters are buggy ? I probably need a history lesson here. But I understand why you think it's a bad idea to add a new buggy exporter. > > > I will take two GAUDI devices and use one as an exporter and one as an > > importer. I want to see that the solution works end-to-end, with real > > device DMA from importer to exporter. > > I can tell you it doesn't. Stuffing physical addresses directly into > the sg list doesn't involve any of the IOMMU code so any configuration > that requires IOMMU page table setup will not work. > > Jason Yes, that's what I expect to see. But I want to see it with my own eyes and then figure out how to solve this. Maybe the result will be going to Logan's path, maybe something else, but I need to start by seeing the failure in a real system. Thanks for the information, it is really helpful. Oded