[Intel-gfx] [PATCH] drm/i915: Assert intel_wait and its rb_node are complimentary
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Mon Oct 15 12:58:06 UTC 2018
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 at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at 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
More information about the Intel-gfx
mailing list