lkml.org 
[lkml]   [2002]   [Dec]   [19]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
DateThu, 19 Dec 2002 18:19:29 +0530
From"Vamsi Krishna S ." <>
SubjectRe: [PATCH] (4/5) improved notifier callback mechanism - read copy update
Hi Stephen,

On Wed, Dec 18, 2002 at 11:06:08PM +0000, Stephen Hemminger wrote:
> The notifier interface was only partially locked. The
> notifier_call_chain needs to be called in places where it is impossible
> to safely without having deadlocks; for example, NMI watchdog timeout.
> This patch uses read-copy-update to manage the list.  One extra bit of
> safety is using a reference count on the notifier_blocks to allow for
> cases like oprofile which need to sleep in a callback.
> 
<snip>
> 
>  int notifier_call_chain(struct list_head *list, unsigned long val, void
> *v)
>  {
> -	struct list_head *p;
> +	struct list_head *p, *nxtp;
>  	int ret = NOTIFY_DONE;
> 
> -	list_for_each(p, list) {
> +	rcu_read_lock();
> +	list_for_each_safe_rcu(p, nxtp, list) {
>  		struct notifier_block *nb =
>  			list_entry(p, struct notifier_block, link);
> 
> +		atomic_inc(&nb->inuse);
>  		ret = nb->notifier_call(nb,val,v);
> +		atomic_dec(&nb->inuse);
> +

There could be a small problem here. When rcu_read_lock() is called,
it bumps the preempt_count, so when the called handler attempts
to sleep, it will oops with "Bad: scheduling in atomic region".

-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi@in.ibm.com
-
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: 2005-03-22 11:31    [W:0.209 / U:1.300 seconds]
©2003-2008 Jasper Spaans