From: Arunpravin Paneer Selvam <arunpravin.paneerselvam@amd.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org,
"Christian König" <christian.koenig@amd.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 2/6] drm/buddy: fix range bias
Date: Fri, 16 Feb 2024 17:10:51 +0530 [thread overview]
Message-ID: <119438d7-b2c8-d696-4249-a2e14bac88a0@amd.com> (raw)
In-Reply-To: <20240215174431.285069-8-matthew.auld@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]
Looks good.
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
On 2/15/2024 11:14 PM, Matthew Auld wrote:
> There is a corner case here where start/end is after/before the block
> range we are currently checking. If so we need to be sure that splitting
> the block will eventually give use the block size we need. To do that we
> should adjust the block range to account for the start/end, and only
> continue with the split if the size/alignment will fit the requested
> size. Not doing so can result in leaving split blocks unmerged when it
> eventually fails.
>
> Fixes: afea229fe102 ("drm: improve drm_buddy_alloc function")
> Signed-off-by: Matthew Auld<matthew.auld@intel.com>
> Cc: Arunpravin Paneer Selvam<Arunpravin.PaneerSelvam@amd.com>
> Cc: Christian König<christian.koenig@amd.com>
> Cc:<stable@vger.kernel.org> # v5.18+
> ---
> drivers/gpu/drm/drm_buddy.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
> index c1a99bf4dffd..d09540d4065b 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -332,6 +332,7 @@ alloc_range_bias(struct drm_buddy *mm,
> u64 start, u64 end,
> unsigned int order)
> {
> + u64 req_size = mm->chunk_size << order;
> struct drm_buddy_block *block;
> struct drm_buddy_block *buddy;
> LIST_HEAD(dfs);
> @@ -367,6 +368,15 @@ alloc_range_bias(struct drm_buddy *mm,
> if (drm_buddy_block_is_allocated(block))
> continue;
>
> + if (block_start < start || block_end > end) {
> + u64 adjusted_start = max(block_start, start);
> + u64 adjusted_end = min(block_end, end);
> +
> + if (round_down(adjusted_end + 1, req_size) <=
> + round_up(adjusted_start, req_size))
> + continue;
> + }
> +
> if (contains(start, end, block_start, block_end) &&
> order == drm_buddy_block_order(block)) {
> /*
[-- Attachment #2: Type: text/html, Size: 2714 bytes --]
next prev parent reply other threads:[~2024-02-16 11:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 17:44 [PATCH 1/6] drm/tests/drm_buddy: fix 32b build Matthew Auld
2024-02-15 17:44 ` [PATCH 2/6] drm/buddy: fix range bias Matthew Auld
2024-02-16 11:40 ` Arunpravin Paneer Selvam [this message]
2024-02-15 17:44 ` [PATCH 3/6] drm/buddy: check range allocation matches alignment Matthew Auld
2024-02-16 11:25 ` Arunpravin Paneer Selvam
2024-02-15 17:44 ` [PATCH 4/6] drm/tests/drm_buddy: add alloc_range_bias test Matthew Auld
2024-02-16 11:26 ` Arunpravin Paneer Selvam
2024-02-15 17:44 ` [PATCH 5/6] drm/xe/stolen: lower the default alignment Matthew Auld
2024-02-15 17:44 ` [PATCH 6/6] drm/xe/stolen: ignore first page for FBC Matthew Auld
2024-02-16 13:59 ` Maarten Lankhorst
2024-02-15 17:54 ` ✓ CI.Patch_applied: success for series starting with [1/6] drm/tests/drm_buddy: fix 32b build Patchwork
2024-02-15 17:55 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-15 17:56 ` ✓ CI.KUnit: success " Patchwork
2024-02-15 18:07 ` ✓ CI.Build: " Patchwork
2024-02-15 18:08 ` ✓ CI.Hooks: " Patchwork
2024-02-15 18:09 ` ✗ CI.checksparse: warning " Patchwork
2024-02-15 18:31 ` ✓ CI.BAT: success " Patchwork
2024-02-16 11:23 ` [PATCH 1/6] " Arunpravin Paneer Selvam
2024-02-19 9:42 ` Matthew Auld
2024-02-19 9:53 ` Christian König
2024-02-19 10:28 ` Matthew Auld
2024-02-19 10:30 ` Christian König
2024-02-19 10:48 ` Matthew Auld
2024-02-19 12:24 ` Matthew Auld
2024-02-26 9:58 ` Matthew Auld
2024-02-26 10:38 ` Geert Uytterhoeven
2024-02-26 11:21 ` Matthew Auld
2024-02-28 7:20 ` Christian König
2024-02-28 9:20 ` Matthew Auld
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=119438d7-b2c8-d696-4249-a2e14bac88a0@amd.com \
--to=arunpravin.paneerselvam@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=stable@vger.kernel.org \
/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