dri-devel Archive on lore.kernel.org
 help / color / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>,
	daniel@ffwll.ch, sam@ravnborg.org, sudeep.dutt@intel.com,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@linux.ie>
Cc: pankaj.laxminarayan.bharadiya@intel.com
Subject: Re: [[Intel-gfx] [PATCH v2 01/10] drm/print: introduce new struct drm_device based WARN* macros
Date: Wed, 15 Jan 2020 12:02:35 +0200
Message-ID: <87y2u9jav8.fsf@intel.com> (raw)
In-Reply-To: <20200115034455.17658-2-pankaj.laxminarayan.bharadiya@intel.com>

On Wed, 15 Jan 2020, Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> wrote:
> Add new struct drm_device based WARN* macros. These are modeled after
> the core kernel device based WARN* macros. These would be preferred
> over the regular WARN* macros, where possible.
>
> These macros include device information in the backtrace, so we know
> what device the warnings originate from.
>
> Knowing the device specific information in the backtrace would be
> helpful in development all around.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  include/drm/drm_print.h | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 8f99d389792d..894a0b9437e2 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -553,4 +553,33 @@ void __drm_err(const char *format, ...);
>  #define DRM_DEBUG_PRIME_RATELIMITED(fmt, ...)				\
>  	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
>  
> +/*
> + * struct drm_device based WARNs
> + *
> + * drm_WARN*() acts like WARN*(), but with the key difference of
> + * using device specific information so that we know from which device
> + * warning is originating from.
> + *
> + * Prefer drm_device based drm_WARN* over regular WARN*
> + */
> +
> +/* Helper for struct drm_device based WARNs */
> +#define drm_WARN(drm, condition, format, arg...)			\
> +	WARN(condition, "%s %s: " format,				\
> +			dev_driver_string((drm)->dev),			\
> +			dev_name((drm)->dev), ## arg)
> +
> +#define drm_WARN_ONCE(drm, condition, format, arg...)			\
> +	WARN_ONCE(condition, "%s %s: " format,				\
> +			dev_driver_string((drm)->dev),			\
> +			dev_name((drm)->dev), ## arg)
> +
> +#define drm_WARN_ON(drm, x)						\
> +	drm_WARN((drm), (x), "%s",					\
> +		 "drm_WARN_ON(" __stringify(x) ")")
> +
> +#define drm_WARN_ON_ONCE(drm, x)					\
> +	drm_WARN_ONCE((drm), (x), "%s",					\
> +		      "drm_WARN_ON_ONCE(" __stringify(x) ")")
> +
>  #endif /* DRM_PRINT_H_ */

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply index

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  3:44 [[Intel-gfx] [PATCH v2 00/10] drm: Introduce struct drm_device based WARN* and use them in i915 Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 01/10] drm/print: introduce new struct drm_device based WARN* macros Pankaj Bharadiya
2020-01-15 10:02   ` Jani Nikula [this message]
2020-01-21  8:39     ` Jani Nikula
2020-01-21  9:13       ` Sam Ravnborg
2020-01-22 13:30   ` [Intel-gfx] [ " Sean Paul
2020-01-22 15:32     ` Jani Nikula
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 02/10] drm/i915/display: Make WARN* drm specific where drm_device ptr is available Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 03/10] drm/i915/display: Make WARN* drm specific where drm_priv " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 04/10] drm/i915/display: Make WARN* drm specific where encoder " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 05/10] drm/i915/gem: Make WARN* drm specific where drm_priv " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 06/10] drm/i915/gt: " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 07/10] drm/i915/gvt: " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 08/10] drm/i915/gvt: Make WARN* drm specific where vgpu " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 09/10] drm/i915: Make WARN* drm specific where drm_priv " Pankaj Bharadiya
2020-01-15  3:44 ` [[Intel-gfx] [PATCH v2 10/10] drm/i915: Make WARN* drm specific where uncore or stream " Pankaj Bharadiya
2020-01-22 16:22 ` [[Intel-gfx] [PATCH v2 00/10] drm: Introduce struct drm_device based WARN* and use them in i915 Jani Nikula
2020-01-23  9:00   ` Bharadiya,Pankaj
2020-01-23  9:39     ` Jani Nikula
2020-01-27  8:14       ` Bharadiya,Pankaj
2020-01-27  9:01         ` Jani Nikula
  -- strict thread matches above, loose matches on Subject: below --
2020-01-15  3:43 Pankaj Bharadiya
2020-01-15  3:43 ` [[Intel-gfx] [PATCH v2 01/10] drm/print: introduce new struct drm_device based WARN* macros Pankaj Bharadiya

Reply instructions:

You may reply publically 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=87y2u9jav8.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=pankaj.laxminarayan.bharadiya@intel.com \
    --cc=sam@ravnborg.org \
    --cc=sudeep.dutt@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

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
		dri-devel@lists.freedesktop.org
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.dri-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git