Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp535153pxk; Wed, 16 Sep 2020 10:07:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmrb79UXZ2mFHPcRg/ld/m2CTcD8jBMLRRlj+8mirEkUhMHG0GYPGbGH6BSrzUs4G5z+vQ X-Received: by 2002:a17:906:4819:: with SMTP id w25mr26334421ejq.300.1600276051913; Wed, 16 Sep 2020 10:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600276051; cv=none; d=google.com; s=arc-20160816; b=w1/OTiKili0pCIRx7J+SbaDVyh1RphoWusE80i4dzmm1K9Fm3YQcTDJrnI/ss34JQa I4ZMSl8gl1ygXg3yD9AfRF2tTR0JDQ/fwHR91RWYW0NxvqAXrlmLWXK9E1lt7oiRcaQp POq7wY2fUfjBuLb6Dk7f6iOTdcGiwefbQGT6NKB+H3gRUHclT2WmUG4npu0CuES5cKiD aOoSJes4JpOZtnCAtVBxgiK64QYottri73t8JIcV1IF+anlOLp+1klt3/JhavWoMYSxG c6VTQPYcc4a9g/xOzha2A4wV6iK6d2Yo0UsrCb+IOChrExldrEL8VulJalXwncTJRgp2 fE6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=La99VFybE95ljQbGxohkbmDHsRKJC2A6ovW4ZDnoPGg=; b=h+brdZJ1pQ8AiAwEiwJv+JIbkbXYJcCqx32XER/rkbXVGFKTyGLt8k4SFr7akqBl23 GJzxtNWcmg87MThCvVA7VK4W+qBG2AGT04NQHvxwP468U1tT2oBIBZ1xJCpGqKeY6UB1 b61X/XLv5P+HOBB/mJvp9lfVlHH2LRZB9914/UOwBY5s55bFNkeBo430LTFGFIqFAGuP GoDPSV0Qy8vv2c8yp8exUthkwFNST5w6T/2gywb0vPP5PBkJSRYm19kRdpW6WqhO1Opj lid5/U9G2hnQYNGgeyWVXXg0dcq+fyVxst1SLlt/+4zERrhJEAXyXoorp7FR63XHxQtM 47lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=VOJ9CnEl; 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 yd22si14038216ejb.346.2020.09.16.10.06.53; Wed, 16 Sep 2020 10:07:31 -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=VOJ9CnEl; 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 S1726773AbgIPREl (ORCPT + 99 others); Wed, 16 Sep 2020 13:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbgIPRAu (ORCPT ); Wed, 16 Sep 2020 13:00:50 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF92C004590 for ; Wed, 16 Sep 2020 07:07:13 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id f142so8178851qke.13 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=gFhzvrLfRUSGTo0ro96yAN8VQEQdersQ3E/qmZUlWy6StPfBjeVR8IApD7W0IR9s2l pt8cAyBHI70bFm0ecJN5f7CK9ciZwpuzpa9JLXPbLbccFG80eHy7PoCWNX9uG482QUex KLgEr3w8PgWrvtUyFlIvIlSv9jBiz2jrhlo1mYh8iwRoX/O7zWGdpuV2uI3vr/lJWmNk 8puXHrE8jSyv5quFUAGqTP4YJGQf6BE4kJXg51BggkJX5vii08JHG7hOdmpHRZlr1oWb x4hF1L7+wSO/+Mh810TuND+jZydD43O+SBk7YcfhTqyA4KL4aEb/4r70KSnDJbc7yD5w b3Rg== X-Gm-Message-State: AOAM531ueE2GmImdkyECICv1F4LOjQH092rxd6aV0IIEtHqHY879XzeC rezDJrzLQt13i/5hOe2sj89ayg== 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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