Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Assert intel_wait and its rb_node are complimentary
Date: Mon, 15 Oct 2018 13:58:06 +0100	[thread overview]
Message-ID: <15489168-1b87-8d2a-c02c-9a9c9cd4b811@linux.intel.com> (raw)
In-Reply-To: <20181012151552.14732-1-chris@chris-wilson.co.uk>


On 12/10/2018 16:15, Chris Wilson wrote:
> For convenience, we want to interchange intel_wait/rb_node and treat a
> NULL rb_node as a NULL intel_wait and vice versa. Assert that the
> rb_node is at offset 0 in the intel_wait to ensure this.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_breadcrumbs.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> index 84bf8d827136..44f117612193 100644
> --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> @@ -342,6 +342,7 @@ static bool __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
>   
>   static inline struct intel_wait *to_wait(struct rb_node *node)
>   {
> +	BUILD_BUG_ON(offsetof(struct intel_wait, node));
>   	return rb_entry(node, struct intel_wait, node);
>   }
>   
> 

I expected to see someone checking to_wait(...) for (non)-null but can't 
really spot it. Only potential candidate might be GEM_BUG_ON(b->irq_wait 
== wait) in __intel_breadrcumbs_finish, but that one could check it 
explicitly. Am I missing some?

Regards,

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

  parent reply	other threads:[~2018-10-15 12:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 15:15 [PATCH] drm/i915: Assert intel_wait and its rb_node are complimentary Chris Wilson
2018-10-12 15:55 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-10-12 19:06 ` ✓ Fi.CI.IGT: " Patchwork
2018-10-15 12:58 ` Tvrtko Ursulin [this message]
2018-10-15 13:04   ` [PATCH] " 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=15489168-1b87-8d2a-c02c-9a9c9cd4b811@linux.intel.com \
    --to=tvrtko.ursulin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox