Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4828001pxu; Thu, 10 Dec 2020 06:31:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyz2XbQxnz5ziWNSuUWUckiFlUR+jcNjKjyqvFGGVKnxx2f38deFrKdwZOV3YiiXhbfsPUC X-Received: by 2002:aa7:c58a:: with SMTP id g10mr6971284edq.315.1607610664189; Thu, 10 Dec 2020 06:31:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607610664; cv=none; d=google.com; s=arc-20160816; b=Q3KcrPrvYKp5IagezfvNPByFQa8F70EdE5dz6oS68dyUGMRfyEPypOiEf9tH42h8He P5Ai848FV++0MVEabDmTYVYmT1Nf3Bj1xraKoR/wZn6mhZdAQxieo01KMuRPgyU29LA9 RMn/UIJEj2BR6MLpyy8WFkteKl7sExM8WUSkwbWk+M2iVsBduEsoa7s7xMD/fpGvjBq5 ShfuMEiyywG5mscanM0pQPCyEMenkx8sLF8dPJNitT1NiamrfaWuBCiKsuGuret7q5jW Z3e5f4rzlCrkSC9MFHYsVJMHGzjU/2fvj0XoKbs1X+HLqxDf6kIax3etkA3WJkJjr5Ss 7Mkw== 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:message-id:subject:to :from:dkim-signature:date; bh=AR3+lOPameEtJfrVbatsTif2ynsmMrCnXdjsTSW2zIg=; b=hPMnvL6y6ueFMtpiPpTwXnpEsI1c+/9zRPllm8HcKdFbe8JFyfY85Bi3ByVH3X4MOg IgtO7GlNyZ/QOuVYG8YIfpHhsGDTvN/PPRhYIOUBdR5jwb6dbMLDpuWiMeeoDKrUMkhV FLeyqDRHgOwWg4eN3DfJ7qy16Edo5JbUZCRM1URDxbnUE/SvETZEhgcp7/+KDX/2awbD dev1VXL2xb2gbLIAKGVzdrNlGX3Axl4KFQ8r/P8nGgH9+PrKMzeXwLzIN1Ez+P1+s3P9 un43YLFwgg1SqjTmySQKlWByJNbNQtVQdIwE2BTMrY7qIH/wlkJYQbQsbzesrQsSSLCY hyLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uNJUj8Xv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si2810092edp.84.2020.12.10.06.30.41; Thu, 10 Dec 2020 06:31:04 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=uNJUj8Xv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389161AbgLJK4H (ORCPT + 99 others); Thu, 10 Dec 2020 05:56:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:54714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389133AbgLJKz4 (ORCPT ); Thu, 10 Dec 2020 05:55:56 -0500 Date: Thu, 10 Dec 2020 11:56:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1607597715; bh=fIdtGp8vWJ8rg/wWH4ZsOydgwsBnqjqa6suyPx9CjfQ=; h=From:To:Subject:References:In-Reply-To:From; b=uNJUj8Xv/P5uwUw4YhKVzlwl51hpeBuON60UdAv3sBOhpHulQebDdtLbzFylGBF1t 9Lhwbxdf8pMSKN1m7Bbd1q2Jepska5L9E+yXMC8giviE+EG9nw8uIPi3IAzMimIIS0 27uyTunzMLLsj7WS9F3TRfBEkUkBZj9IUGJJysRY= From: Greg KH To: Christian =?iso-8859-1?Q?K=F6nig?= , surenb@google.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Hridya Valsaraju , kernel-team@android.com, linux-media@vger.kernel.org Subject: Re: [PATCH] dmabuf: Add the capability to expose DMA-BUF stats in sysfs Message-ID: References: <20201210044400.1080308-1-hridya@google.com> <20201210102727.GE401619@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201210102727.GE401619@phenom.ffwll.local> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 10, 2020 at 11:27:27AM +0100, Daniel Vetter wrote: > On Thu, Dec 10, 2020 at 11:10:45AM +0100, Greg KH wrote: > > On Thu, Dec 10, 2020 at 10:58:50AM +0100, Christian K?nig wrote: > > > In general a good idea, but I have a few concern/comments here. > > > > > > Am 10.12.20 um 05:43 schrieb Hridya Valsaraju: > > > > This patch allows statistics to be enabled for each DMA-BUF in > > > > sysfs by enabling the config CONFIG_DMABUF_SYSFS_STATS. > > > > > > > > The following stats will be exposed by the interface: > > > > > > > > /sys/kernel/dmabuf//exporter_name > > > > /sys/kernel/dmabuf//size > > > > /sys/kernel/dmabuf//dev_map_info > > > > > > > > The inode_number is unique for each DMA-BUF and was added earlier [1] > > > > in order to allow userspace to track DMA-BUF usage across different > > > > processes. > > > > > > > > Currently, this information is exposed in > > > > /sys/kernel/debug/dma_buf/bufinfo. > > > > However, since debugfs is considered unsafe to be mounted in production, > > > > it is being duplicated in sysfs. > > > > > > Mhm, this makes it part of the UAPI. What is the justification for this? > > > > > > In other words do we really need those debug information in a production > > > environment? > > > > Production environments seem to want to know who is using up memory :) > > This only shows shared memory, so it does smell a lot like $specific_issue > and we're designing a narrow solution for that and then have to carry it > forever. I think the "issue" is that this was a feature from ion that people "missed" in the dmabuf move. Taking away the ability to see what kind of allocations were being made didn't make a lot of debugging tools happy :( But Hridya knows more, she's been dealing with the transition for a long time now. > E.g. why is the list of attachments not a sysfs link? That's how we > usually expose struct device * pointers in sysfs to userspace, not as a > list of things. These aren't struct devices, so I don't understand the objection here. Where else could these go in sysfs? > Furthermore we don't have the exporter device covered anywhere, how is > that tracked? Yes Android just uses ion for all shared buffers, but that's > not how all of linux userspace works. Do we have the exporter device link in the dmabuf interface? If so, great, let's use that, but for some reason I didn't think it was there. > Then I guess there's the mmaps, you can fish them out of procfs. A tool > which collects all that information might be useful, just as demonstration > of how this is all supposed to be used. There's a script somewhere that does this today, again, Hridya knows more. > There's also some things to make sure we're at least having thought about > how other things fit in here. E.d. dma_resv attached to the dma-buf > matters in general a lot. It doesn't matter on Android because > everything's pinned all the time anyway. > > Also I thought sysfs was one value one file, dumping an entire list into > dev_info_map with properties we'll need to extend (once you care about > dma_resv you also want to know which attachments are dynamic) does not > smell like sysfs design at all. sysfs is one value per file, what is being exported that is larger than that here? Did I miss something on review? thanks, greg k-h