Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arunpravin Paneer Selvam <arunpravin.paneerselvam@amd.com>
To: Matthew Auld <matthew.auld@intel.com>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: christian.koenig@amd.com, alexander.deucher@amd.com,
	Anand.Raghavendra@amd.com
Subject: Re: [PATCH v6 1/2] gpu/buddy: restore two-pass clear/dirty guard for range-biased allocation
Date: Wed, 4 Nov 2026 12:25:05 +0530	[thread overview]
Message-ID: <c0b4a12a-cef9-4913-87fc-878490c8d582@amd.com> (raw)
In-Reply-To: <428f8c9f-5cf8-46f9-8611-52e6aa71a24b@intel.com>



On 11/3/2026 7:39 PM, Matthew Auld wrote:
> On 03/11/2026 13:23, Arunpravin Paneer Selvam wrote:
>> Hi Matthew,
>>
>> On 10/21/2026 6:19 PM, Matthew Auld wrote:
>>> On 21/10/2026 13:18, Arunpravin Paneer Selvam wrote:
>>>> From: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>>>>
>>>> Range-restricted allocations (the visible-VRAM aperture) skip
>>>> dirty_steer_window() and reach __alloc_range_bias() with no 
>>>> clear/dirty
>>>> eligibility guard, so a dirty allocation freely splits clear 
>>>> extents (and
>>>> vice versa), interleaving the two classes until no large same-class 
>>>> run
>>>> survives and a 4K scanout pin fails with -ENOSPC. Use a two-pass range
>>>> search instead: block_incompatible() rejects opposite-class blocks 
>>>> in the
>>>> strict pass and relaxes only when the strict pass returns -ENOSPC, 
>>>> so a
>>>> request still succeeds when only opposite-class space remains. A KUnit
>>>> regression test covers the interleaving pattern and fails without the
>>>> guard.
>>>>
>>>> v2: the strict pass can split a block and then reject both 
>>>> children, so
>>>>      a split no longer implies a compatible block exists. Sashiko 
>>>> reported
>>>>      the resulting leaked splits; fix as suggested by Matthew:
>>>>   - Push the parent back on the DFS stack after each split and 
>>>> merge it
>>>>     back with unsplit_block() if both children are still free.
>>>>   - Make block_incompatible() judge free blocks only (split nodes 
>>>> keep a
>>>>     stale clear bit) and take the requested order, so mixed blocks 
>>>> that
>>>>     can hold a compatible block are descended instead of skipped.
>>>>   - Extend the KUnit test with a coalesced mixed block and a check 
>>>> that
>>>>     a rejected split is merged back.
>>>>
>>>> Fixes: 1ad5e807f716 ("gpu/buddy: replace dual-tree/force_merge with 
>>>> decoupled dirty tracker")
>>>> Assisted-by: LLM
>>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>>> Cc: Christian König <christian.koenig@amd.com>
>>>> Signed-off-by: Arunpravin Paneer Selvam 
>>>> <Arunpravin.PaneerSelvam@amd.com>
>>>
>>> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>> This version brought back a DAL CI failure. when the range allocator 
>> wanted a clear (or dirty) block, it would split a mixed block to look 
>> for a pure one, throw away the mixed halves, and then use 
>> unsplit_block to join them again.
>> Doing this on every allocation was costly: even though the merge 
>> cascades back up through all levels, repeating this split-and-unsplit 
>> on every allocation added enough overhead on the display hot path 
>> that a large scanout buffer
>> eventually failed with -ENOSPC 
>> (igt@kms_plane@plane-panning-bottom-right on Radeon RX 9070 XT).
>>
>> This change relaxes the rule for range allocations only: we just take 
>> a mixed block as it is (the caller clears it if needed), so the first 
>> pass never splits and never has to undo a split. Large same-class 
>> blocks stay whole,
>> so contiguous space is preserved and fragmentation goes down. The 
>> behaviour is still correct, unsplit_block is no longer needed, and a 
>> KUnit test reproduces the problem (it fails without the fix and 
>> passes with it).
>>
>> Could you please just review v3 of this patch?. It is a bit urgent as 
>> we need it to land the base dirty-tracker patch on our internal branch.
>
> I think sashiko is now complaining about the same thing from before?
Yes - this is the same stranded-split leak Sashiko flagged back before 
and in v4 I have addressed the comment Sashiko raised on v3.

In v3 I dropped  unsplit_block() , assuming "accept a mixed block as-is" 
covered it, but that only handles a mixed block that's already at the 
requested order and fully inside the range. A higher-order mixed block 
straddling the range edge is still split, and when its in-range half is 
the opposite class (the matching half falling out of range) the split is 
left with both children free - that is the leak.

v4 fixes it a different way: instead of splitting that block and then 
cleaning up, the strict pass simply never splits a block that only 
partially overlaps the range — so the stray split is never created in 
the first place. The fallback pass still handles that block and actually 
consumes the child it splits down to, so nothing is left stranded.  
unsplit_block()  stays unnecessary, and the leak can't occur.

Regards,
Arun.

>
>>
>> Thanks,
>> Arun.
>>>
>>> Are you just going to push this one by itself?
>>
>


  reply	other threads:[~2026-11-04  6:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 12:18 [PATCH v6 1/2] gpu/buddy: restore two-pass clear/dirty guard for range-biased allocation Arunpravin Paneer Selvam
2026-10-21 12:18 ` [PATCH v6 2/2] gpu/buddy: add range-restricted contiguous allocation fallback Arunpravin Paneer Selvam
2026-10-21 12:46   ` sashiko-bot
2026-10-21 12:49 ` [PATCH v6 1/2] gpu/buddy: restore two-pass clear/dirty guard for range-biased allocation Matthew Auld
2026-10-21 13:45   ` Arunpravin Paneer Selvam
2026-11-03 13:23   ` Arunpravin Paneer Selvam
2026-11-03 14:09     ` Matthew Auld
2026-11-04  6:55       ` Arunpravin Paneer Selvam [this message]
2026-10-21 13:26 ` ✗ i915.CI.BAT: failure for series starting with [v6,1/2] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0b4a12a-cef9-4913-87fc-878490c8d582@amd.com \
    --to=arunpravin.paneerselvam@amd.com \
    --cc=Anand.Raghavendra@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox