Re: reservation.h: build error with lockdep disabled

2015-11-26 Thread Paul E. McKenney
On Thu, Nov 26, 2015 at 01:43:40PM +, Russell King - ARM Linux wrote:
> As of 3c3b177a9369 ("reservation: add suppport for read-only access
> using rcu") linux/reservation.h uses lockdep macros:
> 
> +#define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base)
> 
> This results in build errors when lockdep is disabled as lockdep_is_held()
> is only available when lockdep is enabled.  This has been reported today
> to break the etnaviv kernel driver, which we're hoping to submit for 4.5.
> 
> As this gets used with rcu_dereference_protected(), eg:
> 
> static inline struct reservation_object_list *
> reservation_object_get_list(struct reservation_object *obj)
> {
> return rcu_dereference_protected(obj->fence,
>  reservation_object_held(obj));
> }
> 
> I'm guessing that it's not going to be a simple case of making it always
> return true or always return false.
> 
> Any ideas how to solve this?

The usual approach is something like this:

#ifdef CONFIG_PROVE_LOCKING
#define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base)
#else
#define reservation_object_held(obj) true
#endif

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESUBMIT] [PATCH] Replace mentions of "list_struct" to "list_head"

2014-11-14 Thread Paul E. McKenney
On Fri, Nov 14, 2014 at 05:09:55AM +0400, Andrey Utkin wrote:
> There's no such thing as "list_struct".
> 
> Signed-off-by: Andrey Utkin 

May as well get group rates on the acks...  ;-)

Acked-by: Paul E. McKenney 

> ---
>  drivers/gpu/drm/radeon/mkregtable.c  | 24 
>  drivers/media/pci/cx18/cx18-driver.h |  2 +-
>  include/linux/list.h | 34 +-
>  include/linux/plist.h| 10 +-
>  include/linux/rculist.h  |  8 
>  scripts/kconfig/list.h   |  6 +++---
>  tools/usb/usbip/libsrc/list.h|  2 +-
>  7 files changed, 43 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/mkregtable.c 
> b/drivers/gpu/drm/radeon/mkregtable.c
> index 4a85bb6..b928c17 100644
> --- a/drivers/gpu/drm/radeon/mkregtable.c
> +++ b/drivers/gpu/drm/radeon/mkregtable.c
> @@ -347,7 +347,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_entry - get the struct for this entry
>   * @ptr: the &struct list_head pointer.
>   * @type:the type of the struct this is embedded in.
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   */
>  #define list_entry(ptr, type, member) \
>   container_of(ptr, type, member)
> @@ -356,7 +356,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_first_entry - get the first element from a list
>   * @ptr: the list head to take the element from.
>   * @type:the type of the struct this is embedded in.
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   *
>   * Note, that list is expected to be not empty.
>   */
> @@ -406,7 +406,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_for_each_entry   -   iterate over list of given type
>   * @pos: the type * to use as a loop cursor.
>   * @head:the head for your list.
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   */
>  #define list_for_each_entry(pos, head, member)   
> \
>   for (pos = list_entry((head)->next, typeof(*pos), member);  \
> @@ -417,7 +417,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_for_each_entry_reverse - iterate backwards over list of given type.
>   * @pos: the type * to use as a loop cursor.
>   * @head:the head for your list.
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   */
>  #define list_for_each_entry_reverse(pos, head, member)   
> \
>   for (pos = list_entry((head)->prev, typeof(*pos), member);  \
> @@ -428,7 +428,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_prepare_entry - prepare a pos entry for use in 
> list_for_each_entry_continue()
>   * @pos: the type * to use as a start point
>   * @head:the head of the list
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   *
>   * Prepares a pos entry for use as a start point in 
> list_for_each_entry_continue().
>   */
> @@ -439,7 +439,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_for_each_entry_continue - continue iteration over list of given type
>   * @pos: the type * to use as a loop cursor.
>   * @head:the head for your list.
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   *
>   * Continue to iterate over list of given type, continuing after
>   * the current position.
> @@ -453,7 +453,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_for_each_entry_continue_reverse - iterate backwards from the given 
> point
>   * @pos: the type * to use as a loop cursor.
>   * @head:the head for your list.
> - * @member:  the name of the list_struct within the struct.
> + * @member:  the name of the list_head within the struct.
>   *
>   * Start to iterate over list of given type backwards, continuing after
>   * the current position.
> @@ -467,7 +467,7 @@ static inline void list_splice_tail_init(struct list_head 
> *list,
>   * list_for_each_entry_from - iterate over list of given type from the 
> current point
>   * @pos: the type * to use as a loop cursor.
>   * @head:the head for your list.
> -