Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1581297pxu; Sat, 12 Dec 2020 18:45:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGe9Z26S4Uy45UbRvbTCCJxfjo4B7Xbg8DlRkSQUOCCDLkveFgAS3aP/lGc+82bBe/5hR2 X-Received: by 2002:a50:d553:: with SMTP id f19mr18474998edj.323.1607827525473; Sat, 12 Dec 2020 18:45:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607827525; cv=none; d=google.com; s=arc-20160816; b=Mi/B5i4JsJVBYmKyScEN/pFVhW0AtXKOaKWogouJjrQV/GwLF8nPTMe+IRBerpuOvy Q3mZH3evXmRTyv3oGMJmCEYE0CMJlx55fzILazjZPdjroNeaklGK28eJzMBkcVKHN/Dk 2KTnFC6PdfgUstMl0O0ebF3QJYu+WC7eMgsWUdlZLUI3qSZZUmrh2dmBxb1B2mcQ2ac8 DEy3iiFlhSAmPnTnQ7eKbGI94QoQlHDwLKeRfnR43qvCrxnh+7rfZl6GEconsyqZBxfR g0tsBIuqnwI4OWUBTx/8Se6BpJ4iT1zWMXsCkq1/AsedMXex+r30X3juXbR/aHOLaysz LN8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lMZxDCK3EHPV415eTfAWmt24gOYNu8m5s7i1OWUhO90=; b=OJ3IvF75v8nojC9tmlScjL95ZTzoSXOjX5b3uhdcUfutB+3C9SDreXzKhZPsoeozWi oow23rVti8jaamdTOtSq5U/GsIxGtwnuhPrB8qbsoCQH8rWqxHmFzW+ZU8jnpMdS7Lub e3H34K2LgWRqjZgSWMicmguf/Hx7g/h/j/tOlDPUvfFFKaSdVwK6BdnQW6Ir/E0eWGd9 sSspKce1mp4u99vzOxSp5gZOESVU+FxtuHp5oRijhhGQPeC+rdRSLJIgaEjmXcxfEriI lffgYG6Cpxybuz5UmQUb90xjuJ48LPJy2fJxilSR3O+0x1tCSKX351zVbFiHsKsgAa0J Ui8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zZbDT1KG; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si7043256ejm.64.2020.12.12.18.45.02; Sat, 12 Dec 2020 18:45:25 -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=@linaro.org header.s=google header.b=zZbDT1KG; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394434AbgLKUY2 (ORCPT + 99 others); Fri, 11 Dec 2020 15:24:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394385AbgLKUXH (ORCPT ); Fri, 11 Dec 2020 15:23:07 -0500 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A07EC0611C5 for ; Fri, 11 Dec 2020 12:21:56 -0800 (PST) Received: by mail-lj1-x242.google.com with SMTP id m13so12332278ljo.11 for ; Fri, 11 Dec 2020 12:21:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lMZxDCK3EHPV415eTfAWmt24gOYNu8m5s7i1OWUhO90=; b=zZbDT1KGkvTMeQKEnAfTOSZjzsYrkD4Tgz8brLNeq6Lh4awBtr+xmRlRiafzhVoJIR rqZvyx3xlXzyBSSyeI8F5oswzPW8NDb/y8mCdCiO+2PVQmZ1VYdPdg9ovC+UpKmBL3b2 2APVlSMD+d0xwnH0u4wSXvQUH52WMhUtGXxFcyJ/ULZoBF0Bma5GMAbrADaEHVKdC+vs yuYscH4GMdsTvkz8FK+ogTr6Cvov9VDoJ8KnU6qqK+4jvwheJG61Rjb45YA5Kdeoq61A mE+xnJEqqQ/d1F9pCzWkPAJmQaI8EDY71YJp4QmUKzSAz+va4cy/SYHk1S1JqX08YyIZ lebA== 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; bh=lMZxDCK3EHPV415eTfAWmt24gOYNu8m5s7i1OWUhO90=; b=XJ2Pyxap4lZcrJXUSKs6mZlPCcgdxDVHmStxh3NTYUN1+kcV6RcvZKLASv/0C0VbUc 6+4bMPdLHbJZkzZOzG01zZeR7WWNfVeyhwMqkTQZ06Nj3WuZ1pby7RQlS8yb3L3xqDGF 0YJB+DhTDYEJAxht3AfaH6ubdrn0tOEBLN3ObPqq0a3BFcY0YkN3iPJRTufdNJ/FC8Vx vSWP1T9YxmEjDr4qWtvaUvOE44Z2mFMz/M2l+OX8pZmO3ey0Kha8cZ5TP72VveJc20Fd YvGbrWWuNIoeVsz7XsCb+9DxhQNG4jsbjs4v+U4R0qRNuk41ckwub2l4ImslWDbMNHpZ eyrw== X-Gm-Message-State: AOAM532IhQykCfVEI67+aVpW9oEKBqv9+DP7db+M6zBTP34vHX3NUsCI u4FJkJ40tVaNpYGT0DWkfFPt5EpinQGtFzAmkEhybQ== X-Received: by 2002:a05:651c:286:: with SMTP id b6mr5684677ljo.232.1607718114626; Fri, 11 Dec 2020 12:21:54 -0800 (PST) MIME-Version: 1.0 References: <20201210044400.1080308-1-hridya@google.com> <20201210102727.GE401619@phenom.ffwll.local> In-Reply-To: From: John Stultz Date: Fri, 11 Dec 2020 12:21:43 -0800 Message-ID: Subject: Re: [PATCH] dmabuf: Add the capability to expose DMA-BUF stats in sysfs To: Daniel Vetter Cc: Greg KH , Android Kernel Team , Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Hridya Valsaraju , Suren Baghdasaryan , =?UTF-8?Q?Christian_K=C3=B6nig?= , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 10, 2020 at 5:10 AM Daniel Vetter wrote: > On Thu, Dec 10, 2020 at 1:06 PM Greg KH wrote: > > On Thu, Dec 10, 2020 at 12:26:01PM +0100, Daniel Vetter wrote: > > > 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: > > > > > 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 :( > > > > > > 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. > > > > Back "over where"? > > > > dma-bufs are not only used for the graphics stack on android from what I > > can tell, so this shouldn't be a gpu-specific issue. > > dma-buf heaps exist because android, mostly because google mandates > it. So, I don't think that's fair. dma-buf heaps and ION before exist because it solves a problem they have for allocating shared buffers for multiple complicated multi-device pipelines where the various devices have constraints. It's not strictly required[1], as your next point makes clear (along with ChromeOS's Android not using it). > There's not a whole lot (meaning zero) of actually open gpu stacks > around that run on android and use dma-buf heaps like approved google > systems, largely because the gralloc implementation in mesa just > doesnt. So yes, db845c currently uses the gbm_gralloc, which doesn't use dmabuf heaps or ION. That said, the resulting system still uses quite a number of dmabufs, as Hridya's patch shows: ==> /sys/kernel/dmabuf/28435/exporter_name <== drm ==> /sys/kernel/dmabuf/28435/dev_map_info <== ==> /sys/kernel/dmabuf/28435/size <== 16384 ==> /sys/kernel/dmabuf/28161/exporter_name <== drm ==> /sys/kernel/dmabuf/28161/dev_map_info <== ==> /sys/kernel/dmabuf/28161/size <== 524288 ==> /sys/kernel/dmabuf/30924/exporter_name <== drm ==> /sys/kernel/dmabuf/30924/dev_map_info <== ==> /sys/kernel/dmabuf/30924/size <== 8192 ==> /sys/kernel/dmabuf/26880/exporter_name <== drm ==> /sys/kernel/dmabuf/26880/dev_map_info <== ==> /sys/kernel/dmabuf/26880/size <== 262144 ... So even when devices are not using dma-buf heaps (which I get, you have an axe to grind with :), having some way to collect useful stats for dmabufs in use can be valuable. (Also one might note, the db845c also doesn't have many constrained devices, and we've not yet enabled hw codec support or camera pipelines, so it avoids much of the complexity that ION/dma-buf heaps was created to solve) > So if android needs some quick debug output in sysfs, we can just add > that in dma-buf heaps, for android only, problem solved. And much less > annoying review to make sure it actually fits into the wider ecosystem > because as-is (and I'm not seeing that chance anytime soon), dma-buf > heaps is for android only. dma-buf at large isn't, so merging a debug > output sysfs api that's just for android but misses a ton of the more > generic features and semantics of dma-buf is not great. The intent behind this patch is *not* to create more Android-specific logic, but to provide useful information generically. Indeed, Android does use dmabufs heavily for passing buffers around, and your point that not all systems handle graphics buffers that way is valid, and it's important we don't bake any Android-isms into the interface. But being able to collect data about the active dmabufs in a system is useful, regardless of how regardless of how the dma-buf was allocated. So I'd much rather see your feedback on how we expose other aspects of dmabufs (dma_resv, exporter devices, attachment links) integrated, rather then trying to ghettoize it as android-only and limit it to the dmabuf heaps, where I don't think it makes as much sense to add. thanks -john [1] Out of the box, the codec2 code added a few years back does directly call to ION (and now dmabuf heaps) for system buffers, but it can be configured differently as it's used in ChromeOS's Android too.