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 EDCA5C433E2 for ; Wed, 16 Sep 2020 14:07:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52AE8223BD for ; Wed, 16 Sep 2020 14:07:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="VOJ9CnEl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52AE8223BD 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 8EEA8900002; Wed, 16 Sep 2020 10:07:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8786D6B0068; Wed, 16 Sep 2020 10:07:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76985900002; Wed, 16 Sep 2020 10:07:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 5D74F6B0062 for ; Wed, 16 Sep 2020 10:07:14 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1D6908249980 for ; Wed, 16 Sep 2020 14:07:14 +0000 (UTC) X-FDA: 77269101588.01.food63_48012d12711a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id E404410051138 for ; Wed, 16 Sep 2020 14:07:13 +0000 (UTC) X-HE-Tag: food63_48012d12711a X-Filterd-Recvd-Size: 4516 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Sep 2020 14:07:13 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id o16so8208677qkj.10 for ; Wed, 16 Sep 2020 07:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=La99VFybE95ljQbGxohkbmDHsRKJC2A6ovW4ZDnoPGg=; b=VOJ9CnElE1tIzpvRDzSJxLQXWm/++E5FKZhGlhD2qVUn6aMIi84JEKIgO4BLKBmrP8 08+579lu3VaATYWW4i8PGHX9Si56Ffjc2npOiCodIUUWmw/m9Buy2lOkdee413PzBJtT x9mYMzsldhpi7ImCKJBtzzGQ3/8cMBlG1qLA+/dMmxPgByr1NS/GqvGpDW5O/vceKxtJ +XQSEKzGfX7GYU0a3pfCCcvviY717MYm16mP2bE42kUhSaKvxtNvUTUwkG+cuUo+ADJz ftd1VkfL3CHhvcCXW38fSX0htUIapxKqapCQC8eiBeQHlHvZFfCUe4nIqG0OLueSoAQq 4aWA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=La99VFybE95ljQbGxohkbmDHsRKJC2A6ovW4ZDnoPGg=; b=CgkoPpncSURVC6X26l+FKq5BU907cGBOVJ7GD17qAk8KK7NzrOKBUezwTxsXbfAxS7 3/9JfFQMQ5pZH6TyHpCoqLX1cQwC0o2/M/8f6KJULKLv5sigoGxtG0/RPQ8heRtgIvVR kRzJdESbPNh4T6/gW63g+ZfP8RoeA/gK4+uyc3YU4RrAOD+5HfGfz7PftVh00r15h/qc pqb3KUm+W7bN84y/3TJsWOFGj4xjHhLoAxZGGcGvI1zmleAiux5btujcSI0bhzf+jnZB 0ryDisZwvUZXE+nEB1MCVcQIDbXNZe+OYIJ5i/KywfJW3avczzsCy3bawgmJRIn/6P1W OUow== X-Gm-Message-State: AOAM530S5QpgQhmSVdr6V7wo5cUftUV7mjmlMlxVMldWGeQxFB+E2/Q5 DDC/2eSeLNj8QVHZE2P04J8G+Q== X-Google-Smtp-Source: ABdhPJyGvoVtODTTRAjWRbOAqjMljnU8wALvrzaWChMgxILat6SxGUHhK0nHHjrTElsiKnfbm48/tg== X-Received: by 2002:a37:84f:: with SMTP id 76mr22783375qki.251.1600265232291; Wed, 16 Sep 2020 07:07:12 -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 k48sm20623786qtk.44.2020.09.16.07.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 07:07:11 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kIY5W-0002hp-NA; Wed, 16 Sep 2020 11:07:10 -0300 Date: Wed, 16 Sep 2020 11:07:10 -0300 From: Jason Gunthorpe To: christian.koenig@amd.com, akpm@linux-foundation.org, sumit.semwal@linaro.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: Changing vma->vm_file in dma_buf_mmap() Message-ID: <20200916140710.GA8409@ziepe.ca> References: <20200914132920.59183-1-christian.koenig@amd.com> <40cd26ae-b855-4627-5a13-4dcea5d622f6@gmail.com> <20200914140632.GD1221970@ziepe.ca> <9302e4e0-0ff0-8b00-ada1-85feefb49e88@gmail.com> <20200916095359.GD438822@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916095359.GD438822@phenom.ffwll.local> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: > But within the driver, we generally need thousands of these, and that > tends to bring fd exhaustion problems with it. That's why all the private > buffer objects which aren't shared with other process or other drivers are > handles only valid for a specific fd instance of the drm chardev (each > open gets their own namespace), and only for ioctls done on that chardev. > And for mmap we assign fake (but unique across all open fd on it) offsets > within the overall chardev. Hence all the pgoff mangling and re-mangling. Are they still unique struct files? Just without a fdno? > Hence why we'd like to be able to forward aliasing mappings and adjust the > file and pgoff, while hopefully everything keeps working. I thought this > would work, but Christian noticed it doesn't really. It seems reasonable to me that the dma buf should be the owner of the VMA, otherwise like you say, there is a big mess attaching the custom vma ops and what not to the proper dma buf. I don't see anything obviously against this in mmap_region() - why did Chritian notice it doesn't really work? Jason