Skip to contentSkip to conversation

drm/nouveau: add nv_error_ratelimited()

PATCH New Rob Clark 1 participant 1 message May 21, 2015

Subsystems (3)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm/nouveau: add nv_error_ratelimited()

When things go badly, the log is flooded with SCHED_ERROR messages, which is less than useful. Instead lets ratelimit these so we can still find the traces leading up to the problems.

---
 drivers/gpu/drm/nouveau/include/nvkm/core/printk.h | 9 +++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c   | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c   | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/printk.h +9 -0
index 8364817..aad5a54 100644
@@ -14,6 +14,15 @@ nv_printk_(struct nvkm_object *, int, const char *, ...);
 
 #define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a)
 #define nv_error(o,f,a...) nv_printk((o), ERROR, f, ##a)
+#define nv_error_ratelimited(o,f,a...) 				\
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (__ratelimit(&_rs))						\
+		nv_printk((o), ERROR, f, ##a);				\
+})
 #define nv_warn(o,f,a...) nv_printk((o), WARN, f, ##a)
 #define nv_info(o,f,a...) nv_printk((o), INFO, f, ##a)
 #define nv_debug(o,f,a...) nv_printk((o), DEBUG, f, ##a)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c +1 -1
index b745252..d0f47f0 100644
@@ -523,7 +523,7 @@ gf100_fifo_intr_sched(struct gf100_fifo_priv *priv)
 	if (!en)
 		snprintf(enunk, sizeof(enunk), "UNK%02x", code);
 
-	nv_error(priv, "SCHED_ERROR [ %s ]\n", en ? en->name : enunk);
+	nv_error_ratelimited(priv, "SCHED_ERROR [ %s ]\n", en ? en->name : enunk);
 
 	switch (code) {
 	case 0x0a:
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c +1 -1
index e10f964..ac67d0b 100644
@@ -576,7 +576,7 @@ gk104_fifo_intr_sched(struct gk104_fifo_priv *priv)
 	if (!en)
 		snprintf(enunk, sizeof(enunk), "UNK%02x", code);
 
-	nv_error(priv, "SCHED_ERROR [ %s ]\n", en ? en->name : enunk);
+	nv_error_ratelimited(priv, "SCHED_ERROR [ %s ]\n", en ? en->name : enunk);
 
 	switch (code) {
 	case 0x0a:
Signature · 6 lines
2.4.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel