From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A436C433E2 for ; Thu, 17 Sep 2020 12:19:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 507E42087D for ; Thu, 17 Sep 2020 12:19:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Fhg6lAOj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbgIQMTq (ORCPT ); Thu, 17 Sep 2020 08:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbgIQMTB (ORCPT ); Thu, 17 Sep 2020 08:19:01 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF3FC061788 for ; Thu, 17 Sep 2020 05:19:00 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id v123so1904844qkd.9 for ; Thu, 17 Sep 2020 05:19:00 -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=bVH4jGgQihKj5QSekUnZ2zb+7aLw+KLxMSJUC/hbv48=; b=Fhg6lAOjlbLyEga2rG8pPURoI3htqOr2pKe+vNBAihwLsY1v7CQoxRX/649FEzDXL0 39FqlveIvSVsbxnDqRrLJG066HQKp6GPqRPvv7sINamdCEVmQVcfibTDwqQ3GZ9hu48e bJWC0truOv3or+gTqYMGK8Nk/aI7LVNws/zxpIKCCcVnOEN096VUQVtTCuEGqpL/bs0b b7qBpYAC22kVivdgl0u4A8/znqNgMdzttibfzOG7nl4p+6OR1ajRt59PhYyeJJCeqC0/ zbtfT2ps/ucVP4yscFeka54htZL+4FqrDY02jJyOzHv7rkq5iYcsVSz5CsB5kWcbLufb HzAA== 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=bVH4jGgQihKj5QSekUnZ2zb+7aLw+KLxMSJUC/hbv48=; b=XDAwew0ZtOD6n1mlT/5sdW34WsZ2Q/St+6wV2hjtvVieIik0D27mFFUMobdBbWx9uQ H486UvnGy6l9G/vTHgV86m/R188+XJjGGO4JCfEFnZY9I5Vx7+yzHqt6/IWpyx2pw6Iv frg4m7AHsB2uA1Hb9StxwwkIRbBUptK7suk2Z6DR54hC2YNkVWZaQ/5qdNmgrFgCcW1x 5qG5Firy8ZtfHsy869HkfML6CJVr8RJM2pRMKxIkLLn236RzqKs8C/3K/MwhqfVV/OHc RIT9Mi1CxtfFYPXJY0QoW+FkovILfxN/k7Kf1qMToow9ui72lKqGzyCdorlm2rqW/3V8 amCg== X-Gm-Message-State: AOAM532yVRdE4i5zLwHdxpT0L7oLhMOz5aOYmSPkkczeIbs02lmbr6gM DVuLIeIVHa0XxCbSpwK7zPxghA== X-Google-Smtp-Source: ABdhPJz0GJRdg0Id6c/JdQbGUXlRLa+Wdw0oKs6yW4L3DgyAUr2dNjQnoWL5C3nALl2/OucOloGmLA== X-Received: by 2002:a05:620a:a45:: with SMTP id j5mr28227082qka.367.1600345139834; Thu, 17 Sep 2020 05:18:59 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id 145sm22054177qkf.18.2020.09.17.05.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 05:18:59 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kIssM-000R84-9L; Thu, 17 Sep 2020 09:18:58 -0300 Date: Thu, 17 Sep 2020 09:18:58 -0300 From: Jason Gunthorpe To: christian.koenig@amd.com Cc: Daniel Vetter , Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Linux MM , Andrew Morton , "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap() Message-ID: <20200917121858.GF8409@ziepe.ca> References: <20200916095359.GD438822@phenom.ffwll.local> <20200916140710.GA8409@ziepe.ca> <8db2474f-ecb7-0e17-5f5b-145708fe44d5@amd.com> <8d8693db-a3f0-4f5f-3e32-57d23ca620f8@amd.com> <20200917113110.GE8409@ziepe.ca> <6fd74b84-959c-8b3b-c27b-e9fbf66396c7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6fd74b84-959c-8b3b-c27b-e9fbf66396c7@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König wrote: > Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: > > On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: > > > > > Yeah, but it doesn't work when forwarding from the drm chardev to the > > > dma-buf on the importer side, since you'd need a ton of different > > > address spaces. And you still rely on the core code picking up your > > > pgoff mangling, which feels about as risky to me as the vma file > > > pointer wrangling - if it's not consistently applied the reverse map > > > is toast and unmap_mapping_range doesn't work correctly for our needs. > > I would think the pgoff has to be translated at the same time the > > vm->vm_file is changed? > > > > The owner of the dma_buf should have one virtual address space and FD, > > all its dma bufs should be linked to it, and all pgoffs translated to > > that space. > > Yeah, that is exactly like amdgpu is doing it. > > Going to document that somehow when I'm done with TTM cleanups. BTW, while people are looking at this, is there a way to go from a VMA to a dma_buf that owns it? Jason