Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp145155pxb; Wed, 18 Nov 2020 19:22:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiCRDozN0GSKsVKaBMQQQui+UJMS50tgkd+/dscp8a8eFNiv+N5qKXQ/ccLUneNBY+cRes X-Received: by 2002:a50:cfcd:: with SMTP id i13mr28207662edk.275.1605756125268; Wed, 18 Nov 2020 19:22:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605756125; cv=none; d=google.com; s=arc-20160816; b=mQP7zYnWxX7jKWfo8jDaDG/Kjy1BfMxqpnSjJUnMVtYmAJZgNXK2g/b5B+HtzrC8Xf /DUANKnakj2yJdIi6yoCUDuxJgTfoxFgtxha7/v1vFAmsJcjn4dXkJrwr955XWuqamnt ZZA0fFewvvDrSTrGm5jBDEaDAjsfQN0UGn27S9j7tobVsFC07QRzdiREaLaJY7xe5LLD Dhu+FBnFOnhGs6ClSKqSnz+pcj8nKew/cWU1XzOqmL7wtf64A0FM/O+B7dXy+OAbtK9p 0sPiXPdBFyZ+T2SEjuX63sUZkvzOeX1yjgGTlBRZLd0oR+VXWiGbt9cPxfS/0ybWbyY4 /JEQ== 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=2H1F3Ka0Ka6X1YRsJFJYW9O6FRzLC0ev/xiBm/ktwsY=; b=mGUCgl0GWLXxVgRRbpRewCEb9sNhvYv/G63jxxrL3UX7Mzohjq7LNfVaiAbhu5DulQ BaGPWkOCEgk9nIzFS3Nx8Zoc5Aopt05uGd1qyfa7Iwbc3kt8nsHDHx41prkQLyBL1BDK IN0synm7gPm3KJNt6Xy63ApFJOnGKbSjHVYjnEMBwIV5sH/CyutA+tIR723StEk37iOx 8rUXHltG5skDPrawlm+5ghoYJJudQWiVXS6t0jLICqHBug8rzaqL5omxz0gwuWywCzpX T8spLCkzKyDBChvmTV9/b3xWp8fc0XJvhiw2z9p+22Rjbb721bVEm4azRWuQt9u7HWKM 0R7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IyWxWBUR; 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 bq23si16134432ejb.529.2020.11.18.19.21.21; Wed, 18 Nov 2020 19:22:05 -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=IyWxWBUR; 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 S1726107AbgKSDTU (ORCPT + 99 others); Wed, 18 Nov 2020 22:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgKSDTU (ORCPT ); Wed, 18 Nov 2020 22:19:20 -0500 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3D98C0617A7 for ; Wed, 18 Nov 2020 19:19:19 -0800 (PST) Received: by mail-oi1-x242.google.com with SMTP id k26so4815293oiw.0 for ; Wed, 18 Nov 2020 19:19:19 -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=2H1F3Ka0Ka6X1YRsJFJYW9O6FRzLC0ev/xiBm/ktwsY=; b=IyWxWBURU+L3lmO9KtVhwYIiuruSmn9ZlAcdweefmTY5hAECqpXAaF/Q6hROSqENTV rwiFeUc5CbI4nOCvIfKSE1SdCRTqL+TTTM7mnf9axLFoIti2sbuSrlqkxXkIHYOXe09F Po5URQbjzkMHe/gbBrO+p4j+MJqV3szMdw/7uIuFsmP/ZvfIcDnysACiLZkSy1RLIkVn FD9EsqbfamHxVSHAnQFe9NnluhjfSemN68nnDk4HSsiYw9ISIy+6jXCVQEmc1KQCov49 QKdlaU8Jts+5w7P0Bpvn0eqdF9AgaGSrysflrv+tBrQn50EyIR6WKMR4HaJxHU8REJoU 4jHg== 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=2H1F3Ka0Ka6X1YRsJFJYW9O6FRzLC0ev/xiBm/ktwsY=; b=owTC9qSpWm15q6ZpxNK0mzndtkFim/Hzq0QQRjxSSw5eq9nTMiwhRE5ArMsKYHxhmV 2ZJAcm+zGQQcRy3BcMFlUaqLw5eDH1IKbPH1noCgnIyRXH9Pfox1G4R4dXs63rsmbTiD MaVIFgpMjYd/On6e73MfQUPrAiO7O/DTa0DGiOdD/Ao1lBg7P6IhxelX+5V/ljBaJffz QSzmMmqjEqTAmJr9hItx5Uavis31hu0U3JVT6ABwwY/qc+eJevE2oVOBthY4+7CgLUW/ l6ZqBEqLRb0tuRFKdJxXDAOPyMGTmOLQNj1YoCebtnM8XL52IEXLpjScJ69v6qUQMaif KE1g== X-Gm-Message-State: AOAM5305D2zaxz4nr0KA1K0A6p+mHacGZJ3OsOavFH6nV4eDfK3wBVCJ t5JEJunNTN/J3tmBToAClYFAp7Ne99b0ljerjmykHQ== X-Received: by 2002:a05:6808:4b:: with SMTP id v11mr1511116oic.169.1605755958902; Wed, 18 Nov 2020 19:19:18 -0800 (PST) MIME-Version: 1.0 References: <20201117181935.3613581-1-minchan@kernel.org> <20201117181935.3613581-5-minchan@kernel.org> <20201119011431.GA136599@KEI> In-Reply-To: <20201119011431.GA136599@KEI> From: John Stultz Date: Wed, 18 Nov 2020 19:19:07 -0800 Message-ID: Subject: Re: [PATCH 4/4] dma-heap: Devicetree binding for chunk heap To: Hyesoo Yu Cc: Minchan Kim , Andrew Morton , LKML , linux-mm , Matthew Wilcox , david@redhat.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, Suren Baghdasaryan , KyongHo Cho , John Dias , Hridya Valsaraju , Sumit Semwal , Brian Starkey , linux-media , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Rob Herring , Christian Koenig , "moderated 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 Wed, Nov 18, 2020 at 5:22 PM Hyesoo Yu wrote: > > On Tue, Nov 17, 2020 at 07:00:54PM -0800, John Stultz wrote: > > So I suspect Rob will push back on this as he has for other dt > > bindings related to ion/dmabuf heaps (I tried to push a similar > > solution to exporting multiple CMA areas via dmabuf heaps). > > > > The proposal he seemed to like best was having an in-kernel function > > that a driver would call to initialize the heap (associated with the > > CMA region the driver is interested in). Similar to Kunihiko Hayashi's > > patch here: > > - https://lore.kernel.org/lkml/1594948208-4739-1-git-send-email-hayashi.kunihiko@socionext.com/ > > > > The one sticking point for that patch (which I think is a good one), > > is that we don't have any in-tree users, so it couldn't be merged yet. > > > > A similar approach might be good here, but again we probably need to > > have at least one in-tree user which could call such a registration > > function. > > Thanks for your review. > > The chunk heap is not considered for device-specific reserved memory and specific driver. > It is similar to system heap, but it only collects high-order pages by using specific cma-area for performance. So, yes I agree, the chunk heap isn't device specific. It's just that the CMA regions usually are tied to devices. The main objection to this style of solution has been due to the fact that the DTS is supposed to describe the physical hardware (in an OS agnostic way), rather than define configuration info for Linux software drivers. Obviously this can be quibbled about, as the normal way of tying devices to CMA has some assumptions of what the driver will use that region for, rather than somehow representing a physical tie between a memory reservation and a device. Nonetheless, Rob has been hesitant to take any sort of ION/DmaBuf Heap DT devices, and has been more interested in some device having the memory reservation reference and the driver for that doing the registration. > It is strange that there is in-tree user who registers chunk heap. > (Wouldn't it be strange for some users to register the system heap?) Well, as there's no reservation/configuration needed, the system heap can register itself. The CMA heap currently only registers the default CMA heap, as we didn't want to expose all CMA regions and there's otherwise no way to pick and choose. > Is there a reason to use dma-heap framework to add cma-area for specific device ? > > Even if some in-tree users register dma-heap with cma-area, the buffers could be allocated in user-land and these could be shared among other devices. > For exclusive access, I guess, the device don't need to register dma-heap for cma area. > It's not really about exclusive access. More just that if you want to bind a memory reservation/region (cma or otherwise), at least for DTS, it needs to bind with some device in DT. Then the device driver can register that region with a heap driver. This avoids adding new Linux-specific software bindings to DT. It becomes a driver implementation detail instead. The primary user of the heap type would probably be a practical pick (ie the display or isp driver). The other potential solution Rob has suggested is that we create some tag for the memory reservation (ie: like we do with cma: "reusable"), which can be used to register the region to a heap. But this has the problem that each tag has to be well defined and map to a known heap. thanks -john