<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<br>
<br>
<div class="moz-cite-prefix">On 5/12/2025 2:03 AM, Paneer Selvam,
Arunpravin wrote:<br>
</div>
<blockquote type="cite" cite="mid:fbf53dc5-01f0-496c-88b0-86eada7c5a91@amd.com">
<br>
<br>
On 5/3/2025 5:53 PM, Paneer Selvam, Arunpravin wrote:
<br>
<blockquote type="cite">
<br>
<br>
On 5/2/2025 9:02 PM, John Olender wrote:
<br>
<blockquote type="cite">On 4/30/25 5:44 PM, Paneer Selvam,
Arunpravin wrote:
<br>
<blockquote type="cite">
<br>
On 5/1/2025 2:50 AM, Alex Deucher wrote:
<br>
<blockquote type="cite">+ Christian
<br>
<br>
On Tue, Apr 29, 2025 at 7:24 AM John Olender
<a class="moz-txt-link-rfc2396E" href="mailto:john.olender@gmail.com"><john.olender@gmail.com></a>
<br>
wrote:
<br>
<blockquote type="cite">The drm_mm allocator tolerated
being passed end > mm->size, but the
<br>
drm_buddy allocator does not.
<br>
<br>
Restore the pre-buddy-allocator behavior of allowing
such placements.
<br>
<br>
Closes:
<a class="moz-txt-link-freetext" href="https://gitlab.freedesktop.org/drm/amd/-/issues/3448">https://gitlab.freedesktop.org/drm/amd/-/issues/3448</a>
<br>
Signed-off-by: John Olender
<a class="moz-txt-link-rfc2396E" href="mailto:john.olender@gmail.com"><john.olender@gmail.com></a>
<br>
</blockquote>
This looks correct to me.
<br>
Reviewed-by: Alex Deucher
<a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
<br>
</blockquote>
I was thinking that we should return an error when lpfn >
man->size.
<br>
<br>
Regards,
<br>
Arun.
<br>
</blockquote>
This patch restores the previous behavior in the spirit of "Do
not crash
<br>
the kernel". The existing uvd placements are pretty clear in
their
<br>
intent and were accepted until the switch to drm_buddy. I
think it's
<br>
fair to consider their style as expected.
<br>
<br>
With that in mind, I'm not sure amdgpu_vram_mgr is the place
this change
<br>
really belongs. That is, I think it's worth asking:
<br>
<br>
1) Why does drm_mm accept end > mm->size without
complaint?
<br>
2) Why doesn't drm_buddy do the same?
<br>
</blockquote>
<br>
I remember that during the development of DRM buddy , we had a
discussion with Intel folks and decided to
<br>
return an error in DRM buddy when end > mm->size. This was
done to ensure that, at the driver level, lpfn
<br>
has the correct value.
<br>
<br>
I will modify this at drm_buddy to match with drm_mm and send
the patch.
<br>
</blockquote>
After giving it some thought, I think it is more effective to
implement this tolerance at the VRAM manager level
<br>
and allow the DRM buddy manager to perform a strict validation, as
this is necessary for other graphics drivers
<br>
(e.g., i915).
<br>
</blockquote>
<br>
Reviewed-by:
Arunpravin Paneer Selvam <<a href="mailto:Arunpravin.PaneerSelvam@amd.com" class="moz-txt-link-freetext">Arunpravin.PaneerSelvam@amd.com</a>>
<blockquote type="cite" cite="mid:fbf53dc5-01f0-496c-88b0-86eada7c5a91@amd.com">
<br>
Regards,
<br>
Arun.
<br>
<blockquote type="cite">
<br>
Regards,
<br>
Arun.
<br>
<blockquote type="cite">
<br>
Thanks,
<br>
John
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">---
<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
<br>
1 file changed, 1 insertion(+), 1 deletion(-)
<br>
<br>
diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
b/drivers/
<br>
gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
<br>
index 2d7f82e98df9..abdc52b0895a 100644
<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
<br>
@@ -463,7 +463,7 @@ static int
amdgpu_vram_mgr_new(struct
<br>
ttm_resource_manager *man,
<br>
int r;
<br>
<br>
lpfn = (u64)place->lpfn <<
PAGE_SHIFT;
<br>
- if (!lpfn)
<br>
+ if (!lpfn || lpfn > man->size)
<br>
lpfn = man->size;
<br>
<br>
fpfn = (u64)place->fpfn <<
PAGE_SHIFT;
<br>
-- <br>
2.47.2
<br>
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>