From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/10] drm/i915: Add GEM debugging Kconfig option
Date: Mon, 11 Apr 2016 11:12:48 +0300 [thread overview]
Message-ID: <1460362368.7744.8.camel@linux.intel.com> (raw)
In-Reply-To: <1460200753-28466-4-git-send-email-chris@chris-wilson.co.uk>
On la, 2016-04-09 at 12:19 +0100, Chris Wilson wrote:
> Currently there is a #define to enable extra BUG_ON for debugging
> requests and associated activities. I want to expand its use to cover
> all of GEM internals (so that we can saturate the code with asserts).
> We can add a Kconfig option to make it easier to enable - with the usual
> caveats of not enabling unless explicitly requested.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
A few comments below, still:
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> drivers/gpu/drm/i915/Kconfig.debug | 12 ++++++++++++
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_gem.c | 12 +++++-------
> drivers/gpu/drm/i915/i915_gem.h | 34 ++++++++++++++++++++++++++++++++++
> 4 files changed, 52 insertions(+), 7 deletions(-)
> create mode 100644 drivers/gpu/drm/i915/i915_gem.h
>
> diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
> index 61485c8ba3a8..8f404103341d 100644
> --- a/drivers/gpu/drm/i915/Kconfig.debug
> +++ b/drivers/gpu/drm/i915/Kconfig.debug
> @@ -27,3 +27,15 @@ config DRM_I915_DEBUG
>
> If in doubt, say "N".
>
> +config DRM_I915_DEBUG_GEM
> + bool "Insert extra checks into the GEM internals"
> + default n
> + depends on DRM_I915_WERROR
Not sure if this needs to be explicit.
> + help
> + Enable extra sanity checks (including BUGs) along the GEM driver
> + paths that may slow the system down and if hit hang the machine.
> +
> + Recommended for driver developers only.
> +
> + If in doubt, say "N".
> +
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1753077aebbc..fcecc0a7332f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -57,6 +57,7 @@
> #include "intel_lrc.h"
> #include "intel_ringbuffer.h"
>
> +#include "i915_gem.h"
> #include "i915_gem_gtt.h"
> #include "i915_gem_render_state.h"
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 5a65a7663b88..716b7e00dd88 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -38,8 +38,6 @@
> #include
> #include
>
> -#define RQ_BUG_ON(expr)
> -
> static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj);
> static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj);
> static void
> @@ -1521,7 +1519,7 @@ i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj,
>
> i915_gem_object_retire__read(obj, i);
> }
> - RQ_BUG_ON(obj->active);
> + GEM_BUG_ON(obj->active);
> }
>
> return 0;
> @@ -2422,8 +2420,8 @@ void i915_vma_move_to_active(struct i915_vma *vma,
> static void
> i915_gem_object_retire__write(struct drm_i915_gem_object *obj)
> {
> - RQ_BUG_ON(obj->last_write_req == NULL);
> - RQ_BUG_ON(!(obj->active & intel_engine_flag(obj->last_write_req->engine)));
> + GEM_BUG_ON(obj->last_write_req == NULL);
> + GEM_BUG_ON(!(obj->active & intel_engine_flag(obj->last_write_req->engine)));
>
> i915_gem_request_assign(&obj->last_write_req, NULL);
> intel_fb_obj_flush(obj, true, ORIGIN_CS);
> @@ -2434,8 +2432,8 @@ i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring)
> {
> struct i915_vma *vma;
>
> - RQ_BUG_ON(obj->last_read_req[ring] == NULL);
> - RQ_BUG_ON(!(obj->active & (1 << ring)));
> + GEM_BUG_ON(obj->last_read_req[ring] == NULL);
> + GEM_BUG_ON(!(obj->active & (1 << ring)));
>
> list_del_init(&obj->engine_list[ring]);
> i915_gem_request_assign(&obj->last_read_req[ring], NULL);
> diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
> new file mode 100644
> index 000000000000..8292e797d9b5
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/i915_gem.h
> @@ -0,0 +1,34 @@
> +/*
> + * Copyright © 2016 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __I915_GEM_H__
> +#define __I915_GEM_H__
> +
> +#ifdef CONFIG_DRM_I915_DEBUG_GEM
> +#define GEM_BUG_ON(expr) BUG_ON(expr)
> +#else
> +#define GEM_BUG_ON(expr)
There seems to be no consistent way of doing this within kernel so
guess this is fin, s/(expr)//g would do, too.
Regards, Joonas
> +#endif
> +
> +#endif /* __I915_GEM_H__ */
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-11 8:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-09 11:19 EIO cleanup Chris Wilson
2016-04-09 11:19 ` [PATCH 01/10] drm/i915: Force clean compilation with -Werror Chris Wilson
2016-04-09 11:19 ` [PATCH 02/10] drm/i915: Disentangle i915_drv.h includes Chris Wilson
2016-04-11 8:00 ` Joonas Lahtinen
2016-04-09 11:19 ` [PATCH 03/10] drm/i915: Add GEM debugging Kconfig option Chris Wilson
2016-04-11 8:12 ` Joonas Lahtinen [this message]
2016-04-11 8:27 ` Chris Wilson
2016-04-09 11:19 ` [PATCH 04/10] drm/i915: Hide the atomic_read(reset_counter) behind a helper Chris Wilson
2016-04-09 11:19 ` [PATCH 05/10] drm/i915: Simplify checking of GPU reset_counter in display pageflips Chris Wilson
2016-04-09 11:19 ` [PATCH 06/10] drm/i915: Tighten reset_counter for reset status Chris Wilson
2016-04-09 11:19 ` [PATCH 07/10] drm/i915: Store the reset counter when constructing a request Chris Wilson
2016-04-11 7:56 ` Joonas Lahtinen
2016-04-09 11:19 ` [PATCH 08/10] drm/i915: Simplify reset_counter handling during atomic modesetting Chris Wilson
2016-04-09 11:19 ` [PATCH 09/10] drm/i915: Prevent leaking of -EIO from i915_wait_request() Chris Wilson
2016-04-09 11:19 ` [PATCH 10/10] drm/i915: Suppress error message when GPU resets are disabled Chris Wilson
2016-04-09 12:27 ` ✗ Fi.CI.BAT: failure for series starting with [01/10] drm/i915: Force clean compilation with -Werror Patchwork
2016-04-09 12:39 ` Chris Wilson
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=1460362368.7744.8.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@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: 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.