dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] reservation: sprinkle some WARN_ON()s
Date: Sat, 4 Jun 2016 14:52:46 +0200	[thread overview]
Message-ID: <20160604125245.GG14529@phenom.ffwll.local> (raw)
In-Reply-To: <1460076776-25023-1-git-send-email-robdclark@gmail.com>

On Thu, Apr 07, 2016 at 08:52:56PM -0400, Rob Clark wrote:
> A bit overkill since, for example, the rcu_dereference_protected() in
> reservation_object_get_list() will WARN.  But this is much less subtle
> for folks reading the code.
> 
> v2: use reservation_object_held() instead of ww_mutex_is_locked()
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Doesn't seem to build here:


In file included from ./arch/arm/include/asm/bug.h:59:0,
                 from include/linux/bug.h:4,
                 from include/linux/thread_info.h:11,
                 from include/asm-generic/current.h:4,
                 from arch/arm/include/generated/asm/current.h:1,
                 from include/linux/mutex.h:13,
                 from include/linux/ww_mutex.h:17,
                 from include/linux/reservation.h:42,
                 from drivers/dma-buf/reservation.c:35:
drivers/dma-buf/reservation.c: In function ‘reservation_object_reserve_shared’:
include/linux/reservation.h:82:38: error: implicit declaration of function ‘lockdep_is_held’ [-Werror=implicit-function-declaration]
 #define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base)
                                      ^
include/asm-generic/bug.h:92:25: note: in definition of macro ‘WARN_ON’
  int __ret_warn_on = !!(condition);    \
                         ^
drivers/dma-buf/reservation.c:74:11: note: in expansion of macro ‘reservation_object_held’
  WARN_ON(!reservation_object_held(obj));

Sounds like we should include some headers from reservation.h.
-Daniel

> ---
>  drivers/dma-buf/reservation.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index c0bd572..439af82 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -52,6 +52,8 @@ int reservation_object_reserve_shared(struct reservation_object *obj)
>  	struct reservation_object_list *fobj, *old;
>  	u32 max;
>  
> +	WARN_ON(!reservation_object_held(obj));
> +
>  	old = reservation_object_get_list(obj);
>  
>  	if (old && old->shared_max) {
> @@ -189,6 +191,8 @@ void reservation_object_add_shared_fence(struct reservation_object *obj,
>  {
>  	struct reservation_object_list *old, *fobj = obj->staged;
>  
> +	WARN_ON(!reservation_object_held(obj));
> +
>  	old = reservation_object_get_list(obj);
>  	obj->staged = NULL;
>  
> @@ -207,6 +211,8 @@ void reservation_object_add_excl_fence(struct reservation_object *obj,
>  	struct reservation_object_list *old;
>  	u32 i = 0;
>  
> +	WARN_ON(!reservation_object_held(obj));
> +
>  	old = reservation_object_get_list(obj);
>  	if (old)
>  		i = old->shared_count;
> -- 
> 2.5.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-06-04 12:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Message-Id: <1459456012-16248-2-git-send-email-robdclark@gmail.com>
2016-04-08  0:52 ` [PATCH] reservation: sprinkle some WARN_ON()s Rob Clark
2016-06-04 12:52   ` Daniel Vetter [this message]
2016-06-04 15:47     ` Rob Clark
2016-03-31 20:26 [PATCH 0/4] dma-buf/reservation doc updates Rob Clark
2016-03-31 20:26 ` [PATCH 1/4] reservation: sprinkle some WARN_ON()s Rob Clark
2016-04-01  8:48   ` Lucas Stach
2016-04-01 14:50     ` Rob Clark
2016-04-01 14:02   ` Christian König
2016-03-31 20:26 ` [PATCH 2/4] dma-buf: headerdoc fixes Rob Clark
2016-03-31 20:26 ` [PATCH 3/4] reservation: add headerdoc comments Rob Clark
2016-03-31 20:26 ` [PATCH 4/4] doc: update/fixup dma-buf related DocBook Rob Clark
2016-04-01 14:07 ` [PATCH 0/4] dma-buf/reservation doc updates Alex Deucher
2016-04-01 15:20   ` Sumit Semwal
2016-06-04 12:21     ` Daniel Vetter
2016-06-05 11:17       ` Sumit Semwal
2016-06-05 17:18         ` Daniel Vetter
2016-06-06  4:41           ` Sumit Semwal

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=20160604125245.GG14529@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robdclark@gmail.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