Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp287955lqb; Tue, 4 Jun 2024 11:17:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXy7POPM0gspRZjfTLo7yAW0G9mpDv+lJWCLKUxxrDKwTqlNAaWxcrINwL6V+7vUsMsnMAomJth+eoVBa5mBf9+clAWbsGUY6ApwqsGEw== X-Google-Smtp-Source: AGHT+IFaMBFxqsMPnvhSnpaUj+v0H5hH5HehhEwh+ks/cu7/nyM70wubiWWxSA6eR0n7LmRIdUhr X-Received: by 2002:a05:6870:891f:b0:24c:afec:eff with SMTP id 586e51a60fabf-25121d41a93mr439608fac.13.1717525031368; Tue, 04 Jun 2024 11:17:11 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-795001b53c6si864215185a.728.2024.06.04.11.17.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 11:17:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oppo.com header.s=selector1 header.b=sEIXPKds; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-201235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oppo.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 179DF1C2201A for ; Tue, 4 Jun 2024 18:17:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E99C14A4EF; Tue, 4 Jun 2024 18:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b="sEIXPKds" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2055.outbound.protection.outlook.com [40.107.255.55]) (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 434925F860; Tue, 4 Jun 2024 18:17:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.55 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717525023; cv=fail; b=YI3opvTsTICpaTUr/b0lqSt1Tq7PMqKyTACVK9qf0jdG22r++NMRRlx2F44ZIorStK53ty30/4KiJiNmVKtt+V6YAR88vlG2IZtdn+TWxfdrYGuNlVLG0wre2ZpP434EnXqCZYyIF/ew9AedMDDeERIUYBmkhTouR+o/XsRDpnI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717525023; c=relaxed/simple; bh=GF2abqMaLnANd9TQIYFWmMLiiIjiCZqZcAK+COXaFB4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=B6xVXfrSaFimIqPcP1G1FczvM6dQoUISNPLkt0zvOyZ6Pj2UXBgiXUzXejHGp42hQIBhY1jCRWkpecDlbqKhmjIYQy3EGeD77PG6S+xy9i3IEZuqbkhesef7cguRNJ4a8PhuiILsfixUrwNCejh+cbP/mq1acmqC2G42CJsZi6A= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com; spf=pass smtp.mailfrom=oppo.com; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b=sEIXPKds; arc=fail smtp.client-ip=40.107.255.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oppo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NHCWFwAk1E6NoA2S0igQJOY1aep8WYsSRvS9CQ+hb8a4X5JSOip0cdHjlj9qmQ2mmmW2eCZr0XXl/iItKM07I3PsDXJpU6MMwXvVYIFemZy3+MGhsJppxiFzkZec6GNO9c0e2QCPTZTGwTnwx3ociorb7WC4vpmukF11V1rsih3mnDWBq48Jl+8SMTSz720AQ3yPzp9fno75kEY6U/3asuev3+0CeW+rvHQRUicRhjwDnZ7BPKE5893+E9MCfy7Vczc5wgOsQcO+59Yrx2QP5NyuXw60ByudT42ozJmc1zpd/CTAF0evU6KFjSVebjLcMvOUHCOErmEXDQZXEjGDVw== 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=cswQKSqfHIlb46vh8M9APYnPW07el9ykaBkEOz3+C0g=; b=Dtl1w2XIcryhRo7jasVjVjZn9gGGbMN+mcWL1pUFjB+Zm9zoF5xtqKGbt0wFsZT6jvahrWBaqSwhd15A5HNAXNz3ye+J7k41qSuIatyD0m+X91HHkykP17GFxL+kGDcS752KYhN1Bg5ewsmEiXxjwQWBZZzD0ErSyAx7iWOxnZahe7DkkEyULVwLtv8a6TGmv2+aUJ7vx9/RYXLznjd07OHNFIM1v6YB2p1wRiOdtNAd9M2bh9cLqWoqoAedoLai6PNqEYJy/J28fKvjXCfZQ6pu6B331Fla2viHQ4RzrTg52E0pT3WvSidD9JvK0tj+CBsNyNGS8xwnHqbC43JpiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 58.252.5.68) smtp.rcpttodomain=google.com smtp.mailfrom=oppo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=oppo.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cswQKSqfHIlb46vh8M9APYnPW07el9ykaBkEOz3+C0g=; b=sEIXPKdsEIzdsvjt0tx5TswDKRPbd/eB0fpNYzD2C1UjCRkdOBMaNwVwmuPVR4R1Ah1BWTW3GsknoJmgq3lH1g/e0tixsyOBODER0OEcN6ruTYBJfHJ8K7SO6AjKjcbYY6+E56RM+uG2PxHhBGpYBdKwFIQGrDy+KNvzQphFpiE= Received: from PSBPR02CA0018.apcprd02.prod.outlook.com (2603:1096:301::28) by SI2PR02MB5860.apcprd02.prod.outlook.com (2603:1096:4:1bf::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.28; Tue, 4 Jun 2024 18:16:58 +0000 Received: from HK3PEPF0000021E.apcprd03.prod.outlook.com (2603:1096:301:0:cafe::bb) by PSBPR02CA0018.outlook.office365.com (2603:1096:301::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31 via Frontend Transport; Tue, 4 Jun 2024 18:16:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 58.252.5.68) smtp.mailfrom=oppo.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=oppo.com; Received-SPF: Pass (protection.outlook.com: domain of oppo.com designates 58.252.5.68 as permitted sender) receiver=protection.outlook.com; client-ip=58.252.5.68; helo=mail.oppo.com; pr=C Received: from mail.oppo.com (58.252.5.68) by HK3PEPF0000021E.mail.protection.outlook.com (10.167.8.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Tue, 4 Jun 2024 18:16:57 +0000 Received: from [127.0.0.1] (172.16.40.118) by mailappw31.adc.com (172.16.56.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 5 Jun 2024 02:16:56 +0800 Message-ID: Date: Wed, 5 Jun 2024 02:16:50 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1] dma-buf: heaps: move the verification of heap_flags to the corresponding heap To: John Stultz CC: Sumit Semwal , Benjamin Gaignard , Brian Starkey , "T.J. Mercier" , =?UTF-8?Q?Christian_K=C3=B6nig?= , <21cnbao@gmail.com>, , , , References: <20240603114008.16235-1-hailong.liu@oppo.com> <20240603172148.gb7txpg2ya43jyxn@oppo.com> Content-Language: en-US From: Hailong Liu In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: mailappw31.adc.com (172.16.56.198) To mailappw31.adc.com (172.16.56.198) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HK3PEPF0000021E:EE_|SI2PR02MB5860:EE_ X-MS-Office365-Filtering-Correlation-Id: a1e685c1-8e15-4058-48ef-08dc84c28535 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|82310400017|1800799015|36860700004|7416005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?OS9vVkdkTGNxN3NyQTdZTjEwaUgvaG15UnBDakFkQlJyNWxBY3V6MDZDLy92?= =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EVuRnVEaFlybUNzd2xvMFlpdTdNSVEwMDNKSE5p?= =?utf-8?Q?4QTemWqBkVqQ2?= X-Forefront-Antispam-Report: CIP:58.252.5.68;CTRY:CN;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.oppo.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(82310400017)(1800799015)(36860700004)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 18:16:57.0963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1e685c1-8e15-4058-48ef-08dc84c28535 X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f1905eb1-c353-41c5-9516-62b4a54b5ee6;Ip=[58.252.5.68];Helo=[mail.oppo.com] X-MS-Exchange-CrossTenant-AuthSource: HK3PEPF0000021E.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR02MB5860 On 6/4/2024 11:33 PM, John Stultz wrote: > On Mon, Jun 3, 2024 at 11:30 PM Hailong Liu wrote: >> On 6/4/2024 2:06 AM, John Stultz wrote: >>> On Mon, Jun 3, 2024 at 10:21 AM Hailong Liu wrote: >>>> We now aim to improve priority dma-buf allocation. Consider android >>>> animations scene: >>>> >>>> when device is in low memory, Allocating dma-buf as animation >>>> buffers enter direct_reclaimation, longer allocation time result in a >>>> laggy UI. But if we know the usage of the dma-buf, we can use some >>>> mechanisms to boost, e.g. animation-memory-pool. >>> >>> Can you generalize this a bit further? When would userland know to use >>> this new flag? >>> If it is aware, would it make sense to just use a separate heap name instead? >>> >>> (Also: These other mechanisms you mention should probably also be >>> submitted upstream, however for upstream there's also the requirement >>> that we have open users and are not just enabling proprietary blob >>> userspace, which makes any changes to dma-buf heaps for out of tree >>> code quite difficult) >>> >>>> However, dma-buf usage identification becomes a challenge. A potential >>>> solution could be heap_flags. the use of heap_flags seems ugly and >>>> contrary to the intended design as you said, How aboult extending >>>> dma_heap_allocation_data as follows? >>>> >>>> struct dma_heap_allocation_data { >>>> __u64 len; >>>> __u32 fd; >>>> __u32 fd_flags; >>>> __u64 heap_flags; >>>> __u64 buf_flags: // buf usage >>>> }; >>> >>> This would affect the ABI (forcing a new ioctl number). And it's >>> unclear what flags you envision as buffer specific (rather than heap >>> specific as this patch suggested). >>> >>> I think we need more details about the specific problem you're seeing >>> and trying to resolve. >> This patch mainly focuses on optimization for Android scenarios. Let’s >> discuss it on the issue website. >> Bug: 344501512 > > Ok, we can do that if you need. > > But if this is ever going to go upstream (and it's more and more > important that we minimize out of tree technical debt), conversations > about how to generalize this will need to happen on the list. > We need a more complete design and test results to convince upstream to accept. Thank you again for your suggestion. Brs, Hailong. > thanks > -john