Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp13851pxb; Mon, 8 Feb 2021 13:46:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyu5GjG3TT1p6rfih/9JVtUdFt1P/Rw4ecEkBw4uB47fGXesfdX8RMu1PhlnAvX3Bf9NGTZ X-Received: by 2002:a17:907:933:: with SMTP id au19mr19024163ejc.51.1612820769346; Mon, 08 Feb 2021 13:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612820769; cv=none; d=google.com; s=arc-20160816; b=0xgC7p409amOI0sKdqkaG0VXzTw0MuYAHSJ2/vygCwpGbguBPPAIGLOtdHujPNOpHK 56LHL98r0Ijt+6s46b5RI1lDVQviIrUEaRoEpYUL9lLzKOidvYiauLxmSI1R2R5DygCT mtlXaPjXgAuIZ15rMq1x4BUk1cTVIyk8tz30l9EJxFYon1VbCfDfrmLdzqibNUaYR1wZ jZldW1p8nIGujaOSFlYJ5LH+Q8KFYH1MtsVM64vkV42s8rNTUUwXrtqOTydWGn4rMkHS mAIahqi+Fc7WQoMbAy0xEzn9shhd1BIDT1I41c48EhpbIN0xCPlZ8P0FF2yQM/gpMwTx GzYQ== 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=vQz50O/ktJ04W7QSg0aQ+K5LizhyaY13N/jjRfnL8MQ=; b=PmPLiSmFslM5TzNrVgLi/FtlHWOP9Vk/eNCPZtRuSQgGLfxvNRHf7AgTdGxBhL1TkW qgV/GavxyvnnVrqmNSfdEXiimKy4/UKsKZCEpAkeWgKr+BhCgUgEdqfliFCQd/p6MAiL 3eyESyd2uTJ2Xwgj0rXiBdLdNUPsJhMB2PqUwifrpXNu6U7vfaUcnxdK8f1EbZBsprXz Rsxk0kIEhfrGgFtqqWn0BhUNDpkU2JMibv0eq7XidjjE+O3GmtPtjtrcItCuURhtFeip +OI5XW7DoybbhP9cKP66l0nuS4fh17hzQTGxR732GTKFW8bPsxFw0b1CDEJpzk0GaYoQ MDiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=VrgGYFAR; 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 cn3si14505033edb.69.2021.02.08.13.45.46; Mon, 08 Feb 2021 13:46:09 -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=VrgGYFAR; 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 S236352AbhBHVmB (ORCPT + 99 others); Mon, 8 Feb 2021 16:42:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbhBHVGu (ORCPT ); Mon, 8 Feb 2021 16:06:50 -0500 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF81C061788 for ; Mon, 8 Feb 2021 13:06:10 -0800 (PST) Received: by mail-oi1-x234.google.com with SMTP id v193so11683903oie.8 for ; Mon, 08 Feb 2021 13:06:10 -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=vQz50O/ktJ04W7QSg0aQ+K5LizhyaY13N/jjRfnL8MQ=; b=VrgGYFARM6Ani9Qes+VGPFt+MtqItSmYYxUeYwlIhRCQqMDqT5A5dW9uoAuc4n4Lmb HOzyq4tL31RhQQ2JNHlodj/G4uJ9HJyq5nE93+DiaCDyo79ticWaFtY/q5J/LQvrS8Qq tWCIL98eTNQBCIg5qB9ZFRe7q0paeE3NdXwbM= 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=vQz50O/ktJ04W7QSg0aQ+K5LizhyaY13N/jjRfnL8MQ=; b=LptZrmnmHwI58VGdW2BU40Hqc24T5cIeK2V2sGoOt29unSqCgrlL0VmNLEzjt4jUIo GkaT34wlortBCsKKOSZPQun8WP5g75+VYN5Vb8pu7d9938jtkj7MpBUzgvtigW+6gUbT myTcMaUb8RGgmK4wHngx6GpPQSQhSCJYWsmtXkzJU55vUcNy8EMSSiqAalDQMtNqnOdJ shc/LwVXClbNgZzp+PUSjZj4FsUFRDnLfqVgPese8F+CU+FesICSsoF9HblrFiZjDtz2 4PYGxPjRKAFic0Vj2sli5fWN06yAKSdOtOqMOmsCdvLEGa95CPqkFHLE5mctDBSS04Hn 99MA== X-Gm-Message-State: AOAM5339Lb11LKSZ7gd2P/Qbkm/hIlngqNQUulqaUmpvwxb4g1uuejhz rScrwPwOHF9hH4A+owlSMKNQazVvViaNwZ9qbIcLsA== X-Received: by 2002:aca:1906:: with SMTP id l6mr410002oii.101.1612818369680; Mon, 08 Feb 2021 13:06:09 -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: Daniel Vetter Date: Mon, 8 Feb 2021 22:05:58 +0100 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: John Stultz Cc: lkml , Sumit Semwal , 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 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 buffers > > move, so baking in the assumption that "exporter name =3D resource usag= e 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. -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch