From: sashiko-bot@kernel.org
To: "Arunpravin Paneer Selvam" <arunpravin.paneerselvam@amd.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 2/2] gpu/buddy: search lower orders in contiguous try-harder fallback
Date: Tue, 06 Oct 2026 07:35:31 +0000 [thread overview]
Message-ID: <20261006073532.2F05E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261006072643.211568-2-arunpravin.paneerselvam@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] gpu/buddy: exhaustive anchor search in __alloc_contig_try_harder causes spinlock lockup
--
commit 7497fb4969675f5a56fcaeefb846b3d3c4a2cff7
Author: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
gpu/buddy: search lower orders in contiguous try-harder fallback
This commit modifies __alloc_contig_try_harder() to descend from the size
order down to min_order. This allows the allocator to build a span from
adjacent lower-order blocks when a single buddy order is empty.
> diff --git a/drivers/gpu/buddy.c b/drivers/gpu/buddy.c
> index d8e7b79907157..239249362c9ea 100644
> --- a/drivers/gpu/buddy.c
> +++ b/drivers/gpu/buddy.c
[ ... ]
> @@ -1775,6 +1776,12 @@ static int __alloc_contig_try_harder(struct gpu_buddy *mm,
> iter = rb_prev(iter);
> }
>
> +next_order:
> + if (order > min_order) {
> + order--;
> + goto retry_order;
> + }
> +
[Severity: High]
Could this exhaustive anchor search cause a spinlock lockup?
By descending down to min_order (which can be 0), a large contiguous
allocation request under fragmented memory might test up to millions of
order-0 blocks. Because this fallback iterates over all free blocks of a
given order while holding the allocator spinlock, could executing this
many rbtree operations and function calls lead to latency spikes or
watchdog soft lockups?
If untrusted userspace graphics APIs create fragmented VRAM and then
request large contiguous buffer objects (e.g., via
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS), it appears this path could be
triggered, potentially causing a denial of service. Checking many smaller
anchors instead of only checking anchors sized for the allocation request
increases the worst-case iterations by orders of magnitude.
> return -ENOSPC;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006072643.211568-1-arunpravin.paneerselvam@amd.com?part=2
next prev parent reply other threads:[~2026-10-06 7:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 7:26 [PATCH v3 1/2] gpu/buddy: add range-restricted contiguous allocation fallback Arunpravin Paneer Selvam
2026-10-06 7:26 ` [PATCH v3 2/2] gpu/buddy: search lower orders in contiguous try-harder fallback Arunpravin Paneer Selvam
2026-10-06 7:35 ` sashiko-bot [this message]
2026-10-06 7:35 ` ✓ CI.KUnit: success for series starting with [v3,1/2] gpu/buddy: add range-restricted contiguous allocation fallback Patchwork
2026-10-06 7:41 ` [PATCH v3 1/2] " sashiko-bot
2026-10-06 8:19 ` ✓ Xe.CI.BAT: success for series starting with [v3,1/2] " Patchwork
2026-10-06 15:42 ` ✗ Xe.CI.FULL: failure " 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=20261006073532.2F05E1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arunpravin.paneerselvam@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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