mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: sekharan@us.ibm.com, ak@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 0/7]: Fix for unsafe notifier chain
Date: Wed, 7 Dec 2005 15:36:12 -0800	[thread overview]
Message-ID: <20051207153612.0de2ce38.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0512071441010.22006-100000@iolanthe.rowland.org>

Alan Stern <stern@rowland.harvard.edu> wrote:
>
> A high percentage of the existing notifier chains are of the blocking sort
> (the callouts are allowed to sleep).  They are well served by a simple
> rw-semaphore, as in our patch.  It seems foolish to force the duplication
> of this locking code in all the places that would need it.
> 
> Likewise, the atomic-type chains (where the callouts must run in an atomic 
> context) are generally well served by the RCU mechanism, especially in 
> cases where callouts are never unregistered.
> 
> So I propose that, in addition to those two types of chains, we define a
> third type: raw notifiers.  These will be implemented with no protection
> at all.  No rw-semaphore, no spinlock, no RCU, no need to avoid
> self-unregistration, nothing -- all protection will be up to the users.  
> In other words, just what you asked for.
> 
> This gives us the best of both worlds.  The common cases can benefit from
> the centralized locking and protection, while anyone who has special needs
> can easily provide for them.
> 
> If you think this would be okay, I'll rewrite the notifier patch to 
> include the raw type.

The default version of notifier chains should be the lockless version -
just like list_head, radix_tree, etc.  (idr tries to provide its own
locking and has turned out to be a classic case of why we shouldn't do
that).

And sure, it makes sense to provide additional, higher-level data
structures and APIs which layer on top of that, purely as a code
consolidation exercise.  But they shouldn't be called notifier_chains. 
Call them notifier_chain_mutex_locked and notifier_chain_rwlocked and
notifier_chain_spinlocked or whatever.

As for the NMIs and RCU: I suspect it was simply a mistake to try to use
notifier chains for NMI registration in the first place - they are simply
too complex a data structure for this.  I think I previously suggested
removing that code and using just a fixed-size array of function pointers. 
But if the RCUified notifier chain solution is less-than-totally-gross then
that might be OK as well.

  reply	other threads:[~2005-12-07 23:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-07 20:12 Alan Stern
2005-12-07 23:36 ` Andrew Morton [this message]
2005-12-08 19:53   ` Alan Stern
2005-12-13  5:02     ` Keith Owens
2005-12-13 15:06       ` Alan Stern
2005-12-13 23:36         ` Andrew Morton
2005-12-09  4:50   ` Keith Owens
  -- strict thread matches above, loose matches on Subject: below --
2005-11-19  2:19 Chandra Seetharaman

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=20051207153612.0de2ce38.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sekharan@us.ibm.com \
    --cc=stern@rowland.harvard.edu \
    /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

Powered by JetHome