public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Intel graphics driver community testing & development
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v3 2/3] drm/i915: Do not WARN_ON in i915_vm_to_ppgtt
Date: Fri, 1 Apr 2016 12:05:52 +0100	[thread overview]
Message-ID: <56FE5610.30500@intel.com> (raw)
In-Reply-To: <1459496803-18092-2-git-send-email-joonas.lahtinen@linux.intel.com>

On 01/04/16 08:46, Joonas Lahtinen wrote:
> According to Chris, use of i915_vm_to_ppgtt is visible in benchmark
> unless WARN_ON is removed, so lets get rid of it.
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.h | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index d3ebb2f..0035dc3 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3157,7 +3157,6 @@ bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj);
>   static inline struct i915_hw_ppgtt *
>   i915_vm_to_ppgtt(struct i915_address_space *vm)
>   {
> -	WARN_ON(i915_is_ggtt(vm));
>   	return container_of(vm, struct i915_hw_ppgtt, base);
>   }

I shouldn't think the actual check (i915_is_ggtt()) is slowing things 
down, so it must be the overhead of an unactivated WARN_ON(), which 
probably generates quite a bit of code and may disable optimisations, 
even when the code block isn't entered. As an alternative (if you *want* 
things to break if this is used incorrectly) you could have it return 
NULL for that case:

   static inline struct i915_hw_ppgtt *
   i915_vm_to_ppgtt(struct i915_address_space *vm)
   {
     return i915_is_ggtt(vm) ? NULL :
            container_of(vm, struct i915_hw_ppgtt, base);
   }

Caller will then very likely get an OOPS!

.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-01 11:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01  7:46 [PATCH v3 1/3] drm/i915: Use i915_vm_to_ppgtt instead of manual container_of Joonas Lahtinen
2016-04-01  7:46 ` [PATCH v3 2/3] drm/i915: Do not WARN_ON in i915_vm_to_ppgtt Joonas Lahtinen
2016-04-01 11:05   ` Dave Gordon [this message]
2016-04-01  7:46 ` [PATCH v3 3/3] drm/i915: Do not use {HAS_*, IS_*, INTEL_INFO}(dev_priv->dev) Joonas Lahtinen
2016-04-01  7:57 ` [PATCH v3 1/3] drm/i915: Use i915_vm_to_ppgtt instead of manual container_of 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=56FE5610.30500@intel.com \
    --to=david.s.gordon@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox