]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/tests/drm_buddy: Add tests for allocations exceeding max_order
authorSanjay Yadav <sanjay.kumar.yadav@intel.com>
Thu, 8 Jan 2026 11:32:30 +0000 (17:02 +0530)
committerArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Wed, 21 Jan 2026 05:36:05 +0000 (11:06 +0530)
commitdc0e3aa54eaa4fc6efa1cf4467a487ea52b94f01
treebf27a623ad6621594d60fcc8e91742fd3ba75d90
parent5488a29596cdba93a60a79398dc9b69d5bdadf92
drm/tests/drm_buddy: Add tests for allocations exceeding max_order

Add kunit tests that exercise edge cases where allocation requests
exceed mm->max_order after rounding. This can happen with
non-power-of-two VRAM sizes when the allocator rounds up requests.

For example, with 10G VRAM (8G + 2G roots), mm->max_order represents
the 8G block. A 9G allocation can round up to 16G in multiple ways:
CONTIGUOUS allocation rounds to next power-of-two, or non-CONTIGUOUS
with 8G min_block_size rounds to next alignment boundary.

The test validates CONTIGUOUS and RANGE flag combinations, ensuring that
only CONTIGUOUS-alone allocations use try_harder fallback, while other
combinations return -EINVAL when rounded size exceeds memory, preventing
BUG_ON assertions.

Cc: Christian König <christian.koenig@amd.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Suggested-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patch.msgid.link/20260108113227.2101872-6-sanjay.kumar.yadav@intel.com
drivers/gpu/drm/tests/drm_buddy_test.c