drm/nouveau/subdev/bus: Ratelimit logging for fault errors
authorLyude Paul <lyude@redhat.com>
Fri, 29 Apr 2022 19:53:47 +0000 (15:53 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:30:48 +0000 (10:30 +0200)
commit9776a7c07a4d705f9a060c7f59b1513dc238aaf9
tree6f8d395dabe0bc950ef1fdf2f694ba9c3b398b99
parent7086a23890d255bb5761604e39174b20d06231a4
drm/nouveau/subdev/bus: Ratelimit logging for fault errors

commit 9887bda0c831df0c044d6de147d002e48024fb4a upstream.

There's plenty of ways to fudge the GPU when developing on nouveau by
mistake, some of which can result in nouveau seriously spamming dmesg with
fault errors. This can be somewhat annoying, as it can quickly overrun the
message buffer (or your terminal emulator's buffer) and get rid of actually
useful feedback from the driver. While working on my new atomic only MST
branch, I ran into this issue a couple of times.

So, let's fix this by adding nvkm_error_ratelimited(), and using it to
ratelimit errors from faults. This should be fine for developers, since
it's nearly always only the first few faults that we care about seeing.
Plus, you can turn off rate limiting in the kernel if you really need to.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20220429195350.85620-1-lyude@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c
drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c