Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2436528rdb; Tue, 12 Sep 2023 01:32:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPpftrgk/VehbwY6dWmJIrBrLtGECWDL/gqQl5DMg7hyD8R0/TlAJzGvuceVGqIi11qnmI X-Received: by 2002:a05:6808:188c:b0:3a8:791d:9ce5 with SMTP id bi12-20020a056808188c00b003a8791d9ce5mr14835725oib.19.1694507540006; Tue, 12 Sep 2023 01:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694507539; cv=none; d=google.com; s=arc-20160816; b=j/cctx1PxDFLvSB44dXS6VYXcK04BpV8MfelFG7DkLGsOKJQzINfX3D65X/dfySfIc oVKDY4f5/BAAW6kPAiLKA3f4pgoojDHuC5h2k0Xh+M9uBh+OqGrKgZkM4xfxEfygx96u HbvJAfTBH/E8v39O0ju30CelpSeOXtLRArMtIXHh7pL5Pr4q5iP/4yZpOGBLVsZLFgqI dnF1jItaJjRDEOHP3Pp/gyGD2YXXmPyrPyfDOMsUzhime+Qbw9n7GY3Yz0J2suu149Ki aN5EXF93//HnF9zhvx0GMMdmIT1IvSOuWS4PLFe8yjVSbbU1eeiqWqmVMRLoLv7q6O4A nLYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=CMy6jSxlLVQzjvcfRtLq3NXvZdu60RtRCF9sxWo1nvI=; fh=nLY4z/xaZCBhnRKUZUd6k7ssN3PfCJEql5b6tmv+JkM=; b=Kuxhmphj5V0EHNaN8GTD1b6I2vQ2ZF9kE/GNdwjUnQBwyzIgB9sW+6StA0UGVuAySR n7wdRZlZmOnN9Fu7dHw8eZEH5G08DfkaIvpMg84TRBIRLD+c5YoB1dXol4EXcADxv4Fi H2Zsce5ndGYDwIwD8sVn8hfx4nkmuQB4Vi3zG2vWk1xcQDkwG7KRtLwMr0H8M+uRS+MA jz738LIuQUz8YlGYdtw8dV0eWtu9mr9iyRii4PLoab7SaxGicJdmmBTL1Q7P5EZjyMNA EpW6w0IpRP8ZJRfnoDwbS2V2upePRvpZJZznEhdR4ea+aU/ltSjdHwxp6Ae/fgqQ01Zq sHeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qu8X3W77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k186-20020a6384c3000000b005578c6a7672si7684569pgd.90.2023.09.12.01.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 01:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qu8X3W77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8D23B814C6B7; Tue, 12 Sep 2023 00:06:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231384AbjILHG3 (ORCPT + 99 others); Tue, 12 Sep 2023 03:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbjILHGV (ORCPT ); Tue, 12 Sep 2023 03:06:21 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 738B4E78; Tue, 12 Sep 2023 00:06:17 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-52e5900cf77so6718441a12.2; Tue, 12 Sep 2023 00:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694502376; x=1695107176; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=CMy6jSxlLVQzjvcfRtLq3NXvZdu60RtRCF9sxWo1nvI=; b=qu8X3W77nsScShedTZusX8trRA3CnpfiKuCZuHnxxWufwiVeNClOfzqICjNzo0fPWB lotDfW3w8GruAjlxTLIP04sCBlhPY4RrQ9bU84n5UMrlbMuPcz9vyDmEQtaXx2sVOCYF cMuvWcC5Sfl24sUiGAC+aCEsHvaR6k4BFhvlaEwMnxobkxcKTK/4srD3KKGL0rjKoN1Q 521lWiLBytGGaAi7X21Cy/WKX01d7tBnBZyvVRA+8Sy4+F0CNksU5g5S7vaCrFBUiQSc 5rnzy+/nt+SOyqtxtUg8VHOBrrAqljKT46wvxo9+yJYU40XUV9tSataXNO8BdHTp4f5Q TXsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694502376; x=1695107176; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CMy6jSxlLVQzjvcfRtLq3NXvZdu60RtRCF9sxWo1nvI=; b=fO7AYh2AZgGhuVstmzAABNkYGOkFYhZ72vWw/pRYvVCuteT+jV5HjIjze3WGfwj2FR fRn+4/Tc1MWJoRoaQXFd6lOVCwEWxql3bBibZz0UHTkZuOTt5ESKCYtEMkqxBMeYf6L8 jtlkG4LqrYHmlDV36uAWXNuKg3DJ8sXdW/WxNrMDLCwGJMbnf8jLdzqT/jb/lg8tQ0NL Pgp64dc3pdh4NNMrk8eQzDbrYbZ9BdlAhmDXZIDGjyFd+OqnGtQXYHnzs5PjT67ixVhD 8Pa4glCEGgG+wCbJTDLiHB5QDnhZy92IF6kJKlj3JIJsheY5sLEWevNU3wvfRNJ4IelO YG5Q== X-Gm-Message-State: AOJu0YwSV76pLyGmhkWJU57N8ESkA0GGiXxlwYF15yJuawDiWzKnS+Bn 2Ay1vx4RKjtgfSGvoGlwF1M= X-Received: by 2002:a17:906:8b:b0:9a1:d7cd:6040 with SMTP id 11-20020a170906008b00b009a1d7cd6040mr9828714ejc.37.1694502375674; Tue, 12 Sep 2023 00:06:15 -0700 (PDT) Received: from [192.168.178.25] ([185.254.126.42]) by smtp.gmail.com with ESMTPSA id p21-20020a170906b21500b0099b6becb107sm6415474ejz.95.2023.09.12.00.06.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Sep 2023 00:06:15 -0700 (PDT) Message-ID: <23e71d1f-08c1-3834-5b1f-2b5714c7bfaa@gmail.com> Date: Tue, 12 Sep 2023 09:06:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH 3/9] dma-heap: Provide accessors so that in-kernel drivers can allocate dmabufs from specific heaps Content-Language: en-US To: John Stultz Cc: Yong Wu , Rob Herring , Sumit Semwal , Matthias Brugger , Krzysztof Kozlowski , Conor Dooley , Benjamin Gaignard , Brian Starkey , tjmercier@google.com, AngeloGioacchino Del Regno , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, jianjiao.zeng@mediatek.com, kuohong.wang@mediatek.com References: <20230911023038.30649-1-yong.wu@mediatek.com> <20230911023038.30649-4-yong.wu@mediatek.com> <803846bc-fd1d-d2ec-2855-456af22c82f8@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Sep 2023 00:06:34 -0700 (PDT) X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Am 11.09.23 um 20:29 schrieb John Stultz: > On Mon, Sep 11, 2023 at 3:14 AM Christian König > wrote: >> Am 11.09.23 um 04:30 schrieb Yong Wu: >>> From: John Stultz >>> >>> This allows drivers who don't want to create their own >>> DMA-BUF exporter to be able to allocate DMA-BUFs directly >>> from existing DMA-BUF Heaps. >>> >>> There is some concern that the premise of DMA-BUF heaps is >>> that userland knows better about what type of heap memory >>> is needed for a pipeline, so it would likely be best for >>> drivers to import and fill DMA-BUFs allocated by userland >>> instead of allocating one themselves, but this is still >>> up for debate. >> The main design goal of having DMA-heaps in the first place is to avoid >> per driver allocation and this is not necessary because userland know >> better what type of memory it wants. >> >> The background is rather that we generally want to decouple allocation >> from having a device driver connection so that we have better chance >> that multiple devices can work with the same memory. > Yep, very much agreed, and this is what the comment above is trying to describe. > > Ideally user-allocated buffers would be used to ensure driver's don't > create buffers with constraints that limit which devices the buffers > might later be shared with. > > However, this patch was created as a hold-over from the old ION logic > to help vendors transition to dmabuf heaps, as vendors had situations > where they still wanted to export dmabufs that were not to be > generally shared and folks wanted to avoid duplication of logic > already in existing heaps. At the time, I never pushed it upstream as > there were no upstream users. But I think if there is now a potential > upstream user, it's worth having the discussion to better understand > the need. Yeah, that indeed makes much more sense. When existing drivers want to avoid their own handling and move their memory management over to using DMA-heaps even for internal allocations then no objections from my side. That is certainly something we should aim for if possible. But what we should try to avoid is that newly merged drivers provide both a driver specific UAPI and DMA-heaps. The justification that this makes it easier to transit userspace to the new UAPI doesn't really count. That would be adding UAPI already with a plan to deprecate it and that is most likely not helpful considering that UAPI must be supported forever as soon as it is upstream. > So I think this patch is a little confusing in this series, as I don't > see much of it actually being used here (though forgive me if I'm > missing it). > > Instead, It seems it get used in a separate patch series here: > https://lore.kernel.org/all/20230911125936.10648-1-yunfei.dong@mediatek.com/ Please try to avoid stuff like that it is really confusing and eats reviewers time. Regards, Christian. > > Yong, I appreciate you sending this out! But maybe if the secure heap > submission doesn't depend on this functionality, I might suggest > moving this patch (or at least the majority of it) to be part of the > vcodec series instead? That way reviewers will have more context for > how the code being added is used? > > thanks > -john