Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4815872pxj; Tue, 22 Jun 2021 08:36:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwllmcywwHQy65JBlcODJA9Kvk9bRcj92N4oJAKiqzpDn8yZ2nfravHagvc/ETtqEg8Oo6U X-Received: by 2002:a92:d6c8:: with SMTP id z8mr3129550ilp.250.1624376177928; Tue, 22 Jun 2021 08:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624376177; cv=none; d=google.com; s=arc-20160816; b=nzmJ2iDnCaxMtQYQjYJyE8h5XoMZJ759LLEFN5aAoBBj8gAhdHQEtbWQbi70lEFy35 ee++2lKwis3Ceq+G661OhtCmwCSET4tCS4N1HyhQctZQcbrY8RhCYKNEutk1o0YBVzN1 wSAzgarBEK9a1RZCo2MxWdpLg7OQpN9COjNsOUz3aiySRB/NzsS/WH2dhvEQndTT9mFt xlV6nmv8uUCCnTrEuIeALvRZcYshPsVxnMOc1y+qWXytHDduQwmezcX4dfkEIdcRKleH nxqFjfZKczQWUmFWHQ1e1qNzLsgWW55yMfv/fYidBOdQOGVTl2/UKCU94aWHMbVgRop8 P+6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XCGRlJxrxMvSvElmb3McFTndCdFsvf+0ulpFzwibisU=; b=M3IwN75SVCWZNgZA1AHlQg8+uxVIFGXUMv/3nXD0BxHZHB2OW5q8OrpI+J0tHCvK+C Uj79eX7haSR4f1/Ubdafo8IB3FbdDn51hGeOX30iGNPIe7PjDSv7UEJSlgMAiutpzIxt h+P5a47LnW3ubt/gDVLPmM/NSBFJrSFuWPGXZjwYnqUFwEjvjHToQguLXdOmiR5s3Jg1 VZIohwTZQIcqe67rQRCA7t+H/jwx8GTcpZoC4nwKk2sNMtMnRYecMpE1M9q5WsupDzxH lW4raVbtFmU4mkbLa5ehnauTP3WWRyMvkgqPlJgOXwMFDg2uI81bxxMs1lLXtHfWqLjV BtWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=RZ37oQ4x; 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 m1si18178650ilu.13.2021.06.22.08.36.03; Tue, 22 Jun 2021 08:36:17 -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=@ziepe.ca header.s=google header.b=RZ37oQ4x; 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 S232149AbhFVPgm (ORCPT + 99 others); Tue, 22 Jun 2021 11:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231964AbhFVPgk (ORCPT ); Tue, 22 Jun 2021 11:36:40 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14704C061574 for ; Tue, 22 Jun 2021 08:34:24 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id o6so5194177qkh.4 for ; Tue, 22 Jun 2021 08:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XCGRlJxrxMvSvElmb3McFTndCdFsvf+0ulpFzwibisU=; b=RZ37oQ4xjDFsBnFcY5FzSe7ryg7I2xkkjLJIDG9pWBVE471HjG5oj7ZH9zwFfLGJjb isU5xI2gWvwgcxsSpN4N9oPCNXRQB2asF0okQeuH8sD+dvROpQfY4AHwM98x79x0O5xl ZpXizLnL5TT0sIZB14l2AEL6+cxTu/0iS8e2gKRKGAIznR6ADAbYKgLWRotpG3swQzzG sPAUUbB3nr22lLL4hUjaGnONeGbpSNdzAvtGoWJPME5FmLK3lnJIOmJMwP/op2rBS2Lj 4wFM18A4nUtQ3yo7pekqZd2V3XFmCRuhVmjSEIT1tizi0WIzn3FvnpWdH0taoX8FMvhl NVvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XCGRlJxrxMvSvElmb3McFTndCdFsvf+0ulpFzwibisU=; b=cSb+LPr8ysyor8/SoeGwKlC3rbhduO8+8RB4Nk9f6Q0/QkPisfwljIpddqayLp/arB pdSdgrnco1fPWwjmOVgOMK913QuSJCTjX0/XkGLzVbPsp7mNpLm3kHBfxwu6PZ6Ea5gu M3vZjPJtPa/75ClkuiM5WZbZgpi2zp9CEoRJSAvOG8x4H+piq25IZCkhqRaDyjnmWpxC nB0pE+pQZWARd6lUtBK/GFUyyaX+S52MF04A0ZQHLhaJnCwleIuUiNqtf3fcBXEJaET1 XZO+L6F3gbiJCd9v3UTFpKqoWHrxcDIVqtmCU8qC+NkkweMa9eSie/flAce1AXuc8qHH sJoA== X-Gm-Message-State: AOAM53287dOolARwoWXcvuw0TXWHwrPnsyJZ9Zsu/w3Q70Jg4JnBYJo7 1syP1aqhQxUSjE8r3V0xoCq3HA== X-Received: by 2002:a37:a8c1:: with SMTP id r184mr4898379qke.129.1624376063270; Tue, 22 Jun 2021 08:34:23 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-113-94.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.113.94]) by smtp.gmail.com with ESMTPSA id bk38sm7882443qkb.28.2021.06.22.08.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 08:34:22 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lviPu-00ADQh-9q; Tue, 22 Jun 2021 12:34:22 -0300 Date: Tue, 22 Jun 2021 12:34:22 -0300 From: Jason Gunthorpe To: Oded Gabbay Cc: Christian =?utf-8?B?S8O2bmln?= , Gal Pressman , sleybo@amazon.com, linux-rdma , Oded Gabbay , Christoph Hellwig , Linux Kernel Mailing List , dri-devel , Christian =?utf-8?B?S8O2bmln?= , "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" Subject: Re: [Linaro-mm-sig] [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF Message-ID: <20210622153422.GR1096940@ziepe.ca> References: <20210621232912.GK1096940@ziepe.ca> <20210622120142.GL1096940@ziepe.ca> <20210622121546.GN1096940@ziepe.ca> <20210622151142.GA2431880@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 22, 2021 at 06:24:28PM +0300, Oded Gabbay wrote: > 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. Chistian explained what the AMD driver is doing by calling dma_map_resource(). Which is a hacky and slow way of achieving what Logan's series is doing. > > 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 ? Sorry, rxe/siw - these are the all-software implementations of RDMA and they require the struct page to do a SW memory copy. They can't implement dmabuf without it. > ok... > so how come that patch-set was merged into 5.12 if it's buggy ? We only implemented true dma devices for RDMA DMABUF support, so it is isn't buggy right now. > 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. It might be tricky to test because you have to ensure the iommu is turned on and has a non-idenity page table. Basically if it doesn't trigger a IOMMU failure then the IOMMU isn't setup properly. Jason