On Tue, Sep 02, 2025 at 12:53:32PM -0400, Alex Deucher wrote:
> Older GPUs did not support memory protection, so the kernel
> driver would validate the command submissions (CS) from userspace
> to avoid the GPU accessing any memory it shouldn't.
>
> Change any error messages in that validatio to dev_warn_once() to
> avoid spamming the kernel log in the event of a bad CS. If users
> see any of these messages they should report them to the user space
> component, which in most cases is mesa
> (https://gitlab.freedesktop.org/mesa/mesa/-/issues).
>
> Cc: Borislav Petkov (AMD) <[email protected]>
> Link:
> https://lore.kernel.org/r/20250829171655.GBaLHgh3VOvuM1UfJg@fat_crate.local
> Signed-off-by: Alex Deucher <[email protected]>
> ---
> drivers/gpu/drm/radeon/evergreen_cs.c | 520 +++++++++++++-------------
> drivers/gpu/drm/radeon/r100.c | 215 +++++------
> drivers/gpu/drm/radeon/r200.c | 34 +-
> drivers/gpu/drm/radeon/r300.c | 66 ++--
> drivers/gpu/drm/radeon/r600_cs.c | 445 +++++++++++-----------
> drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
> 6 files changed, 648 insertions(+), 634 deletions(-)
Btw, now that I had to reboot the workstation, I thought I'll apply yours to
test it. You've missed one spot, see below. :-)
With that additional debug added, I see now:
[ 25.877593] radeon 0000:1d:00.0: vbo resource seems too big (524289) for the
bo (524288)
which looks like some buffer limits mis-counting. The bo is obviously of 1^19
buffer size while one of those "size" and "offset" things are off by one.
If anyone wants to debug, the program which causes this is conky version:
1.11.6-2 in debian. It starts spewing the warnings when I start it and since
it.
Thx.
---
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c
b/drivers/gpu/drm/radeon/evergreen_cs.c
index d49e59626e39..1162cb5d75ed 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -2418,7 +2418,8 @@ static int evergreen_packet3_check(struct
radeon_cs_parser *p,
size = radeon_get_ib_value(p, idx+1+(i*8)+1);
if (p->rdev && (size + offset) >
radeon_bo_size(reloc->robj)) {
/* force size to size of the buffer */
- dev_warn_ratelimited(p->dev, "vbo
resource seems too big for the bo\n");
+ dev_warn_once(p->dev, "vbo resource
seems too big (%d) for the bo (%ld)\n",
+ size + offset,
radeon_bo_size(reloc->robj));
ib[idx+1+(i*8)+1] =
radeon_bo_size(reloc->robj) - offset;
}
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette