From: Stephen Hemminger <shemminger@osdl.org>
To: vamsi@in.ibm.com
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
John Levon <levon@movementarian.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Notifier for significant events on i386
Date: 12 Dec 2002 09:53:35 -0800 [thread overview]
Message-ID: <1039715615.1649.80.camel@dell_ss3.pdx.osdl.net> (raw)
In-Reply-To: <20021212130406.A20253@in.ibm.com>
On Wed, 2002-12-11 at 23:34, Vamsi Krishna S . wrote:
> On Thu, Dec 12, 2002 at 12:25:47AM +0000, Stephen Hemminger wrote:
> >
> > This patch changes notifier to use RCU. No interface change, just a little
> > more memory in each notifier_block. Also some formatting cleanup.
> > Please review and give comments.
> >
> > <snip patch>
>
> This looks good. I have a few of comments:
>
> - add read_lock_rcu() / read_unlock_rcu() around the loop in
> notifier_call_chain() to be preempt-safe.
>
> - I would suggest using struct list_head in the notifier_block
> and use the RCU list routines from include/linux/list.h
> instead of spreading subtle RCU memory-barrier black magic.
That would be good for a new interface, but the existing code depends on
the single linked behavior. Many initializer's are pre-C99 style, and
more importantly there is no distinction between a list element and a
list head. To work with list macros the head has to be initialized
correctly. It is better not to worry about changing the interface and
avoid having to change all the calling code.
The only advantage to the doubly-linked list (besides std macros) is
that it is possible to unregister without knowing the head. There was a
patch several months ago to do singly-linked list macros but it looks
like it never got accepted. If the obscurity of the macro's is desired
then maybe the way to go is creating a slist.h with RCU extensions.
> - Even though RCU list reading is lockless, premption needs to
> be disabled while reading as mentioned above. So, we do
> need an __notifier_call_chain() version for those handlers
> that could sleep inside the handler: they will have to
> handle the required locking themselves.
The use of notifier today is limited to things that can't sleep. As far
as I can tell, it is intended for system events like reboot, panic;
where sleeping doesn't make sense. I think that is why the original
notifier_call_chain did not grab the read_lock.
--
Stephen Hemminger <shemminger@osdl.org>
Open Source Devlopment Lab
next prev parent reply other threads:[~2002-12-12 17:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-09 22:02 Stephen Hemminger
2002-12-11 11:21 ` Vamsi Krishna S .
2002-12-11 11:16 ` William Lee Irwin III
2002-12-11 11:43 ` Vamsi Krishna S .
2002-12-11 16:56 ` [lkcd-devel] " Stephen Hemminger
2002-12-11 20:27 ` John Levon
2002-12-11 21:15 ` Alan Cox
2002-12-12 0:19 ` Stephen Hemminger
2002-12-12 7:34 ` Vamsi Krishna S .
2002-12-12 17:53 ` Stephen Hemminger [this message]
2002-12-12 17:58 ` John Levon
2002-12-13 12:32 ` Vamsi Krishna S .
2002-12-12 8:13 ` Vamsi Krishna S .
2002-12-11 13:57 ` Corey Minyard
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=1039715615.1649.80.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=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®