From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8251AEB48EB for ; Thu, 12 Feb 2026 09:23:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE67110E706; Thu, 12 Feb 2026 09:23:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cWgEYN9f"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C64F10E706; Thu, 12 Feb 2026 09:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770888235; x=1802424235; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=+yK4yRq2GNHW6+DBYnVEwRDEiE6JOdGmAix1PVarKiw=; b=cWgEYN9f0W9s0HM2I6QYDtcTEsQjf9jkPUnJzRolYNvKxVcp3XDODBDo UW0xJyvCEuOVm8zwfMMNPcfobr1QWRXzY3w7cK4JfAvLBZNjd381OAeC0 NAL+u7K/yI5hChZD1HYnFwYjnuiK9LYH3h7L5vkKvB66q5+XDrjJ7Js/F ATxmxKueCUmEM1mCcV8N0U6N2SfImdNN0ilk+Hof+bXtyDXKC7kcEPAhZ vWoNR3mtP4JPXXsXRK2UgasvKCHF+PtxDBplPf97KUe8dZFr3w4wFDEtq SwPJd6bnuyrJ3O1+ysStawwFVRVMDxtwYx9sEs/3t5WaUu85CLN5XQ7Nf g==; X-CSE-ConnectionGUID: eeHmAHQDRGim1tSLN0TSrw== X-CSE-MsgGUID: W1X14yHSTJe8PV9U+U/aQw== X-IronPort-AV: E=McAfee;i="6800,10657,11698"; a="59627201" X-IronPort-AV: E=Sophos;i="6.21,286,1763452800"; d="scan'208";a="59627201" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2026 01:23:54 -0800 X-CSE-ConnectionGUID: dRpSHeCZTDuNAVbn63S0wA== X-CSE-MsgGUID: T5VUpgJ8Q9uBb/BmZ2Swig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,286,1763452800"; d="scan'208";a="242157984" Received: from orsmsx902.amr.corp.intel.com ([10.22.229.24]) by fmviesa001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2026 01:23:55 -0800 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) by ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.35; Thu, 12 Feb 2026 01:23:54 -0800 Received: from ORSEDG901.ED.cps.intel.com (10.7.248.11) by ORSMSX903.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.35 via Frontend Transport; Thu, 12 Feb 2026 01:23:54 -0800 Received: from SA9PR02CU001.outbound.protection.outlook.com (40.93.196.32) by edgegateway.intel.com (134.134.137.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.35; Thu, 12 Feb 2026 01:23:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YZZ7rAJW0Ew6bTd18BGWVo/2W4AVVo/DfmGPDkr6YcfjDr8kpwtmc0OrKGDkaB+rh8fpy/yN9krIpRpgPrekruHyN8TDaSTOpkM5gZpq6jz1NSVkcolOSH30VFTSWX8pw2UOzLnLJ4r44vfh23iJqPZ6ExnkUvZigI4Gm4EE3PgkAK3X8hyRPHcgzGlURjtKUOzVSS0V2qL6kCUVFW8AYyLxoq17/O7x/eT5nM7sWmK0VZXncc6sbQ1/rhvRxZ7iICR24QPjTyBJjPAsBIznBVeeQ7TPzNfxmqdlplFKBiNzGskLCRZQqfmf88iC+9r1nvFMdmkHjguk2YX+llWl7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=YNi2Av+OzuvvFL0m/hWEe2m7gIqua1JQHK5/T0Tlpa4=; b=tZZ8vC6798BPQKRxXaG1YTrYmkHRWp+mpWqkRtyrJSrEx+L270oonSZ49PwdE1iXsgZeW0Woic9hz51DCnDoleukILaE61hgPBhHiiC4FbnOmcsRq+fQacry73WUQ1gfEPcaKAtuNPS2nOFrMd9hG3Pj2DIe+x4cTFGDjXHxLn3DYp1RSOUVtac9gJh3R6ywfdQ4RvN/KAdA+W0/KJxWhoS/5EMvEhSTJLOgegxQSWJPPoHxGss4RfLcSg+QdI/rYiUSkmRHw60DoWOpYwWWQ9CCMjOe34vVUV3+zyrXWVBu3SMN6ZzlrpHtnQF7zeTrqtLISWQX37s36d7o6fiaLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB8208.namprd11.prod.outlook.com (2603:10b6:8:165::18) by BL1PR11MB5255.namprd11.prod.outlook.com (2603:10b6:208:31a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9611.10; Thu, 12 Feb 2026 09:23:51 +0000 Received: from DS0PR11MB8208.namprd11.prod.outlook.com ([fe80::ecb0:7475:84de:ca9c]) by DS0PR11MB8208.namprd11.prod.outlook.com ([fe80::ecb0:7475:84de:ca9c%5]) with mapi id 15.20.9611.008; Thu, 12 Feb 2026 09:23:51 +0000 Message-ID: <23ec6981-3602-49b4-a077-107daba9caa4@intel.com> Date: Thu, 12 Feb 2026 14:53:43 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] drm/buddy: Add kernel-doc for allocator structures and flags To: Arunpravin Paneer Selvam , CC: , =?UTF-8?Q?Christian_K=C3=B6nig?= , Matthew Auld References: <20260211053123.260037-4-sanjay.kumar.yadav@intel.com> <20260211053123.260037-5-sanjay.kumar.yadav@intel.com> <3a205ac1-5917-4e24-b6e6-f8989678a54d@amd.com> Content-Language: en-US From: "Yadav, Sanjay Kumar" In-Reply-To: <3a205ac1-5917-4e24-b6e6-f8989678a54d@amd.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MA5PR01CA0167.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:1cf::8) To DS0PR11MB8208.namprd11.prod.outlook.com (2603:10b6:8:165::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8208:EE_|BL1PR11MB5255:EE_ X-MS-Office365-Filtering-Correlation-Id: 20b0da2c-6025-4acf-1d8e-08de6a186ef1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?NGRNbllYTGt2YmE0M29vZ0pnV1M1QVhkZUF2YUdvV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FaMDdiT2pQVUpzUmJBMUlhblFSa2tUWXdhbWY1dW1SbGYyTWpjMUFB?= =?utf-8?B?alVtSHh0c1lZcW5GbXd2NkZFbGRjYnNvN05RK294b2hiUFNrWWFrS2VTQkRw?= =?utf-8?B?Q0hlS1VYSmZ4eTZuNGdHNWgvK0x0VTFUNHZNazE4TUM4K0hYZzZxdjZlLy9Z?= =?utf-8?B?dVlPOG5HSmVURnUvOXFweGZ1bDJVelBtNW13TjZNeGk2dXpESlNvb0JYNkhJ?= =?utf-8?B?d2V2endqamxLdnBmdllZSFhwMzllTXFyeVlYaGNhRnd5emhwTUJGS25qUGR6?= =?utf-8?Q?GU1Y=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB8208.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L2N2MnBXNFNOdmRLc1dXTFVvenV4b0ppeFpEc2o3amkzRVhDTW1qYlZPZlpj?= =?utf-8?B?Ykw0cFhITFBpU3NrWG8ydk1KdXVOaHdxb1V5czJ0YnJ0bHUrcVN5RlhvUm9w?= =?utf-8?B?U0t3em01aGNDS0xMbVlWTjBuNllCTHd3THg2L3g5V2x4WlpDcllMQjhpQXVj?= =?utf-8?B?Vkk3QXNySHU0SUNXZTdGaGlDbXg1L1EzQUwwWUdWSjB6bG5yQWxkdnBqbzNk?= =?utf-8?B?d1FHZmthQ1ZNZTFNY0NEekI1ZWZRYm4vUVZsSWczODBSRjBXZDdTSWtucmFF?= =?utf-8?B?eHdvanQwTjd1SzB4bTEyRU93OWlvTUc3WWNtbDkvTWN2dzNQeURnRnNEclBG?= =?utf-8?B?SG0rdE92Ky9BKzU5YTVCVnJ4QUUyS3c1RWNTZlByekdVTVhO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G91OGRXZ0ZqSFc4WDVTQ25FaVd1QUkzWklCUzRQWHNIVTAz?= =?utf-8?B?Y3VpOTdtbjJBTXNuRStUajhyaGdnd2dNS0ZuemFHR0s1NTJ5ZlR6QVJvTk9q?= =?utf-8?B?NFJka0NWRFVrdythYUp3QlplQzU2amdtVEJXUERqa2Vja3dDbWFLUFVrQUZF?= =?utf-8?Q?GI0rC96lWcL0FAD4=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 20b0da2c-6025-4acf-1d8e-08de6a186ef1 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8208.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2026 09:23:50.9684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wMUteBP9XbOlMuaRWCmB7Zx/OQyBIYrhvNQ5FYVONWLp8DOacTPtjRUT1wtiFIgFTTjSvUyFcX5nZbDHD0mdnjYiEcEPoQd/u7lkapU9nBM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5255 X-OriginatorOrg: intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 12-02-2026 13:10, Arunpravin Paneer Selvam wrote: > > > On 2/12/2026 1:08 PM, Arunpravin Paneer Selvam wrote: >> >> >> On 2/11/2026 11:01 AM, Sanjay Yadav wrote: >>> Add missing kernel-doc for GPU buddy allocator flags, >>> gpu_buddy_block, and gpu_buddy. The documentation covers block >>> header fields, allocator roots, free trees, and allocation flags >>> such as RANGE, TOPDOWN, CONTIGUOUS, CLEAR, and TRIM_DISABLE. >>> Private members are marked with kernel-doc private markers >>> and documented with regular comments. >>> >>> No functional changes. >>> >>> v2: >>> - Corrected GPU_BUDDY_CLEAR_TREE and GPU_BUDDY_DIRTY_TREE index >>> values (Arun) >>> - Rebased after DRM buddy allocator moved to drivers/gpu/ >>> - Updated commit message >>> >>> Cc: Christian König >>> Cc: Arunpravin Paneer Selvam >>> Suggested-by: Matthew Auld >>> Signed-off-by: Sanjay Yadav >>> --- >>>   include/linux/gpu_buddy.h | 122 >>> +++++++++++++++++++++++++++++++------- >>>   1 file changed, 102 insertions(+), 20 deletions(-) >>> >>> diff --git a/include/linux/gpu_buddy.h b/include/linux/gpu_buddy.h >>> index 07ac65db6d2e..b06241c78437 100644 >>> --- a/include/linux/gpu_buddy.h >>> +++ b/include/linux/gpu_buddy.h >>> @@ -12,11 +12,58 @@ >>>   #include >>>   #include >>>   +/** >>> + * GPU_BUDDY_RANGE_ALLOCATION - Allocate within a specific address >>> range >>> + * >>> + * When set, allocation is restricted to the range [start, end) >>> specified >>> + * in gpu_buddy_alloc_blocks(). Without this flag, start/end are >>> ignored >>> + * and allocation can use any free space. >>> + */ >>>   #define GPU_BUDDY_RANGE_ALLOCATION        BIT(0) >>> + >>> +/** >>> + * GPU_BUDDY_TOPDOWN_ALLOCATION - Allocate from top of address space >>> + * >>> + * Allocate starting from high addresses and working down. Useful for >>> + * separating different allocation types (e.g., kernel vs userspace) >>> + * to reduce fragmentation. >>> + */ >>>   #define GPU_BUDDY_TOPDOWN_ALLOCATION        BIT(1) >>> + >>> +/** >>> + * GPU_BUDDY_CONTIGUOUS_ALLOCATION - Require physically contiguous >>> blocks >>> + * >>> + * The allocation must be satisfied with a single contiguous block. >>> + * If the requested size cannot be allocated contiguously, the >>> + * allocation fails with -ENOSPC. >>> + */ >>>   #define GPU_BUDDY_CONTIGUOUS_ALLOCATION        BIT(2) >>> + >>> +/** >>> + * GPU_BUDDY_CLEAR_ALLOCATION - Prefer pre-cleared (zeroed) memory >>> + * >>> + * Attempt to allocate from the clear tree first. If insufficient >>> clear >>> + * memory is available, falls back to dirty memory. Useful when the >>> + * caller needs zeroed memory and wants to avoid GPU clear operations. >>> + */ >>>   #define GPU_BUDDY_CLEAR_ALLOCATION        BIT(3) >>> + >>> +/** >>> + * GPU_BUDDY_CLEARED - Mark returned blocks as cleared >>> + * >>> + * Used with gpu_buddy_free_list() to indicate that the memory being >>> + * freed has been cleared (zeroed). The blocks will be placed in the >>> + * clear tree for future GPU_BUDDY_CLEAR_ALLOCATION requests. >>> + */ >>>   #define GPU_BUDDY_CLEARED            BIT(4) >>> + >>> +/** >>> + * GPU_BUDDY_TRIM_DISABLE - Disable automatic block trimming >>> + * >>> + * By default, if an allocation is smaller than the allocated block, >>> + * excess memory is trimmed and returned to the free pool. This flag >>> + * disables trimming, keeping the full power-of-two block size. >>> + */ >>>   #define GPU_BUDDY_TRIM_DISABLE            BIT(5) >>>     enum gpu_buddy_free_tree { >>> @@ -28,7 +75,27 @@ enum gpu_buddy_free_tree { >>>   #define for_each_free_tree(tree) \ >>>       for ((tree) = 0; (tree) < GPU_BUDDY_MAX_FREE_TREES; (tree)++) >>>   +/** >>> + * struct gpu_buddy_block - Block within a buddy allocator >>> + * >>> + * Each block in the buddy allocator is represented by this structure. >>> + * Blocks are organized in a binary tree where each parent block >>> can be >>> + * split into two children (left and right buddies). The allocator >>> manages >>> + * blocks at various orders (power-of-2 sizes) from chunk_size up >>> to the >>> + * largest contiguous region. >>> + * >>> + * @private: Private data owned by the allocator user (e.g., >>> driver-specific data) >>> + * @link: List node for user ownership while block is allocated >>> + */ >>>   struct gpu_buddy_block { >>> +/* private: */ >>> +    /* >>> +     * Header bit layout: >>> +     * - Bits 63:12: block offset within the address space >>> +     * - Bits 11:10: state (ALLOCATED, FREE, or SPLIT) >>> +     * - Bit 9: clear bit (1 if memory is zeroed) >> I think we should add >> - Bits 8:9: reserved > it should be -Bits 8:6: reserved >> >> Apart from that, looks good to me. >> Reviewed-by: Arunpravin Paneer Selvam Thanks Arun for your prompt review, helpful comments, and your time. >>> +     * - Bits 5:0: order (log2 of size relative to chunk_size) >>> +     */ >>>   #define GPU_BUDDY_HEADER_OFFSET GENMASK_ULL(63, 12) >>>   #define GPU_BUDDY_HEADER_STATE  GENMASK_ULL(11, 10) >>>   #define   GPU_BUDDY_ALLOCATED       (1 << 10) >>> @@ -43,7 +110,7 @@ struct gpu_buddy_block { >>>       struct gpu_buddy_block *left; >>>       struct gpu_buddy_block *right; >>>       struct gpu_buddy_block *parent; >>> - >>> +/* public: */ >>>       void *private; /* owned by creator */ >>>         /* >>> @@ -53,43 +120,58 @@ struct gpu_buddy_block { >>>        * gpu_buddy_free* ownership is given back to the mm. >>>        */ >>>       union { >>> +/* private: */ >>>           struct rb_node rb; >>> +/* public: */ >>>           struct list_head link; >>>       }; >>> - >>> +/* private: */ >>>       struct list_head tmp_link; >>>   }; >>>     /* Order-zero must be at least SZ_4K */ >>>   #define GPU_BUDDY_MAX_ORDER (63 - 12) >>>   -/* >>> - * Binary Buddy System. >>> +/** >>> + * struct gpu_buddy - GPU binary buddy allocator >>> + * >>> + * The buddy allocator provides efficient power-of-two memory >>> allocation >>> + * with fast allocation and free operations. It is commonly used >>> for GPU >>> + * memory management where allocations can be split into power-of-two >>> + * block sizes. >>>    * >>> - * Locking should be handled by the user, a simple mutex around >>> - * gpu_buddy_alloc* and gpu_buddy_free* should suffice. >>> + * Locking should be handled by the user; a simple mutex around >>> + * gpu_buddy_alloc_blocks() and >>> gpu_buddy_free_block()/gpu_buddy_free_list() >>> + * should suffice. >>> + * >>> + * @n_roots: Number of root blocks in the roots array. >>> + * @max_order: Maximum block order (log2 of largest block size / >>> chunk_size). >>> + * @chunk_size: Minimum allocation granularity in bytes. Must be at >>> least SZ_4K. >>> + * @size: Total size of the address space managed by this allocator >>> in bytes. >>> + * @avail: Total free space currently available for allocation in >>> bytes. >>> + * @clear_avail: Free space available in the clear tree (zeroed >>> memory) in bytes. >>> + *               This is a subset of @avail. >>>    */ >>>   struct gpu_buddy { >>> -    /* Maintain a free list for each order. */ >>> -    struct rb_root **free_trees; >>> - >>> +/* private: */ >>>       /* >>> -     * Maintain explicit binary tree(s) to track the allocation of the >>> -     * address space. This gives us a simple way of finding a buddy >>> block >>> -     * and performing the potentially recursive merge step when >>> freeing a >>> -     * block.  Nodes are either allocated or free, in which case >>> they will >>> -     * also exist on the respective free list. >>> +     * Array of red-black trees for free block management. >>> +     * Indexed as free_trees[clear/dirty][order] where: >>> +     * - Index 0 (GPU_BUDDY_CLEAR_TREE): blocks with zeroed content >>> +     * - Index 1 (GPU_BUDDY_DIRTY_TREE): blocks with unknown content >>> +     * Each tree holds free blocks of the corresponding order. >>>        */ >>> -    struct gpu_buddy_block **roots; >>> - >>> +    struct rb_root **free_trees; >>>       /* >>> -     * Anything from here is public, and remains static for the >>> lifetime of >>> -     * the mm. Everything above is considered do-not-touch. >>> +     * Array of root blocks representing the top-level blocks of the >>> +     * binary tree(s). Multiple roots exist when the total size is not >>> +     * a power of two, with each root being the largest power-of-two >>> +     * that fits in the remaining space. >>>        */ >>> +    struct gpu_buddy_block **roots; >>> +/* public: */ >>>       unsigned int n_roots; >>>       unsigned int max_order; >>> - >>> -    /* Must be at least SZ_4K */ >>>       u64 chunk_size; >>>       u64 size; >>>       u64 avail; >> >