Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp247543pxb; Mon, 8 Feb 2021 22:07:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxp3880bSS8k8L7Yt2BPoB6eJt4ZqVfHlJqEs1PYQzUm3iqyrHUu+QS8K7o0xbRPtZ9ctCO X-Received: by 2002:aa7:ce96:: with SMTP id y22mr20924990edv.369.1612850876015; Mon, 08 Feb 2021 22:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612850876; cv=none; d=google.com; s=arc-20160816; b=VoY1lTKMuV3jNNYTYOxwf1VQ6dADItbh8wj4C8DETUq/zxkF8fGK9yboWniaGn1OPv m/sjqQpDWmo9UGKm9TLrbRlidaLzNYhP54L4xnD5xTasmtHlDHOws6Pv21ws1g2AMp+F P6iz7VqXyDb8/jd16qSJCCxVDUX1Ioz49/x9Aj7K574Brg4k/jS46o6cAkVN43iVqLqG f3q04z7bk5HWOTu8zJfAaFbHBjVk686Gm6oPN3Nx9BluvHc1lizGdjbDs25LdcaWPt/Y f5+2y/eaSicXRkJp+Ee5feWJpQyUFBFZNF/VsFWkBLpv0cVKee4GHx3Jl0uq1z+PKkwj wiBw== 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=gmQ70ZY+hZdLsMMGo2UlngmwDHJDaZ+KuDOOqW/O4fM=; b=b9xF/Vda7O5dhCaxIrVNFyZWU9atygOSHQLMhNCUvefVp9EMjI/Bar3TrnSQQCeGaE p2DrnRdmWvZKU7EvjfU5tYBFnceh4/KRiNx5gH7gqSFVjv8Qm9UAp0QUTa9dvXBulX++ 3fIw6+K2YX9Su4XpIrOYIaKPt7x/e+CeduOipFb5GKuybC8acfOHCZ9WS4Lkppo2e+Y/ +9DMwI9YNWF1/5ut1hH/Ruxl7QXM1PiE3VrlRtQ8XQzvruYFf/HE4eiq3RK1MqIHPwjv VBwJZF3vzdeyxpqgRJQkVRj2KTglQbYYy04hWi0RxCIa08oatnshlELcAyndJhabz14g zPDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MSe2G+QZ; 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 y6si14559138edp.379.2021.02.08.22.07.20; Mon, 08 Feb 2021 22:07:56 -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=MSe2G+QZ; 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 S229901AbhBIGDv (ORCPT + 99 others); Tue, 9 Feb 2021 01:03:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbhBIGDq (ORCPT ); Tue, 9 Feb 2021 01:03:46 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2505C06178A for ; Mon, 8 Feb 2021 22:03:05 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id f23so9541717lfk.9 for ; Mon, 08 Feb 2021 22:03:05 -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:content-transfer-encoding; bh=gmQ70ZY+hZdLsMMGo2UlngmwDHJDaZ+KuDOOqW/O4fM=; b=MSe2G+QZ4H3yrCs40Y5Q5On9j3E2n6s1kR+l1TyP9LSx6o/ikcpalBDd2YZQe46vT+ GeVCN17ebjtonmJ2kYBXgQyerjf/Gbqiwu5y0ZrHvAQihLvREjxIoF/OLK15kR014pNe 6rdtN1/I7UJAtlgctWSVwRKheyKAdVDtrOkhNeflbhdt3r7/eRKlOT+olNYurUaBsTpV pv/Y454SwLRK0+GCmgCnwXzgPbR1cgGVB12Lm/jf0Kgchkwohp7oboCaaQm+3se9XXrc nms4ILFJWvdzXW/nGc6KFL3pgQmcAkgSIq+B25dz25SiBFwNa3O+wSLkU9dn5mR/hJOi T7ng== 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=gmQ70ZY+hZdLsMMGo2UlngmwDHJDaZ+KuDOOqW/O4fM=; b=L/JshU0DYjpPVhifhT3rvjlMFdnFg3n0ITAkX9pqqyLyjqwBAsMM7Zvym9vHYNDaPM JUyb7/KNXwArjCiwtQHopBYxeSaC3DS5hBazf3hnfZ+QcAYUyG7hwbnc/cIyUGD9PWW/ o52KOX1Wjyds+qnZNY4RmWv9YorPUZH3GFWQsV3WRP4nK66ypIgByL9hFRz8nBdDsh/c S1l1R/SV8EHuQjD2Ty5L+e6D34AaSU+TwWqIKriwLaxlNmiwyL1Abc51W+1epKO+K13r aap42w8qoT0b/7TrXa+ep+xswwU5e/dm+Mdu8LB8sMussrkKI2MzJMezGv7C+57u3L/1 C3Rg== X-Gm-Message-State: AOAM533TobAXR4L8CW2ZWhdmfCjn/+TKp9mQUwOiN/RaKrCdt7r4+cr2 ePRmfko9taYZyOZcFvuxPYR6geBmQnnLoR/NoQO2bg== X-Received: by 2002:a19:cc7:: with SMTP id 190mr4816030lfm.361.1612850582683; Mon, 08 Feb 2021 22:03:02 -0800 (PST) MIME-Version: 1.0 References: <20210206054748.378300-1-john.stultz@linaro.org> <20210206054748.378300-2-john.stultz@linaro.org> In-Reply-To: From: Sumit Semwal Date: Tue, 9 Feb 2021 11:32:50 +0530 Message-ID: Subject: Re: [RFC][PATCH 2/2] dma-buf: heaps: Fix the name used when exporting dmabufs to be the actual heap name To: Daniel Vetter Cc: John Stultz , lkml , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?UTF-8?Q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media , dri-devel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Tue, 9 Feb 2021 at 02:36, Daniel Vetter wrote: > > On Mon, Feb 8, 2021 at 9:51 PM John Stultz wrote= : > > On Mon, Feb 8, 2021 at 2:08 AM Daniel Vetter wrote: > > > On Sat, Feb 06, 2021 at 05:47:48AM +0000, John Stultz wrote: > > > > By default dma_buf_export() sets the exporter name to be > > > > KBUILD_MODNAME. Unfortunately this may not be identical to the > > > > string used as the heap name (ie: "system" vs "system_heap"). > > > > > > > > This can cause some minor confusion with tooling, and there is > > > > the future potential where multiple heap types may be exported > > > > by the same module (but would all have the same name). > > > > > > > > So to avoid all this, set the exporter exp_name to the heap name. > > > > > > > > Cc: Daniel Vetter > > > > Cc: Sumit Semwal > > > > Cc: Liam Mark > > > > Cc: Chris Goldsworthy > > > > Cc: Laura Abbott > > > > Cc: Brian Starkey > > > > Cc: Hridya Valsaraju > > > > Cc: Suren Baghdasaryan > > > > Cc: Sandeep Patil > > > > Cc: Daniel Mentz > > > > Cc: =C3=98rjan Eide > > > > Cc: Robin Murphy > > > > Cc: Ezequiel Garcia > > > > Cc: Simon Ser > > > > Cc: James Jones > > > > Cc: linux-media@vger.kernel.org > > > > Cc: dri-devel@lists.freedesktop.org > > > > Signed-off-by: John Stultz > > > > > > Looks reasonable to me. > > > > > > I guess the main worry is "does this mean heap names become uapi", in > > > which case I'm maybe not so sure anymore how this will tie into the > > > overall gpu memory accounting story. > > > > > > Since for dma-buf heaps one name per buffer is perfectly fine, since > > > dma-buf heaps aren't very dynamic. But on discrete gpu drivers buffer= s > > > move, so baking in the assumption that "exporter name =3D resource us= age for > > > this buffer" is broken. > > > > I suspect I'm missing a subtlety in what you're describing. My sense > > of the exporter name doesn't account for a buffer's usage, it just > > describes what code allocated it and implicitly which dmabuf_ops > > handles it. Maybe could you give a more specific example of what > > you're hoping to avoid? > > Just paranoia really - on the linux side where we allocate most > buffers (even shared ones) with the driver, that allocator info isn't > that meaningful, it really just tells you which code > allocated/exported that dma-buf. > > But on Android, where all shared buffers come from specific heaps, it > is rather meaningful information. So I wondered whether e.g. the > android dmabuf debug tool uses that to collect per-heap stats, but > sounds like no right now. Plus with the chat we've had I think we have > a long-term plan for how to expose that information properly. > > > To me this patch is mostly just a consistency/least-surprise thing, so > > the heaps exporter name matches the string used for the heap's chardev > > device (the interface used to allocate it) in output like > > debugfs/dma_buf/bufinfo. > > Yeah for debug this makes sense. a-b: me if you want that somewhere on > the patches. Great that this got sorted; I'll apply both the patches of this series to drm-misc-next, with your a-b. > -Daniel Best Sumit. > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch --=20 Thanks and regards, Sumit Semwal Linaro Consumer Group - Tech Lead Linaro.org =E2=94=82 Open source software for ARM SoCs