Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3879881pxb; Mon, 8 Feb 2021 02:26:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoI2Lw7QlAbyHmTbsB8FtV1nY15AUt39gnVcx0hUdbekmeFX39vykc4jZvlvOBsyDEpr/l X-Received: by 2002:a17:906:4f16:: with SMTP id t22mr6477191eju.307.1612779960251; Mon, 08 Feb 2021 02:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612779960; cv=none; d=google.com; s=arc-20160816; b=RC/hfb3tGiFviyv3h56H6BbAhJaWfYg2QRT/MIh1sN3SD3ZD8z/Uvp4ihHyEWQDk0c 8Hfc8VuIiTvZPDqAy9LMy5U8Hq3vs/yT9TYqyhXels5ji1eZ/bhO4bgEwNIFi12stOuh JYz8thXJr7ZP4X9CXIoGCR7ijt+5EEPr9ZtiqDxAS0eVOaDQ6B+orF1vpT/La8pZuudm TUurrWT0LOSNt3TxEMnHuzi6B93zh22xZ7XO6bG+G0mDw/9NHluMnGo+rUM6KVTJZXmP h3V4lTS80K/i2BSxeUrO1dXU5Z0HNJLSiaas+7+VRF5/g99uiPHMV7CJIaFRAadhu3ig btaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=0pOHlp3YfmPQ6aHp/8FB8TarZqCW4k9p2xOGz6n9MDg=; b=BMfWCWtPIfU+q5CXUHWP3EovtQM45o+N8lDluiRxCepxKsvcwHpFLhAzVXQ/3s8LLk VL/kudPuBrgqn9rKohIWq+kG3Yu59uJLS3coDHQqTfqpEyOq9yGx4uccD1cvKqzna+kj ijXnjlZfpWWry5kouZ8O56IH0U8oyU4/JbXtHz6ttjlJ9mtjXwjIwPdmaMChKkRKQy/g XJUJd2lszavJgyp8fi+ZpwQ1EdXUdWs/oBG8fgtKUVbO21NAEDvKjQ5pc2AagOuKRDWM Wdeosnh0YqXNtCivg7Kgfh2Y4GOvMI46GVvsnKe8rDW7hnPESIDRUCwt92tXkeBt+smE dUyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=d0kQAFm7; 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 jg13si13293764ejc.669.2021.02.08.02.25.36; Mon, 08 Feb 2021 02:26:00 -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=d0kQAFm7; 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 S232179AbhBHKYP (ORCPT + 99 others); Mon, 8 Feb 2021 05:24:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232473AbhBHKJe (ORCPT ); Mon, 8 Feb 2021 05:09:34 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74442C061786 for ; Mon, 8 Feb 2021 02:08:48 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id g6so3354509wrs.11 for ; Mon, 08 Feb 2021 02:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=0pOHlp3YfmPQ6aHp/8FB8TarZqCW4k9p2xOGz6n9MDg=; b=d0kQAFm7tei2XxZSgVD38fMf+wEOst/QXqkIwC7c7+FGD9nWzqN0bib59r4MF5dh5a 28Bqrogt48urasAsA0+opmN5trx4wdmhECFI5EC4xeMnqyDj3zSZp64O+RP0wjO4TWZv 3RdQuFtbld1C1h8PdndhUeNBuGZ5FRIEC/2zQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=0pOHlp3YfmPQ6aHp/8FB8TarZqCW4k9p2xOGz6n9MDg=; b=DPv9Ci4E034ly/97fx4sKrdlKKYfO6IujN3vjbEyUnKCWc7zrItQSv3Nkta2T1w5gy efYUHTbKoMQ51b7tN/PZNyOdw5NVpZrtlWMA+KciSBjSzGGaa4o9GIJVXQagXb0ylBD2 1m5I+wtRPmA910yGzlfDkZTY/dVePWabO1iIUTLFPeBhwlNyrSptXtOfTFKlS9TWqP50 7wyJs5P84DfGX9fc0iDYlpe6SiKYv3eXv1G5bk5NNZrT71127W60o5ovprs2ngYtnlxP HeXhV7xE+a/RgvMmaD8gjSv05sINgwsbHjsBHd/oKtxlxEHvyiu5z4ZLdsDcc3ZUtPNQ EilA== X-Gm-Message-State: AOAM530ZWrnxB6Cqz6ZNitiTWQbR9FyWSZq6ArX6tpCFz7CHKLUrBSH5 pSqEK2f1ka615OIthFMYwzx92Q== X-Received: by 2002:a05:6000:18ac:: with SMTP id b12mr19274155wri.77.1612778927278; Mon, 08 Feb 2021 02:08:47 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b138sm19614011wmb.35.2021.02.08.02.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 02:08:46 -0800 (PST) Date: Mon, 8 Feb 2021 11:08:44 +0100 From: Daniel Vetter To: John Stultz Cc: lkml , Daniel Vetter , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?iso-8859-1?Q?=D8rjan?= Eide , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [RFC][PATCH 2/2] dma-buf: heaps: Fix the name used when exporting dmabufs to be the actual heap name Message-ID: Mail-Followup-To: John Stultz , lkml , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?iso-8859-1?Q?=D8rjan?= Eide , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20210206054748.378300-1-john.stultz@linaro.org> <20210206054748.378300-2-john.stultz@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210206054748.378300-2-john.stultz@linaro.org> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: ?rjan 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 = resource usage for this buffer" is broken. So I'm not sure we shouldn't instead name all the dma-buf heaps as "dma-buf heaps" to stop this :-) -Daniel > --- > drivers/dma-buf/heaps/cma_heap.c | 1 + > drivers/dma-buf/heaps/system_heap.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c > index 364fc2f3e499..62465d61ccc7 100644 > --- a/drivers/dma-buf/heaps/cma_heap.c > +++ b/drivers/dma-buf/heaps/cma_heap.c > @@ -339,6 +339,7 @@ static int cma_heap_allocate(struct dma_heap *heap, > buffer->pagecount = pagecount; > > /* create the dmabuf */ > + exp_info.exp_name = dma_heap_get_name(heap); > exp_info.ops = &cma_heap_buf_ops; > exp_info.size = buffer->len; > exp_info.flags = fd_flags; > diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c > index 17e0e9a68baf..2d4afc79c700 100644 > --- a/drivers/dma-buf/heaps/system_heap.c > +++ b/drivers/dma-buf/heaps/system_heap.c > @@ -388,6 +388,7 @@ static int system_heap_allocate(struct dma_heap *heap, > } > > /* create the dmabuf */ > + exp_info.exp_name = dma_heap_get_name(heap); > exp_info.ops = &system_heap_buf_ops; > exp_info.size = buffer->len; > exp_info.flags = fd_flags; > -- > 2.25.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch