Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp280837lqn; Fri, 12 Apr 2024 00:47:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwcEFz5klYshifPVwFqvoKSL/rKcencDGldbvWS7qx87vHwOKsGAIII4EHzy4bQb1IpTFo7lUJxpR+6vqpyMrnhGBld0FozFC/kIUxug== X-Google-Smtp-Source: AGHT+IGqwNas6S/fKLXeXlelWjbF06JKsF9X8b5ggYRr2Vft/8yX5Wpl0lc19wTcGj6WUSvxQaa6 X-Received: by 2002:a05:6830:1315:b0:6ea:2f91:ef2d with SMTP id p21-20020a056830131500b006ea2f91ef2dmr1920865otq.4.1712908031086; Fri, 12 Apr 2024 00:47:11 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n24-20020a635c58000000b005d2c05c7039si2712062pgm.865.2024.04.12.00.47.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142174-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=Nu1InJQU; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-142174-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D21002846C5 for ; Fri, 12 Apr 2024 07:46:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8FD94D9F6; Fri, 12 Apr 2024 07:46:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Nu1InJQU" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2082.outbound.protection.outlook.com [40.107.255.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14F1A482DA; Fri, 12 Apr 2024 07:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.82 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712908009; cv=fail; b=uP6WGmM4F/F2+Ct+mSammrugnviCpxERRTd/ctNyl8Gz2ieh2et33pHkQA2HaOII5ERlpLuONCN/Zzq25IfIdMRm4A7BwGUvO1nK379hAfkP9Xp1cedxG4xGVABH+WwVl02FPw2QGFhQBMfrdLxpFiKMRSVuwFMoztfGnBaGU90= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712908009; c=relaxed/simple; bh=rP9Euk6bOP/UPDVyxtzYM1fRs0Z9cTRz1IMA0weBj08=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=lgRl59BMfhrtbFXwYEqEmkan44mI60rW84vy+kHfTPiKn4JUstSOn7m+eeHg+Y67exN/+5yfo4FuocQI5r1pOl7wxkTyBIUZ65tgnKB7lx2m+PTAK7jY0P6au0/JfbEBZjm9i8gotCgH4WhO66v0ldeLjq/eTjyIFiTr0HO4z98= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=Nu1InJQU; arc=fail smtp.client-ip=40.107.255.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X5aJTftaQAf0EHXzRWqvVvNGielvL6/VxC3h435wIfi8ly5QLEFLS2iCqlyDc1zVkGI9skKmvcnT0dI4dEi/qAxX/YMR7c9GuQ3HEbKPlmA2tFr72ANQ86ORrH0PpTuusgzkXD/TsOkm20/RXb2JofLvXkMEimUTS6VIrM/AqIY90qgHo5tbZu871vYg/nvvJTNN6bTFo3o/EGfZBv57XKpmU8RsrQ/gSlmxujaETOW2xoKSE4Ll9zC6ia9aceNsgPgJ6NZdikIF63hipWNkBrilX9apTs79vvVncfsQQYUghQeg74kd89I7jcxfsCujuHRRjMvk9V6QtARqSN1AVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=98hAcsWlgnWXoieoYTjxrfzHS8zziuzSS6p0iwck0OA=; b=bH73xrv3svIkeGcRnJhukgL7F1kgDWdoFKD5ubktasQMPVR60pmhGJ3y+ci165Kr18cVoP4OXLUJ/g3mbdQk/jRcOmcnZZYAx0jkNXI/wNiYiSSM9zArikpvMG/iQvGDpZt69jkm1mph5Vk4mM0dFmkXcpAggeE+X7d07FHR8RNB7k2o7hDpCw1qi5yLQE0b1NK7vF7xwKrM4ziNDPb6SaQFpEH+3LxXlfawYqkoh6rmzrwR1a9leo4NBfFuj8K0YTWik4tYStHM/5NbTauIYE9e5s0zt0Po1P4gHysIe8h60xZkSrbRHbq+2qWXZKNP8MwGRhr92Png/fBfPFj5zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=98hAcsWlgnWXoieoYTjxrfzHS8zziuzSS6p0iwck0OA=; b=Nu1InJQUiytPuKgOqWOk+VJUPK3Z0u3vzIH4qLNCYYdD+bOahHghbpHrNPVD2Z9HQkcuFZsxQGmlFInEkHV6Igpw4+eYlfK55hEJFb++ADIlQmOPrG8qmiY9q4MgVcrPb3sNfVvLzoytVG8WljNb86Wnz8NRnGeRwS2139XUtZY40AOG2NUM4ymk8iJEXh5EMHosE94kygwfwQoQd4ccihets5VgFFGf2TElrDofqut3Xe8E1HPhY9SYpoiNjyNJdU3QntL8ILQPX2xi7FK54Yz2MUE+wh5PkbW2s1IUAIS47Vt29x85iOB8X3Sl5NkiYBRfZZq7Zl2TQr8+TxZKrw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) by TY0PR06MB6840.apcprd06.prod.outlook.com (2603:1096:405:17::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Fri, 12 Apr 2024 07:46:42 +0000 Received: from SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::a60c:298:c201:e4a1]) by SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::a60c:298:c201:e4a1%3]) with mapi id 15.20.7409.053; Fri, 12 Apr 2024 07:46:42 +0000 Message-ID: Date: Fri, 12 Apr 2024 15:46:35 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] dma-buf: add DMA_BUF_IOCTL_SYNC_PARTIAL support Content-Language: en-US To: "T.J. Mercier" Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Rong Qianfeng , Jianqun Xu , sumit.semwal@linaro.org, pekka.paalanen@collabora.com, daniel.vetter@ffwll.ch, jason@jlekstrand.net, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org References: <20211113062222.3743909-1-jay.xu@rock-chips.com> <1da5cdf0-ccb8-3740-cf96-794c4d5b2eb4@amd.com> <3175d41a-fc44-4741-91ac-005c8f21abb8@vivo.com> <9e6f1f52-db49-43bb-a0c2-b0ad12c28aa1@amd.com> <5c7ac24c-79fa-45fc-a4fd-5b8fc77a741b@vivo.com> From: Rong Qianfeng <11065417@vivo.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TYCP301CA0028.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::11) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TY0PR06MB6840:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cb632e2-95db-4684-4d15-08dc5ac4b1c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CXd4KtyUcgSJZ/Dhxv/9JVpSH/2fKL+D7H0Gwsvt9d1wntyrS+8Fx/xNZrvzBZmXPHY2UtvJ7sZBGl+pIdXb0KGpuGMiu2OrhVDShq7E1qsVnKuDxnAhiOc8YeWg7Lj+MpBFrCYhst9ruLvGf+dUXe41dwQK2a8srcfzjaEKtI7brDnEvv5qp4bb1qCRgrBDyX9blNc/BnDvTb5g67fQWf7ftrNVreLPc3D4Up7hBh269BEPk9UkAFw9l6KRp9Lx5rXuJAwqh2mcT/ac6PjS6Csf9t/9Pln+13JzVuG0LElFxBYKJ8ZNP7AMSB/oHkF8EhtaL3ocx426G9FNhfdWU7ljQoVRsLi+e/6zH/+7RTx1cMUHlbSZlh3MfX1RcgVZv2PWl5b1MciZaXcitMFGu9Smj7gFwKTB7nANawf1fKv6zooBIa6PuQIrIzXTDPRpLAG3/KikQHCm1MwZgFPmgVFS8LHA83umKRcQKR3Mi4pjt6GD4xzLoM4nipxIFdrAxoQ7QXL928viWseMROurszdUCu6RAG1Fqnw0wZbubumPxlladn3RsTl0yw2pcotM10F9AYlyi9p9x+DZZEDtDmJa5YpNgCDfC8z0rHeh5PdYlkXDxDmU+Mve5DmPqY5vinCc/eSRwlFcsboFfS17SYQuhye33zblefUZkho2MCpA8vQJemqNqpX/jqj0ifVb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SI2PR06MB5140.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(52116005)(376005)(7416005)(366007)(38350700005)(81742002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Z1lqZk4wQWNZdGFhcjQ1aWc0c3NvampHcDhRK0d2TllKWHdxWW5UWnE3QXY1?= =?utf-8?B?dDZSaml0ZXJqWmJjcVZjbnpPMmpJT1lwQURwclhFR3JqTXdWNnd6VU5aalpr?= =?utf-8?B?TmMzdU9HOXExcWdIU0VXdnhsVlVWU0N5VkZ1YWJpYkw4dEs4OENBMkcrRW9K?= =?utf-8?B?bzFqYk00d2x0UHEzRk9Wd2RvZHY5Wkg2a2g5Rm5rNHRuNFA0K0pib0xnQUtp?= =?utf-8?B?M3M1cnZPMGFpKzhTQi9ROGNWNExvbUhtOUtlYjM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nRCQzU3TENIUHNaaUVqOTc5blBEYlk1OWROcHQwQmsvOHlGZEtRcVhONk55?= =?utf-8?Q?h2WhDB6RH+OBL8oHIH3iKWlv3?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cb632e2-95db-4684-4d15-08dc5ac4b1c0 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2024 07:46:42.4439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y0H7HW3jE0/6ANlv/z9CaTiVzsnA0TjKCpddxVV2EAFLhRat1DZNnHxZo9DvPBKQoQGqdpsJKEFxMOiTzSwrvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB6840 在 2024/4/12 0:52, T.J. Mercier 写道: > On Thu, Apr 11, 2024 at 1:21 AM Rong Qianfeng <11065417@vivo.com> wrote: >> >> 在 2024/4/10 0:37, T.J. Mercier 写道: >>> [You don't often get email from tjmercier@google.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] >>> >>> On Tue, Apr 9, 2024 at 12:34 AM Rong Qianfeng <11065417@vivo.com> wrote: >>>> 在 2024/4/8 15:58, Christian König 写道: >>>>> Am 07.04.24 um 09:50 schrieb Rong Qianfeng: >>>>>> [SNIP] >>>>>>> Am 13.11.21 um 07:22 schrieb Jianqun Xu: >>>>>>>> Add DMA_BUF_IOCTL_SYNC_PARTIAL support for user to sync dma-buf with >>>>>>>> offset and len. >>>>>>> You have not given an use case for this so it is a bit hard to >>>>>>> review. And from the existing use cases I don't see why this should >>>>>>> be necessary. >>>>>>> >>>>>>> Even worse from the existing backend implementation I don't even see >>>>>>> how drivers should be able to fulfill this semantics. >>>>>>> >>>>>>> Please explain further, >>>>>>> Christian. >>>>>> Here is a practical case: >>>>>> The user space can allocate a large chunk of dma-buf for >>>>>> self-management, used as a shared memory pool. >>>>>> Small dma-buf can be allocated from this shared memory pool and >>>>>> released back to it after use, thus improving the speed of dma-buf >>>>>> allocation and release. >>>>>> Additionally, custom functionalities such as memory statistics and >>>>>> boundary checking can be implemented in the user space. >>>>>> Of course, the above-mentioned functionalities require the >>>>>> implementation of a partial cache sync interface. >>>>> Well that is obvious, but where is the code doing that? >>>>> >>>>> You can't send out code without an actual user of it. That will >>>>> obviously be rejected. >>>>> >>>>> Regards, >>>>> Christian. >>>> In fact, we have already used the user-level dma-buf memory pool in the >>>> camera shooting scenario on the phone. >>>> >>>> From the test results, The execution time of the photo shooting >>>> algorithm has been reduced from 3.8s to 3s. >>>> >>> For phones, the (out of tree) Android version of the system heap has a >>> page pool connected to a shrinker. That allows you to skip page >>> allocation without fully pinning the memory like you get when >>> allocating a dma-buf that's way larger than necessary. If it's for a >>> camera maybe you need physically contiguous memory, but it's also >>> possible to set that up. >>> >>> https://android.googlesource.com/kernel/common/+/refs/heads/android14-6.1/drivers/dma-buf/heaps/system_heap.c#377 >>> >> Thank you for the reminder. >> >> The page pool of the system heap can meet the needs of most scenarios, >> but the camera shooting scenario is quite special. >> >> Why the camera shooting scenario needs to have a dma-buf memory pool in >> the user-level? >> >> (1) The memory demand is extremely high and time requirements are >> stringent. > Preallocating for this makes sense to me, whether it is individual > buffers or one large one. > >> (2) The memory in the page pool(system heap) is easily reclaimed or used >> by other apps. > Yeah, by design I guess. I have seen an implementation where the page > pool is proactively refilled after it has been empty for some time > which would help in scenarios where the pool is often reclaimed and > low/empty. You could add that in a vendor heap. Yeah, a similar feature has already been implemented by vendor. > >> (3) High concurrent allocation and release (with deferred-free) lead to >> high memory usage peaks. > Hopefully this is not every frame? I saw enough complaints about the > deferred free of pool pages that it hasn't been carried forward since > Android 13, so this should be less of a problem on recent kernels. > >> Additionally, after the camera exits, the shared memory pool can be >> released, with minimal impact. > Why do you care about the difference here? In one case it's when the > buffer refcount goes to 0 and memory is freed immediately, and in the > other it's the next time reclaim runs the shrinker. I'm sorry, my description wasn't clear enough. What I meant to explain is that the user-level dma-buf memory pool does not use reserved memory (physically contiguous memory), and the memoryoccupation time is not too long, resulting in a minimal impact on the system. > > > I don't want to add UAPI for DMA_BUF_IOCTL_SYNC_PARTIAL to Android > without it being in the upstream kernel. I don't think we can get that > without an in-kernel user of dma_buf_begin_cpu_access_partial first, > even though your use case wouldn't rely on that in-kernel usage. :\ So > if you want to add this to phones for your camera app, then I think > your best option is to add a vendor driver which implements this IOCTL > and calls the dma_buf_begin_cpu_access_partial functions which are > already exported. Ok, thank you very much for your suggestion. I will definitely take it into consideration. > > Best, > T.J.