Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3646415img; Mon, 25 Mar 2019 14:49:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfzWNapwyEXN1hkjZsUKdUhETbxba9A+m5OHZvAgJjr4vg4KhRGH7pE55fBtrI87VGv6vi X-Received: by 2002:aa7:82d9:: with SMTP id f25mr26081011pfn.45.1553550544201; Mon, 25 Mar 2019 14:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553550544; cv=none; d=google.com; s=arc-20160816; b=GowQrq/QDKSjd9WF8ayB5QBIBeYJfDOK9BFd1inwScHLMAhpInKJhzjDH7BJnm6Z/c xSljRcw3DLW7umU2dBJaXC/btbkAVlEXF6yM+gvcmbH2ZgrmjZrMTmgt1PFWMhm2cOlz 027/QNVU7uzanrtsqfq5X5CG/Hyd1Y7wLu2TwobUBXv2TN7OUEXkJAlXh9tTKI9Zv3U8 wj5p4fdBjMgprpEXn8AIJSq8EQm0fJiTe7cfknPAd+41pu3RK0q3LcBTE1N3zliWPEOe XV7fKMnacwbI9iKfyAJu//sZaE5HmEa+I5pufi91gaJZ06fq4bt5CKU7JEd+B8uIyarB sB8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2Gg4xL4ScPNssnTqg8moxH66eUohXt4Ejl4Gc/tB5ek=; b=asYgp0/0qvAsXK0RBTpUoE5rxcdw9kUNd3IWjWP1Q/LarV4SNuN2WbucHn9MFdkXDO HWXeBfEWAIHLVMizC3GLEyW7+8z5VO8yjAEa4NvKAFva8Vlpl1Z+o9bsgeaCTpUwg8sZ QXQHc/1MZ1Tfrfsqs38oCcBQPZNFYSEz8P12gydl8k/PjApsgQmsFDLdf7helD5nVyKI JAMmzbLCqXQ3fYiHbKrLbSaiQW83OvY65oMNSCSUrbxwYh4zaezXnblZsiLkDgHjh1Vy /bhUjZXOoV2RfKIrwvAUhpxJeAE6U5yw8HulzAsA3HxCGkEcWYsnzPQuDsSoz5pQkjn5 3DNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=eHS0zK4A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si15045392pls.1.2019.03.25.14.48.48; Mon, 25 Mar 2019 14:49:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=eHS0zK4A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730273AbfCYVrm (ORCPT + 99 others); Mon, 25 Mar 2019 17:47:42 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36829 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730075AbfCYVrl (ORCPT ); Mon, 25 Mar 2019 17:47:41 -0400 Received: by mail-pf1-f196.google.com with SMTP id p10so7066546pff.3 for ; Mon, 25 Mar 2019 14:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2Gg4xL4ScPNssnTqg8moxH66eUohXt4Ejl4Gc/tB5ek=; b=eHS0zK4Adx8x/59ecitIEiElI1ln3WUssGpHFk63TAYzEShMhs5pzHhIleccTbKAj1 0fCt6U+QFPjxxXMtYSmIa8RotPRJ39Ej41YbWJxCfHNOEbxV1XXX0/nrp3HEDQQLjLDU WtthA56iyt+eo5GV1LFMUhCRtIuIrqxsyoaYs= 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:in-reply-to:user-agent; bh=2Gg4xL4ScPNssnTqg8moxH66eUohXt4Ejl4Gc/tB5ek=; b=L0xhdZd6gGpD58d+icoNXtWLRO0b5/qoaWtgfrTeSgVZ9kMU5ZSVjsMov2UcOnmiVb J7uEdnjuHs+gsETu6IGmxE8jutNesoQSV3AMm/pt9F9MMUwrYHVqNiVVji942P6QPI0G Ym+/NSnnF76BtiU8h3sTcJyf78tbNtFnKJU4W1ZFn5p52k0xjdpKA6psABEQwhkGTthp 4PSLXonPV8TStresWoTR0bqdVhSi5h8kDF9FPEAzxRYvEvAIUfpS8oSIBfXzmSu029Pa 97uyiaP4BenzCq4moFvUu+c6NMtP0mCRuWCUO3TbHHM+dPkxS0zYRELcBoy8JuYDBmG1 4xvQ== X-Gm-Message-State: APjAAAWuFOzO6U40Zq+AGblWVgBqpR0tWGAscpe4K8FHraUHEqd94S3Y QDpTSROI/cPjrDc1IGkgS3oy/A== X-Received: by 2002:a62:b61a:: with SMTP id j26mr25924312pff.151.1553550460844; Mon, 25 Mar 2019 14:47:40 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id v19sm29523577pfa.138.2019.03.25.14.47.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 14:47:39 -0700 (PDT) Date: Mon, 25 Mar 2019 17:47:38 -0400 From: Joel Fernandes To: Chenbo Feng Cc: Sandeep Patil , LKML , DRI mailing list , linux-media@vger.kernel.org, kernel-team@android.com, Sumit Semwal , Erick Reyes , Daniel Vetter , John Stultz Subject: Re: [RFC v2 1/3] dma-buf: give each buffer a full-fledged inode Message-ID: <20190325214738.GB16969@google.com> References: <20190322025135.118201-1-fengc@google.com> <20190322025135.118201-2-fengc@google.com> <20190322150255.GA76423@google.com> <20190324175633.GA5826@google.com> <20190324204454.GA102207@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 25, 2019 at 12:34:59PM -0700, Chenbo Feng wrote: [snip] > > > > Also what is the benefit of having st_blocks from stat? AFAIK, that is the > > > > same as the buffer's size which does not change for the lifetime of the > > > > buffer. In your patch you're doing this when 'struct file' is created which > > > > AIUI is what reflects in the st_blocks: > > > > + inode_set_bytes(inode, dmabuf->size); > > > > > > Can some of the use cases / data be trimmed down? I think so. For example, I > > > never understood what we do with map_files here (or why). It is perfectly > > > fine to just get the data from /proc//fd and /proc//maps. I guess > > > the map_files bit is for consistency? > > > > It just occured to me that since /proc/ > one of the fields, so indeed an inode per buf is a very good idea for the > > user to distinguish buffers just by reading /proc/ alone.. > > > > I also, similar to you, don't think map_files is useful for this usecase. > > map_files are just symlinks named as memory ranges and pointing to a file. In > > this case the symlink will point to default name "dmabuf" that doesn't exist. > > If one does stat(2) on a map_file link, then it just returns the inode number > > of the symlink, not what the map_file is pointing to, which seems kind of > > useless. > > > I might be wrong but I don't think we did anything special for the > map_files in this patch. I think the confusion might be from commit > message where Greg mentioned the map_files to describe the behavior of > shmem buffer when comparing it with dma-buf. The file system > implementation and the file allocation action in this patch are just > some minimal effort to associate each dma_buf object with an inode and > properly populate the size information in the file object. And we > didn't use proc/pid/map_files at all in the android implementation > indeed. You are right. > > > > I am not against adding of inode per buffer, but I think we should have this > > > > debate and make the right design choice here for what we really need. > > > > > > sure. > > > > Right, so just to summarize: > > - The intention here is /proc//maps will give uniqueness (via the inode > > number) between different memory ranges. That I think is the main benefit > > of the patch. > > - stat gives the size of buffer as does fdinfo > > - fdinfo is useful to get the reference count of number of sharers of the > > buffer. > > - map_files is not that useful for this usecase but can be made useful if > > we can name the underlying file's dentry to something other than "dmabuf". > > - GET_NAME is not needed since fdinfo already has the SET_NAMEd name. > > > > Do you agree? > > > Thanks for summarize it, I will look into the GET_NAME/SET_NAME ioctl > to make it more useful as you suggested above. Also, I will try to add > some test to verify the behavior. Sounds great, thanks! - Joel