From: Chris Wilson <chris@chris-wilson.co.uk>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Intel graphics driver community testing & development
<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v2 3/4] drm/i915: Add WARN_RECUR and i915.recur_warnings
Date: Fri, 18 Dec 2015 11:30:25 +0000 [thread overview]
Message-ID: <20151218113025.GG26780@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1450436898-20408-4-git-send-email-joonas.lahtinen@linux.intel.com>
On Fri, Dec 18, 2015 at 01:08:17PM +0200, Joonas Lahtinen wrote:
> Add i915.recur_warnings parameter to control output in cases where the warning
> is of recurring type and is potentially called from multiple paths. Using just
> WARN_ONCE would mask out other calling paths but one, this is not desireable
> on developer machine or CI system, but is a compromise to be made on end user
> system not to flood the message and overflow all possible kernel log buffers.
>
> When the recur_warnings option is false (default), WARN_RECUR will reduce to
> WARN_ONCE.
>
> v2:
> - More upstreamable macro name and parameter (Chris)
> - Squash a hunk that slipped to next patch
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 10 ++++++++++
> drivers/gpu/drm/i915/i915_params.c | 6 ++++++
> drivers/gpu/drm/i915/i915_params.h | 1 +
> 3 files changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3ce609f..e1ca61f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -76,6 +76,16 @@
> #undef WARN_ON_ONCE
> #define WARN_ON_ONCE(x) WARN_ONCE((x), "WARN_ON_ONCE(" __stringify(x) ")")
>
> +#define WARN_RECUR(condition, format...) ({ \
> + static bool __section(.data.unlikely) __warned; \
> + int __ret_warn_on = !!(condition); \
> + if (unlikely(__ret_warn_on)) \
> + if (WARN(unlikely(!__warned || \
> + i915.recur_warnings), format)) \
> + __warned = true; \
> + unlikely(__ret_warn_on); \
> +})
Ah, see include/linux/ratelimit.h
Just wondering if we can reuse that, extend it in someway to cover a
control variable?
Similarly, how to fold in I915_STATE_WARN (if possible)? i.e. to have
the optional error message instead of the WARN.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-12-18 11:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 11:08 [PATCH v2 0/4] Optionally display recurring warning messages Joonas Lahtinen
2015-12-18 11:08 ` [PATCH v2 1/4] drm/i915: Decouple struct i915_params i915 into i915_params.h Joonas Lahtinen
2015-12-18 11:08 ` [PATCH v2 2/4] drm/i915: Reorder i915_params struct Joonas Lahtinen
2015-12-21 13:35 ` Daniel Vetter
2015-12-18 11:08 ` [PATCH v2 3/4] drm/i915: Add WARN_RECUR and i915.recur_warnings Joonas Lahtinen
2015-12-18 11:30 ` Chris Wilson [this message]
2015-12-18 11:08 ` [PATCH v2 4/4] drm/i915: Use WARN_RECUR for recurring warning messages Joonas Lahtinen
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=20151218113025.GG26780@nuc-i3427.alporthouse.com \
--to=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
/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: link
Be 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.