Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4725293pxu; Thu, 10 Dec 2020 04:05:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwu9ks/eqeRNOFUM5LelmzASGaCb3J/aqqbpMobnSmQCaiWd+iUCMyMrORvCcPxpYMRl+at X-Received: by 2002:a17:906:a182:: with SMTP id s2mr5835024ejy.249.1607601953624; Thu, 10 Dec 2020 04:05:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607601953; cv=none; d=google.com; s=arc-20160816; b=xm+4ITXGLBJZYOFhwwM4KjjRWOC8bTfyFDNojrYMQMHkqEgudguYvs1raxjuybzQb4 7zVlM0xlGJsb39afy6Roe5U7JmIcMSRmq98IFnQzcS5nMAN37agwUc9XRMKdiXQyIS0X N0VowidWwBIa7ihKIzTIvYVxxonMpQEmyIUlP6QsGvqEbCQ0BBWPwQdopzBmtX6D146k rILL+QO5eFw6U4roVyh45COVytaQbegJBgr90gJadFwm/Ca0ksl+YGYq9Kz7stjjy6JI lD4Aib+rPe3LDOaZGedpofP4pX2X7uwRh+ekLjcTQFQVZEOdmr/LwKSbhImNwZANomej e7bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=26Ds+xjLYxlyiDrAw+q/Gft3jO8RNSIH1EaBVr3YRWw=; b=VXVV99n/PtlrgcbdwapLHEVuhRX38bkQ1J5FwD7xQLdHQB572/wQjG0OTfmb0jKFw8 9dykzq+HtypTHsN71eoXdSPHFzElzaFwk299xOf1+dvvETzC5AuAvIEu+6fokH2bMmIv zxCrgDYXMetunH7yEkBO8uu7KIQK+TtbZZD70V0NPUd3SbmkJ47uvP9i7B4QpPFDCUtm hekAITaQgpJVGady32xx6OuVDJsoJV7Y3OHCYnMYc2tJgsFYXIVLwvTJefVqATw+8r7N mA577FSmOTLJjubar4CVkUe/XQrO+YPYRHsYrFKFB7P0P33U71sAvqZAWX3DzvjFLX8h qe4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=lSdOxFmO; 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 eb9si2725118edb.436.2020.12.10.04.05.29; Thu, 10 Dec 2020 04:05:53 -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=@ffwll.ch header.s=google header.b=lSdOxFmO; 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 S1729359AbgLJL0y (ORCPT + 99 others); Thu, 10 Dec 2020 06:26:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgLJL0x (ORCPT ); Thu, 10 Dec 2020 06:26:53 -0500 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8941EC0613CF for ; Thu, 10 Dec 2020 03:26:13 -0800 (PST) Received: by mail-oi1-x242.google.com with SMTP id k2so5312571oic.13 for ; Thu, 10 Dec 2020 03:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=26Ds+xjLYxlyiDrAw+q/Gft3jO8RNSIH1EaBVr3YRWw=; b=lSdOxFmO/wAApZldtzGe+fP9ge2caZIKfgzOJZKuezeQuMaShUSlqonQqUJiHUnUuQ 4Kx9jXT1bYcD9HXyMyArkkW5rvBsAkOjIxoS/4sQzEt4lvQk9ORQMeRMN1UK9q7/z1RV TlzumT2ceJkyprsJiui9j3FjdAk8Igcu+zSPQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=26Ds+xjLYxlyiDrAw+q/Gft3jO8RNSIH1EaBVr3YRWw=; b=dcIcGV612GgAymGXO4I98MAUA3vIcZ5UnAWFrwEKx7SX7Rf9vKvpW+6qV3A7xUJZHq VNue+WnaXhvwV+sW2KOrAG8IxYFwYfC6cGQZJN2GqiLLGFqbPRJj8r+Y5bE5qMfv/zQI 93woOQJXJQqYXiBMRey/dXgDowzNAAeoq+iGohsFoHlH5xNEwNm9SQw+HqhN/blajBxR RcuzDGsHfjAjYhIaEeaYjpI36dWrhn8wOjWdz1CY9wNoIflR8B/3/qQ/tqGY6k5X4BPB Z2AjYaxeIVRuWqsLHtPuRsO5ZQUWPkf25BkGFyJ2zrIU5aJNvwdnUHFM/xkDgIjXIemg 6EFQ== X-Gm-Message-State: AOAM533cwnLFRQbHAvV7t549vpEwBftg90bLQBF/YIHoglRagC9B2/3H hDSyawpcAO0Wk2PfCRsBahJkDbdS17+/r4qwb5iRIg== X-Received: by 2002:aca:4d08:: with SMTP id a8mr5091494oib.128.1607599572945; Thu, 10 Dec 2020 03:26:12 -0800 (PST) MIME-Version: 1.0 References: <20201210044400.1080308-1-hridya@google.com> <20201210102727.GE401619@phenom.ffwll.local> In-Reply-To: From: Daniel Vetter Date: Thu, 10 Dec 2020 12:26:01 +0100 Message-ID: Subject: Re: [PATCH] dmabuf: Add the capability to expose DMA-BUF stats in sysfs To: Greg KH Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Suren Baghdasaryan , Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Hridya Valsaraju , Android Kernel Team , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 10, 2020 at 11:55 AM Greg KH wrote= : > > 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=C3=B6nig 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 differe= nt > > > > > processes. > > > > > > > > > > Currently, this information is exposed in > > > > > /sys/kernel/debug/dma_buf/bufinfo. > > > > > However, since debugfs is considered unsafe to be mounted in prod= uction, > > > > > 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 produ= ction > > > > 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_is= sue > > and we're designing a narrow solution for that and then have to carry i= t > > 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 :( If this is just for dma-heaps then why don't we add the stuff back over there? It reinforces more that the android gpu stack and the non-android gpu stack on linux are fairly different in fundamental ways, but that's not really new. -Daniel > 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 tha= t'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 demonstrat= ion > > 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 abo= ut > > 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 int= o > > 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 > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch