All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: add DRM_ERROR_RATELIMITED
@ 2013-11-21 19:29 Rob Clark
  2013-11-22 15:34 ` Thierry Reding
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Clark @ 2013-11-21 19:29 UTC (permalink / raw)
  To: dri-devel

For error traces in situations that can run away, it is nice to have a
rate-limited version of DRM_ERROR() to avoid massing log flooding.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/drm/drmP.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 0a372b2..dd6699e 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -56,6 +56,7 @@
 #include <linux/mutex.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/ratelimit.h>
 #if defined(__alpha__) || defined(__powerpc__)
 #include <asm/pgtable.h>	/* For pte_wrprotect */
 #endif
@@ -180,6 +181,22 @@ int drm_err(const char *func, const char *format, ...);
 #define DRM_ERROR(fmt, ...)				\
 	drm_err(__func__, fmt, ##__VA_ARGS__)
 
+/**
+ * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_ERROR_RATELIMITED(fmt, ...)				\
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (__ratelimit(&_rs))						\
+		drm_err(__func__, fmt, ##__VA_ARGS__);			\
+})
+
 #define DRM_INFO(fmt, ...)				\
 	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: add DRM_ERROR_RATELIMITED
  2013-11-21 19:29 [PATCH] drm: add DRM_ERROR_RATELIMITED Rob Clark
@ 2013-11-22 15:34 ` Thierry Reding
  2013-11-22 16:37   ` Rob Clark
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2013-11-22 15:34 UTC (permalink / raw)
  To: Rob Clark; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 302 bytes --]

On Thu, Nov 21, 2013 at 02:29:51PM -0500, Rob Clark wrote:
> For error traces in situations that can run away, it is nice to have a
> rate-limited version of DRM_ERROR() to avoid massing log flooding.

s/massing/massive/?

Other than that, looks good:

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: add DRM_ERROR_RATELIMITED
  2013-11-22 15:34 ` Thierry Reding
@ 2013-11-22 16:37   ` Rob Clark
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Clark @ 2013-11-22 16:37 UTC (permalink / raw)
  To: Thierry Reding; +Cc: dri-devel@lists.freedesktop.org

On Fri, Nov 22, 2013 at 10:34 AM, Thierry Reding
<thierry.reding@gmail.com> wrote:
> On Thu, Nov 21, 2013 at 02:29:51PM -0500, Rob Clark wrote:
>> For error traces in situations that can run away, it is nice to have a
>> rate-limited version of DRM_ERROR() to avoid massing log flooding.
>
> s/massing/massive/?

errg, yes

Dave, let me know if you want me to resend or just smash that spelling
fix in yourself

BR,
-R

> Other than that, looks good:
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-22 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 19:29 [PATCH] drm: add DRM_ERROR_RATELIMITED Rob Clark
2013-11-22 15:34 ` Thierry Reding
2013-11-22 16:37   ` Rob Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.