From: Lyude <cpaul@redhat.com> To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, xorg-driver-ati@lists.freedesktop.org Cc: Lyude <cpaul@redhat.com>, David Airlie <airlied@linux.ie>, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] drm: Add ratelimited versions of the DRM_DEBUG* macros Date: Fri, 5 Aug 2016 20:30:38 -0400 [thread overview] Message-ID: <1470443443-27252-7-git-send-email-cpaul@redhat.com> (raw) In-Reply-To: <1470443443-27252-1-git-send-email-cpaul@redhat.com> There's a couple of places where this would be useful for drivers (such as reporting DP aux transaction timeouts). Signed-off-by: Lyude <cpaul@redhat.com> --- include/drm/drmP.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d377865..1c4d91b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -231,6 +231,36 @@ void drm_err(const char *format, ...); drm_ut_debug_printk(__func__, fmt, ##args); \ } while (0) +#define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...) \ + do { \ + if (unlikely(drm_debug & DRM_UT_ ## level)) { \ + static DEFINE_RATELIMIT_STATE( \ + _rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + \ + if (__ratelimit(&_rs)) { \ + drm_ut_debug_printk(__func__, fmt, \ + ##args); \ + } \ + } \ + } while (0) + +/** + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. + * + * \param fmt printf() like format string. + * \param arg arguments + */ +#define DRM_DEBUG_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args) +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args) +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args) +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args) + /*@}*/ /***********************************************************************/ -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Lyude <cpaul-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, xorg-driver-ati-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH 6/7] drm: Add ratelimited versions of the DRM_DEBUG* macros Date: Fri, 5 Aug 2016 20:30:38 -0400 [thread overview] Message-ID: <1470443443-27252-7-git-send-email-cpaul@redhat.com> (raw) In-Reply-To: <1470443443-27252-1-git-send-email-cpaul-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> There's a couple of places where this would be useful for drivers (such as reporting DP aux transaction timeouts). Signed-off-by: Lyude <cpaul@redhat.com> --- include/drm/drmP.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d377865..1c4d91b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -231,6 +231,36 @@ void drm_err(const char *format, ...); drm_ut_debug_printk(__func__, fmt, ##args); \ } while (0) +#define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...) \ + do { \ + if (unlikely(drm_debug & DRM_UT_ ## level)) { \ + static DEFINE_RATELIMIT_STATE( \ + _rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + \ + if (__ratelimit(&_rs)) { \ + drm_ut_debug_printk(__func__, fmt, \ + ##args); \ + } \ + } \ + } while (0) + +/** + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. + * + * \param fmt printf() like format string. + * \param arg arguments + */ +#define DRM_DEBUG_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args) +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args) +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args) +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args) + /*@}*/ /***********************************************************************/ -- 2.7.4 _______________________________________________ xorg-driver-ati mailing list xorg-driver-ati@lists.x.org https://lists.x.org/mailman/listinfo/xorg-driver-ati
next prev parent reply other threads:[~2016-08-06 20:28 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-08-06 0:30 [PATCH 0/7] Minor DP aux transaction fixes Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 0:30 ` [PATCH 1/7] drm/dp_helper: Print first error received on failure in drm_dp_dpcd_access() Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 0:30 ` [PATCH 2/7] drm/radeon: Don't print error on aux transaction timeouts Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 0:30 ` [PATCH 3/7] drm/radeon: Don't retry 7 times in radeon_dp_dpcd() Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 0:30 ` [PATCH 4/7] drm/amdgpu: Don't print error on aux transaction timeouts Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 0:30 ` [PATCH 5/7] drm/amdgpu: Don't retry 7 times in amdgpu_atombios_dp_get_dpcd() Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 0:30 ` Lyude [this message] 2016-08-06 0:30 ` [PATCH 6/7] drm: Add ratelimited versions of the DRM_DEBUG* macros Lyude 2016-08-06 20:32 ` Joe Perches 2016-08-06 20:32 ` Joe Perches 2016-08-06 0:30 ` [PATCH 7/7] drm/dp_helper: Rate limit timeout errors from drm_dp_i2c_do_msg() Lyude 2016-08-06 0:30 ` Lyude 2016-08-06 10:22 ` [PATCH 0/7] Minor DP aux transaction fixes Christian König 2016-08-06 10:22 ` Christian König 2016-08-08 17:30 ` Alex Deucher 2016-08-09 6:11 ` Daniel Vetter 2016-08-09 6:11 ` Daniel Vetter
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1470443443-27252-7-git-send-email-cpaul@redhat.com \ --to=cpaul@redhat.com \ --cc=airlied@linux.ie \ --cc=amd-gfx@lists.freedesktop.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=xorg-driver-ati@lists.freedesktop.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.