Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp372099pxk; Thu, 17 Sep 2020 05:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJHR2blgc5i7x2Gr0EmkN2/GhSNgyhdBuvmA/3YdQBNUU1pxNMvGPu+HL87wh0oD5ceZQA X-Received: by 2002:a17:906:6884:: with SMTP id n4mr31373067ejr.50.1600345924842; Thu, 17 Sep 2020 05:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600345924; cv=none; d=google.com; s=arc-20160816; b=sJMa3eK300YImsSI2TAZCN0xSypAB0qTBIm3/SDrxqRVGWHz4VvnJJv+5nxR4MOfKN 3unVplThiASwNLr7anp6ouYOn6F8MDXuQqiamGmf/cSx0RglcdDs3vB/+eNpa8ILbe8A wiZG/I5OWL+5IZnJ+Bvm9sGOI4L79xtz49bT7duKImf/iWB4cvRCyzDeSzG3vM8DH7e6 XTASDr2N/J86vioJuZc0yXaVPsxNzeA85orskOEiEW9AqaPlZjdFg2wBSIBtibBh3jcT Vfu3eutPb2ZWL/38bIfBX1Go89S3Gub7pgu9dO7MWzX9oFNmGmSLDi4LftqorLVEMwhD jcCQ== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=776kE571jxALYsOg06ejCyM2zHb/SfLHRc5/m8v10ss=; b=NK4TpExhFhKXQD4lhd5M8ftE/OiEEyckpxV2qascDt8G8KFmc5q5dCmJ7uzZ3/ZUmQ /OyXrVEsIZ0CVwfR/9ZWk7pi9MuAp1W77K9tVJP4eGHSRnhho4BE+zitdkAT6b7BFZVm WSSDyxffvTXadnrAGrF7CzqSNHXVO9ElPm0NUpMRqtr4IeiWq6FrPr7lreRUVtRLIHlc sMwGHMJwFLhKATOv7MfJC+9G/pX99FRt7WobwuwOqEbULBprK6Jhy3GFXh6G3GCB5MxB swLfV+czhlzRpCECquUe3QRVDYsvYEKWyB+vHKZHSDwKQD+x2rojmpODzS12UFYjWtqH 0Q6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=IVQpQa30; 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 h6si13409234ejx.417.2020.09.17.05.31.41; Thu, 17 Sep 2020 05:32:04 -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=IVQpQa30; 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 S1726823AbgIQM1i (ORCPT + 99 others); Thu, 17 Sep 2020 08:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgIQM1f (ORCPT ); Thu, 17 Sep 2020 08:27:35 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF98C06178A for ; Thu, 17 Sep 2020 05:26:40 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id e16so1869305wrm.2 for ; Thu, 17 Sep 2020 05:26:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=776kE571jxALYsOg06ejCyM2zHb/SfLHRc5/m8v10ss=; b=IVQpQa30jthrbYlgwDGmu0dc3mjMkTqbdMKMaSnRvLnHMKlNvHBoPDQ8r760u+SVPm 59vgHhoVxmVxKNvGKFX9QbbbOEpWzNWMXSHfbRt/bDygT1XUo/rI/mTP8lwcUxWU928G cOYIpmnvb7A0tsT+gMKdSIF7Iz7lnU7Ky2wTs= 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 :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=776kE571jxALYsOg06ejCyM2zHb/SfLHRc5/m8v10ss=; b=HwcPFO3oKUyVogzMdbWrny9nRqOIr3VsMaUS9Aza3E2WhzC8uVx1Okcy0VSJ/dQEdo 9woO1lih1NeKvd6Bk89kmxryWHy/vJP0lFk4ymu2weEtLJ8+7JJT2flh0HY5OSU2sHir kFautCboFx6W0K1J7yc06TdAaKHG+v0vT2SbfYEMqqeTeYyZQZGtys8MbTbUAoqmQn4r dRjfY35X8J0qTpXDyHBJ17yYomdrQi4EQ3B5B6sLu+2ejC+Hcl+1jW/iAfVexn4w5lG4 zfLPOmyfwtnjhhsqRPuMXLijKHTfHHVKMEUDFbBBOojQNNiFzWcfnkWfHYELt/5eOQT7 nnRQ== X-Gm-Message-State: AOAM533A6QmpLverjfWivM5/9Av1YH4f6wQbJ5Ftf+/9+hKoYBEJInDz WTTV5PjEY3e/WjG1TeldLz3NFEjhNMp9wyul X-Received: by 2002:a5d:4a49:: with SMTP id v9mr34943739wrs.153.1600345599608; Thu, 17 Sep 2020 05:26:39 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id u186sm10458866wmu.34.2020.09.17.05.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 05:26:38 -0700 (PDT) Date: Thu, 17 Sep 2020 14:26:36 +0200 From: Daniel Vetter To: christian.koenig@amd.com Cc: Jason Gunthorpe , Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Linux MM , Daniel Vetter , Andrew Morton , "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap() Message-ID: <20200917122636.GW438822@phenom.ffwll.local> Mail-Followup-To: christian.koenig@amd.com, Jason Gunthorpe , Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Linux MM , Andrew Morton , "open list:DMA BUFFER SHARING FRAMEWORK" References: <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> <20200917121858.GF8409@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian K?nig wrote: > Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: > > 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? > > Only a driver specific one. > > For TTM drivers vma->vm_private_data points to the buffer object. Not sure > about the drivers using GEM only. For gem drivers (which includes the ones using vram helpers, which uses ttm internally) that points at the drm_gem_object pointer. I guess that might be something we can unify a bit on the ttm mmap paths of the remaining driver, now that there's a drm_gem_object embedded anyway. -Daniel > > Why are you asking? > > Regards, > Christian. > > > > > Jason > > _______________________________________________ > > Linaro-mm-sig mailing list > > Linaro-mm-sig@lists.linaro.org > > https://lists.linaro.org/mailman/listinfo/linaro-mm-sig > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch