Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4655072pxj; Tue, 22 Jun 2021 05:17:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6aeQlRo2TzNzKpkBhbn/BazZ1iqSO2N9RbIpqoF0aqRwT5yDTPG8c4iASBOYT59PDbArx X-Received: by 2002:a05:6402:1508:: with SMTP id f8mr4490803edw.172.1624364230962; Tue, 22 Jun 2021 05:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624364230; cv=none; d=google.com; s=arc-20160816; b=WEtpfuWK7pd7iTGDpAChPml4g0JgDy7WBX3ToQjsKdxHFhwNv9Jg5Q2OHhR2ZfEgU4 clqGSEDK7dURx0sqbFKwlLFttZb76jGxhOStgx85swOLZ8ZGFN9I43NKDuUmz8KPn96Q bHWJYWUDsZVXmlMPr9pJcW262AODD1ELpLkI9vBwsRHLY5Q3rDh7VzjxUqOe5dGbwFf3 /Yi9wTLTrXnEY1Xe0CzketMgBEBQ4xwPUIywFiLTfJZLiy/SPDxETUSEW7uQHpGMxKs+ g7YNMfYNlc5eJVHGAFtRDIr8NnieC2pOElFfRY1ckjoKQESwLMVB/tA3oSvSu3Jd0bMH AiZA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KjofJoQyUwiIAacJkE1UxWn3Mo9VplV7FtMGlU0RWLM=; b=mSGnfz5ZgU8I1XchOYbA/IWuaZLfzOXorM5f723W4ldbi7fv2dGzfaj4J0igfAviwQ gIyBCzdFKPpB1h35lpa0tX9fiEOpYfbM6LVTtJebPx8KxPhUpiyxbjAh+1zPsslCAuMQ ltNz7JXpbxz1PW/KcHCaZ1ywAT1pqQ9j55jBkreq8eEfSf7N68HnMMzzC2PycE0od1aq aflN0Xhq1wjmMma3pLLq2PW3CDEFSsNjXnxBUdzYye+o7EJpOOuBNn6Z5egl1qmA0o3i At0Bek4yNRcge47y9crMQxH+HQ5qpHijEyXBEw+eIoRWERVLhpMEJVIERcG2s9vB74c1 f3kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=h97BE10e; 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 bs19si14094898ejb.398.2021.06.22.05.16.47; Tue, 22 Jun 2021 05:17:10 -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=h97BE10e; 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 S231272AbhFVMSF (ORCPT + 99 others); Tue, 22 Jun 2021 08:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbhFVMSE (ORCPT ); Tue, 22 Jun 2021 08:18:04 -0400 Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C484AC061574 for ; Tue, 22 Jun 2021 05:15:48 -0700 (PDT) Received: by mail-qv1-xf2c.google.com with SMTP id x6so9096147qvx.4 for ; Tue, 22 Jun 2021 05:15:48 -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:content-transfer-encoding:in-reply-to; bh=KjofJoQyUwiIAacJkE1UxWn3Mo9VplV7FtMGlU0RWLM=; b=h97BE10eQvAs7iuAp3KSz/AKkEBSJK+RWgPE2bKUnLoQdvOUv3nQXFBCT3PEWlx2Sl E/e2cYiumFAEGqj4jTurYIMnn2zsv1UeEuBl9zhKLEnlbb/EkISQicJQPDbtplfY7NkM co8/vN6NEYxfoOaungf0V4XWEA/Cmf7QBmCZBDNRHWHAx6heTvyghfkmTuWnPgQqEDpW mESlAUjUeEAGF0vwR/v1AwASBsRjSyjZOYhs7r1/kwL3GwXPKGLxfpNXjMb/amd4m48L RTR9a5HRMe1vZ+UVKk7QU3T0ut/x3x7ci4FJwEzm6Jq6XV4LXljZKU5h4jBZaF4LdabI BUuw== 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:content-transfer-encoding :in-reply-to; bh=KjofJoQyUwiIAacJkE1UxWn3Mo9VplV7FtMGlU0RWLM=; b=J2QtjCrTTLeUZ0zXk6n4AmcWLsQcy4ByjIv7mZCFtw6uUOG2RnOWVscUsh+8v1JIGD t4dIvbaWf3ev8WCHFAy6txlv8aeWD2A4yHtz2Pkw74f3qfn4msZOH1zQ2vEqps7laDMx 6e0rYn/XgF9eYqlT0U9lEWp9h0C+/+DDMd4qYmE6jxvMiAynulkV/GscF5G6H6xepyCC tcZG01MMQMlm5EjdJSaPLkUGan+QbZYoEQA/y92IAQkCNaX8XVzek3kOpz6CQqwNQE5d +clAXeiclw0aINkXVu6C0mIbacK+BL4eDGAKUKeZw/7jrAAfz6gJBVnv4l2EaBB6zPQk AN4g== X-Gm-Message-State: AOAM531vwNW6iZ1IKZ/TgZd4PBZtrf2FpSLLbPQLBTDExam9ER0CyjAP YjOE/bOVjo4czMcj+QlA8PwUzQ== X-Received: by 2002:a0c:aacd:: with SMTP id g13mr1227641qvb.22.1624364148049; Tue, 22 Jun 2021 05:15:48 -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 l123sm5662330qke.10.2021.06.22.05.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 05:15:47 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lvfJj-00A9d2-05; Tue, 22 Jun 2021 09:15:47 -0300 Date: Tue, 22 Jun 2021 09:15:46 -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: <20210622121546.GN1096940@ziepe.ca> References: <20210621141217.GE1096940@ziepe.ca> <20210621175511.GI1096940@ziepe.ca> <20210621232912.GK1096940@ziepe.ca> <20210622120142.GL1096940@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 22, 2021 at 03:04:30PM +0300, Oded Gabbay wrote: > On Tue, Jun 22, 2021 at 3:01 PM Jason Gunthorpe wrote: > > > > On Tue, Jun 22, 2021 at 11:42:27AM +0300, Oded Gabbay wrote: > > > On Tue, Jun 22, 2021 at 9:37 AM Christian König > > > wrote: > > > > > > > > Am 22.06.21 um 01:29 schrieb Jason Gunthorpe: > > > > > On Mon, Jun 21, 2021 at 10:24:16PM +0300, Oded Gabbay wrote: > > > > > > > > > >> Another thing I want to emphasize is that we are doing p2p only > > > > >> through the export/import of the FD. We do *not* allow the user to > > > > >> mmap the dma-buf as we do not support direct IO. So there is no access > > > > >> to these pages through the userspace. > > > > > Arguably mmaping the memory is a better choice, and is the direction > > > > > that Logan's series goes in. Here the use of DMABUF was specifically > > > > > designed to allow hitless revokation of the memory, which this isn't > > > > > even using. > > > > > > > > The major problem with this approach is that DMA-buf is also used for > > > > memory which isn't CPU accessible. > > > > That isn't an issue here because the memory is only intended to be > > used with P2P transfers so it must be CPU accessible. > > > > > > That was one of the reasons we didn't even considered using the mapping > > > > memory approach for GPUs. > > > > Well, now we have DEVICE_PRIVATE memory that can meet this need > > too.. Just nobody has wired it up to hmm_range_fault() > > > > > > > So you are taking the hit of very limited hardware support and reduced > > > > > performance just to squeeze into DMABUF.. > > > > > > Thanks Jason for the clarification, but I honestly prefer to use > > > DMA-BUF at the moment. > > > It gives us just what we need (even more than what we need as you > > > pointed out), it is *already* integrated and tested in the RDMA > > > subsystem, and I'm feeling comfortable using it as I'm somewhat > > > familiar with it from my AMD days. > > > > You still have the issue that this patch is doing all of this P2P > > stuff wrong - following the already NAK'd AMD approach. > > Could you please point me exactly to the lines of code that are wrong > in your opinion ? 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