Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp248684pxb; Mon, 8 Feb 2021 22:10:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz80oopof3DqLM9MEfVDRtOiSuXSkgFGJpCGGzwVzSu4XXkwo+TT7LD/kblDyKqFWvwFlda X-Received: by 2002:a50:9d4d:: with SMTP id j13mr20621418edk.83.1612851029468; Mon, 08 Feb 2021 22:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612851029; cv=none; d=google.com; s=arc-20160816; b=ggsf3tXiqdLgiDHtyCXBB6d0Q/m7+4aNNvdj/3LGqsqfHvwDBrvaIKQfPQ2zpIQvrd WSVXYpLOFG3ZAAeGG5Iw7l1V59Txx9aWhnA/HFDfhJmV2J+Us93zpzjXqoOD+Oh7d1cN Ipr1ZK3SREoK7IikP06h3RJK/2kTEFXKMkPuubcvMU2EdrJUSJ/Ae3iuqsGe8aExPrN6 FF9MqJ2f61BqTtORdpke72mDF1tnLh7vkN9Rs+ohRdT0j5tSy/P6XnGUSmptwRo6934i W6NZJL8JOm1JcGSgAlZleywe3V21uiNCx3Lj5St76wXh0fGmFpXwCQ0iA2saynTrKv7u +jCA== 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=bFTwqrQOTlvInkNf0kKdtf4ltTQxpHoLu4FqF5dCdQo=; b=uhFmEUcDJPgvixAHMOXkvuwnPXrsxY0Jl+IYj5QTXLNuHc+PFSkOpFPCIL8CEPxZ9P M/WOWRXVkzwyBWAXrUZRe77eXUKWlSy3LIGI/J8WBfQCP8s1VBo6LnXcGaljY8kvGuZ6 VwTAJjhthesHK7/d/OK2xK8M5kpSLPzU+zRVUFI2FJ6Ml0jlR0fyS0lyJZNfujKsGHZP 5hyrBOsW6NRKPLdEnnDdBRxVGOmcNTtydmSl+UbAle/pBa+Pvc9GyHfiPqA38KX8it3c FKBMpxz8ZEIhd/UUCl8cm0JF6/EWv2xQddcOjEaNR6tHLSDUl0lMTNgS7gVZQDuSpshb YeYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rdjuJ2gt; 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 j16si3031203ejy.305.2021.02.08.22.10.05; Mon, 08 Feb 2021 22:10:29 -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=rdjuJ2gt; 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 S229464AbhBIGHc (ORCPT + 99 others); Tue, 9 Feb 2021 01:07:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbhBIGHb (ORCPT ); Tue, 9 Feb 2021 01:07:31 -0500 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71CA7C061788 for ; Mon, 8 Feb 2021 22:06:50 -0800 (PST) Received: by mail-lj1-x22c.google.com with SMTP id e18so20797982lja.12 for ; Mon, 08 Feb 2021 22:06:50 -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=bFTwqrQOTlvInkNf0kKdtf4ltTQxpHoLu4FqF5dCdQo=; b=rdjuJ2gtSC65AiMzUutBnOi521KBaQqXUXIZ75BtduxsdrzHOoc8/KEGR8b0fL2OTD NqoRxhDmDihdffowk+nfprgxDkneP/ClGEH0Rw3QS07+TjhqaIQao7u8SmPkKAlvmF2j 02STEAAA2wlu5SieMs4bzC2IYvMXYHPHtN40kV9bhdTyzPFI9xd+4a2qI9NJ01NYnsiX z3R+bCwu/RAonK7HoH20rp9LOPvI8CGgO+NSkouNuToG000yqFJoVzNWHwRx0OP/UV+0 SnVOi5NjKPpapwoM7wYFCqr6wp3QXMGwzeqYTX/WNxhpMN7sUabhtsxgREVD7frjlZzX HMUQ== 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=bFTwqrQOTlvInkNf0kKdtf4ltTQxpHoLu4FqF5dCdQo=; b=uJ1kGPfVDOH0r5IwlY8ebPKH9kcIyXVZ4j0clUqoIkqW8vIe/AmM3VennYmSuak5Xs uS99PKxS/DIUPnFqVI97WvSvIvo2fhCZX66Vnapm32LAp6c/fwv8ASh6CkvWPDiGySF5 7cCjcgizzXiaJiZgNEIGnMbUuA3cTabPHBgGDeazUsAmpPrbQt8jTm2TGlv6Q2xBjxgf SMAJpBCNMO+WwoH1ZBltlqLVBtrYEFw7zTSrd1Zte8bGCvkxx0Oj26aJuv/jwBPhsV/E R1UZUsJHSCfbTboFD8djmhC9ffJ5M2RDOig0AkaKXAndgqdVs+xGI3glepRQjUvbWHfZ +5lw== X-Gm-Message-State: AOAM532aCvyA4KP9m2OZRJsCFSt7MOVeC1lyQ5nrvn4H34U+OgAGQYKO 2Uk4r3yBCKIxvwdYmQQflExQKh+CJciqiTzMmbGhVg== X-Received: by 2002:a2e:3018:: with SMTP id w24mr13882499ljw.333.1612850808847; Mon, 08 Feb 2021 22:06:48 -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: John Stultz Date: Mon, 8 Feb 2021 22:06:36 -0800 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: Sumit Semwal Cc: Daniel Vetter , 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 On Mon, Feb 8, 2021 at 10:03 PM Sumit Semwal wrot= e: > > Hi Daniel, > > On Tue, 9 Feb 2021 at 02:36, Daniel Vetter wrote: > > > > On Mon, Feb 8, 2021 at 9:51 PM John Stultz wro= te: > > > 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, sinc= e > > > > dma-buf heaps aren't very dynamic. But on discrete gpu drivers buff= ers > > > > move, so baking in the assumption that "exporter name =3D resource = usage 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, s= o > > > the heaps exporter name matches the string used for the heap's charde= v > > > 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. Before you do, let me spin a v2 as I got some minor tweaks needed (using const char*) to fix the kbuild bot errors. thanks -john