Commit 9887bda0 authored by Lyude Paul's avatar Lyude Paul

drm/nouveau/subdev/bus: Ratelimit logging for fault errors

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: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20220429195350.85620-1-lyude@redhat.com
parent 60856812
...@@ -62,4 +62,6 @@ void nvkm_subdev_intr(struct nvkm_subdev *); ...@@ -62,4 +62,6 @@ void nvkm_subdev_intr(struct nvkm_subdev *);
#define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, info, f, ##a) #define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, info, f, ##a)
#define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, info, f, ##a) #define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, info, f, ##a)
#define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a) #define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a)
#define nvkm_error_ratelimited(s,f,a...) nvkm_printk((s), ERROR, err_ratelimited, f, ##a)
#endif #endif
...@@ -35,7 +35,7 @@ gf100_bus_intr(struct nvkm_bus *bus) ...@@ -35,7 +35,7 @@ gf100_bus_intr(struct nvkm_bus *bus)
u32 addr = nvkm_rd32(device, 0x009084); u32 addr = nvkm_rd32(device, 0x009084);
u32 data = nvkm_rd32(device, 0x009088); u32 data = nvkm_rd32(device, 0x009088);
nvkm_error(subdev, nvkm_error_ratelimited(subdev,
"MMIO %s of %08x FAULT at %06x [ %s%s%s]\n", "MMIO %s of %08x FAULT at %06x [ %s%s%s]\n",
(addr & 0x00000002) ? "write" : "read", data, (addr & 0x00000002) ? "write" : "read", data,
(addr & 0x00fffffc), (addr & 0x00fffffc),
......
...@@ -45,7 +45,7 @@ nv31_bus_intr(struct nvkm_bus *bus) ...@@ -45,7 +45,7 @@ nv31_bus_intr(struct nvkm_bus *bus)
u32 addr = nvkm_rd32(device, 0x009084); u32 addr = nvkm_rd32(device, 0x009084);
u32 data = nvkm_rd32(device, 0x009088); u32 data = nvkm_rd32(device, 0x009088);
nvkm_error(subdev, "MMIO %s of %08x FAULT at %06x\n", nvkm_error_ratelimited(subdev, "MMIO %s of %08x FAULT at %06x\n",
(addr & 0x00000002) ? "write" : "read", data, (addr & 0x00000002) ? "write" : "read", data,
(addr & 0x00fffffc)); (addr & 0x00fffffc));
......
...@@ -60,7 +60,7 @@ nv50_bus_intr(struct nvkm_bus *bus) ...@@ -60,7 +60,7 @@ nv50_bus_intr(struct nvkm_bus *bus)
u32 addr = nvkm_rd32(device, 0x009084); u32 addr = nvkm_rd32(device, 0x009084);
u32 data = nvkm_rd32(device, 0x009088); u32 data = nvkm_rd32(device, 0x009088);
nvkm_error(subdev, "MMIO %s of %08x FAULT at %06x\n", nvkm_error_ratelimited(subdev, "MMIO %s of %08x FAULT at %06x\n",
(addr & 0x00000002) ? "write" : "read", data, (addr & 0x00000002) ? "write" : "read", data,
(addr & 0x00fffffc)); (addr & 0x00fffffc));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment