mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: vamsi@in.ibm.com, John Levon <levon@movementarian.org>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] (4/5) improved notifier callback mechanism - read copy update
Date: 19 Dec 2002 09:37:10 -0800	[thread overview]
Message-ID: <1040319430.23567.15.camel@dell_ss3.pdx.osdl.net> (raw)
In-Reply-To: <20021219181929.A5265@in.ibm.com>

Thanks, will look into it in more detail. Perhaps figuring out how to do
oprofile without sleeping would be best.

On Thu, 2002-12-19 at 04:49, Vamsi Krishna S . wrote:
> 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".
-- 
Stephen Hemminger <shemminger@osdl.org>
Open Source Devlopment Lab


  reply	other threads:[~2002-12-19 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-18 22:14 Stephen Hemminger
2002-12-19 12:49 ` Vamsi Krishna S .
2002-12-19 17:37   ` Stephen Hemminger [this message]
2002-12-19 18:08     ` John Levon
2002-12-19 23:07   ` [PATCH] (4/5) notifier callback mechanism - read copy update V2 Stephen Hemminger
2002-12-19 23:09   ` [PATCH] (5/5) improved notifier callback mechanism -- remove old locking V2 Stephen Hemminger

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=1040319430.23567.15.camel@dell_ss3.pdx.osdl.net \
    --to=shemminger@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=levon@movementarian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=vamsi@in.ibm.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

all inboxes | Powered by JetHome®