lkml.org 
[lkml]   [2007]   [Jul]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 5 Jul 2007 10:45:38 +0200
FromIngo Molnar <>
SubjectRe: [PATCH] debug work struct cancel deadlocks with lockdep
* Johannes Berg <johannes@sipsolutions.net> wrote:

> +#ifdef CONFIG_LOCKDEP
> +		/*
> +		 * It is permissible to free the struct work_struct
> +		 * from inside the function that is called from it,
> +		 * this we need to take into account for lockdep too.
> +		 * To avoid bogus "held lock freed" warnings as well
> +		 * as problems when looking into work->lockdep_map,
> +		 * make a copy and use that here.
> +		 */
> +		struct lockdep_map lockdep_map = work->lockdep_map;
> +#endif

> +		lock_acquire(&lockdep_map, 0, 0, 0, 2, _THIS_IP_);
>  		f(work);
> +		lock_release(&lockdep_map, 1, _THIS_IP_);

neat trick :)

	Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-05 10:49    [from the cache]
©2003-2008