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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 54843C433E2 for ; Thu, 17 Sep 2020 12:19:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DAE3E208DB for ; Thu, 17 Sep 2020 12:19:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Fhg6lAOj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAE3E208DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E87F6B0003; Thu, 17 Sep 2020 08:19:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 298A26B0037; Thu, 17 Sep 2020 08:19:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 187BE6B0055; Thu, 17 Sep 2020 08:19:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 023516B0003 for ; Thu, 17 Sep 2020 08:19:01 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AAD16362D for ; Thu, 17 Sep 2020 12:19:01 +0000 (UTC) X-FDA: 77272457682.17.dock98_0508a4527122 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 23EC7180D0186 for ; Thu, 17 Sep 2020 12:19:01 +0000 (UTC) X-HE-Tag: dock98_0508a4527122 X-Filterd-Recvd-Size: 5072 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 12:19:00 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id w12so1923971qki.6 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=KraBLzmAUM+pxYfLjh95YoGixv9iD34LU9iQ5wCihmddvyKBH56DVK44e4Ppwj6nht Om1mv2if5ASm9kslQnDJvKTOYUtQBKYixYl3YBdy62XlqMFelzJFDQC5RIGhG18XeSnb uFKMyGdaGEEFIa7acEMQbLrj9p2e9zUmV8fcDLBrBC/Xpov9blEPz7PPPlI08c5FKLO2 pEJiTttrTq2Ec9VJx1qNaX5ylDGw1090RnEEJz15uYJV9AzvzzJdXqK3iYch5sNx+Tb6 fXhXYQwrbMmAoT4uu4yUCe424OpvGWkJAN1zst6QDTeEK2R99b//gAfZK2+H51L5kpJW 8poQ== X-Gm-Message-State: AOAM533AAqsw0R2H+gbBohm4lS53NCFmqG1n85ef6/w1tDKTZP5yejB3 mdeum5P29GZiDaM0z6XZob0vSQ== 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 In-Reply-To: <6fd74b84-959c-8b3b-c27b-e9fbf66396c7@gmail.com> X-Rspamd-Queue-Id: 23EC7180D0186 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000435, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian K=C3=B6nig wrote: > Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: > > On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: > >=20 > > > Yeah, but it doesn't work when forwarding from the drm chardev to t= he > > > 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 ma= p > > > is toast and unmap_mapping_range doesn't work correctly for our nee= ds. > > I would think the pgoff has to be translated at the same time the > > vm->vm_file is changed? > >=20 > > 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. >=20 > Yeah, that is exactly like amdgpu is doing it. >=20 > 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