remarkable-linux/include/asm-sparc64
Alan Stern e041c68341 [PATCH] Notifier chain update: API changes
The kernel's implementation of notifier chains is unsafe.  There is no
protection against entries being added to or removed from a chain while the
chain is in use.  The issues were discussed in this thread:

    http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2

We noticed that notifier chains in the kernel fall into two basic usage
classes:

	"Blocking" chains are always called from a process context
	and the callout routines are allowed to sleep;

	"Atomic" chains can be called from an atomic context and
	the callout routines are not allowed to sleep.

We decided to codify this distinction and make it part of the API.  Therefore
this set of patches introduces three new, parallel APIs: one for blocking
notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
really just the old API under a new name).  New kinds of data structures are
used for the heads of the chains, and new routines are defined for
registration, unregistration, and calling a chain.  The three APIs are
explained in include/linux/notifier.h and their implementation is in
kernel/sys.c.

With atomic and blocking chains, the implementation guarantees that the chain
links will not be corrupted and that chain callers will not get messed up by
entries being added or removed.  For raw chains the implementation provides no
guarantees at all; users of this API must provide their own protections.  (The
idea was that situations may come up where the assumptions of the atomic and
blocking APIs are not appropriate, so it should be possible for users to
handle these things in their own way.)

There are some limitations, which should not be too hard to live with.  For
atomic/blocking chains, registration and unregistration must always be done in
a process context since the chain is protected by a mutex/rwsem.  Also, a
callout routine for a non-raw chain must not try to register or unregister
entries on its own chain.  (This did happen in a couple of places and the code
had to be changed to avoid it.)

Since atomic chains may be called from within an NMI handler, they cannot use
spinlocks for synchronization.  Instead we use RCU.  The overhead falls almost
entirely in the unregister routine, which is okay since unregistration is much
less frequent that calling a chain.

Here is the list of chains that we adjusted and their classifications.  None
of them use the raw API, so for the moment it is only a placeholder.

  ATOMIC CHAINS
  -------------
arch/i386/kernel/traps.c:		i386die_chain
arch/ia64/kernel/traps.c:		ia64die_chain
arch/powerpc/kernel/traps.c:		powerpc_die_chain
arch/sparc64/kernel/traps.c:		sparc64die_chain
arch/x86_64/kernel/traps.c:		die_chain
drivers/char/ipmi/ipmi_si_intf.c:	xaction_notifier_list
kernel/panic.c:				panic_notifier_list
kernel/profile.c:			task_free_notifier
net/bluetooth/hci_core.c:		hci_notifier
net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_chain
net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_expect_chain
net/ipv6/addrconf.c:			inet6addr_chain
net/netfilter/nf_conntrack_core.c:	nf_conntrack_chain
net/netfilter/nf_conntrack_core.c:	nf_conntrack_expect_chain
net/netlink/af_netlink.c:		netlink_chain

  BLOCKING CHAINS
  ---------------
arch/powerpc/platforms/pseries/reconfig.c:	pSeries_reconfig_chain
arch/s390/kernel/process.c:		idle_chain
arch/x86_64/kernel/process.c		idle_notifier
drivers/base/memory.c:			memory_chain
drivers/cpufreq/cpufreq.c		cpufreq_policy_notifier_list
drivers/cpufreq/cpufreq.c		cpufreq_transition_notifier_list
drivers/macintosh/adb.c:		adb_client_list
drivers/macintosh/via-pmu.c		sleep_notifier_list
drivers/macintosh/via-pmu68k.c		sleep_notifier_list
drivers/macintosh/windfarm_core.c	wf_client_list
drivers/usb/core/notify.c		usb_notifier_list
drivers/video/fbmem.c			fb_notifier_list
kernel/cpu.c				cpu_chain
kernel/module.c				module_notify_list
kernel/profile.c			munmap_notifier
kernel/profile.c			task_exit_notifier
kernel/sys.c				reboot_notifier_list
net/core/dev.c				netdev_chain
net/decnet/dn_dev.c:			dnaddr_chain
net/ipv4/devinet.c:			inetaddr_chain

It's possible that some of these classifications are wrong.  If they are,
please let us know or submit a patch to fix them.  Note that any chain that
gets called very frequently should be atomic, because the rwsem read-locking
used for blocking chains is very likely to incur cache misses on SMP systems.
(However, if the chain's callout routines may sleep then the chain cannot be
atomic.)

The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
material written by Keith Owens and suggestions from Paul McKenney and Andrew
Morton.

[jes@sgi.com: restructure the notifier chain initialization macros]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:50 -08:00
..
a.out.h [SPARC64]: Increase top of 32-bit process stack. 2006-03-20 01:16:36 -08:00
agp.h [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
apb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
asi.h [SPARC64]: Sun4v specific ASI defines. 2006-03-20 01:11:43 -08:00
atomic.h [PATCH] atomic: add_unless cmpxchg optimise 2006-03-23 07:38:17 -08:00
auxio.h [SPARC64]: Get rid of fast IRQ feature. 2005-06-27 17:04:45 -07:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bbc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bitops.h [PATCH] bitops: sparc64: use generic bitops 2006-03-26 08:57:14 -08:00
bpp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bsderrno.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bug.h [PATCH] remove all kernel BUGs 2005-05-01 08:59:01 -07:00
bugs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
byteorder.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cache.h [PATCH] Move read_mostly definition to asm/cache.h 2006-03-23 07:38:10 -08:00
cacheflush.h [SPARC64]: Add CONFIG_DEBUG_PAGEALLOC support. 2005-09-25 16:46:57 -07:00
chafsr.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
checksum.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
chmctrl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cmt.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
compat.h [PATCH] compat: be more consistent about [ug]id_t 2005-09-07 16:57:19 -07:00
const.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpudata.h [SPARC64]: Add a secondary TSB for hugepage mappings. 2006-03-22 01:15:14 -08:00
cputime.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
current.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dcr.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dcu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
delay.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
display7seg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
div64.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma-mapping.h [PATCH] gfp_t: dma-mapping (simple cases) 2005-10-28 08:16:49 -07:00
dma.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ebus.h [SPARC]: More abstractions and cleanups of dma handling in cs4231. 2005-11-07 14:09:19 -08:00
elf.h [SPARC64]: Add HWCAP_SPARC_BLKINIT elf capability flag for Niagara. 2006-03-20 01:13:26 -08:00
emergency-restart.h [PATCH] Add emergency_restart() 2005-07-26 14:35:41 -07:00
envctrl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
errno.h [PATCH] add EOWNERDEAD and ENOTRECOVERABLE version 2 2005-05-01 08:59:06 -07:00
estate.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fbio.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fcntl.h [PATCH] Clean up struct flock definitions 2005-09-07 16:57:38 -07:00
fhc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
floppy.h [SPARC64]: Get rid of fast IRQ feature. 2005-06-27 17:04:45 -07:00
fpumacro.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
futex.h [PATCH] lightweight robust futexes: arch defaults 2006-03-27 08:44:49 -08:00
hardirq.h [SPARC64]: Eliminate irq_cpustat_t. 2005-08-29 22:46:43 -07:00
head.h [SPARC64]: Add GET_GL_GLOBAL() macro for SUN4V. 2006-03-20 01:13:18 -08:00
hw_irq.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hypervisor.h [SPARC64]: Fix bugs in SUN4V cpu mondo dispatch. 2006-03-20 01:14:09 -08:00
ide.h [SPARC64]: Move DCACHE_ALIASING_POSSIBLE define to asm/page.h 2005-09-19 20:11:57 -07:00
idprom.h [SPARC]: Clean up idprom header files. 2006-03-20 01:12:08 -08:00
intr_queue.h [SPARC64]: Sun4v interrupt queue register definitions. 2006-03-20 01:11:44 -08:00
io.h [SPARC64]: Use 'unsigned long' for port argument to I/O string ops. 2005-08-31 15:01:33 -07:00
ioctl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ioctls.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iommu.h [SPARC64]: Fix streaming buffer flushing on PCI and SBUS. 2005-05-31 16:57:59 -07:00
ipc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipcbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irq.h [SPARC64]: Fix uniprocessor IRQ targetting on SUN4V. 2006-03-20 01:13:24 -08:00
isa.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
kdebug.h [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
kmap_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
kprobes.h [PATCH] kprobes: fix build breakage 2006-01-10 08:01:40 -08:00
linkage.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
local.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
lsu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mc146818rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mman.h [PATCH] add asm-generic/mman.h 2006-02-15 15:32:22 -08:00
mmu.h [SPARC64]: Add a secondary TSB for hugepage mappings. 2006-03-22 01:15:14 -08:00
mmu_context.h [SPARC64]: Add a secondary TSB for hugepage mappings. 2006-03-22 01:15:14 -08:00
module.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mostek.h [PATCH] mostek bogus sparse annotations fixed 2005-04-24 12:28:36 -07:00
msgbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
namei.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ns87303.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
numnodes.h [SPARC64]: Move over to sparsemem. 2006-03-20 01:14:22 -08:00
openprom.h [SPARC64]: Rewrite convoluted physical memory probing. 2005-09-29 17:58:26 -07:00
openpromio.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
oplib.h [SPARC64]: Fix system type in /proc/cpuinfo and remove bogus OBP check. 2006-03-20 01:14:25 -08:00
page.h [PATCH] unify pfn_to_page: generic functions 2006-03-27 08:44:44 -08:00
param.h [SPARC64]: Support CONFIG_HZ 2005-07-08 15:21:51 -07:00
parport.h [SPARC64]: Fix enable_dma() in asm-sparc64/parport.h 2005-07-06 15:41:54 -07:00
pbm.h [SPARC64]: More SUN4V PCI controller work. 2006-03-20 01:12:11 -08:00
pci.h [SPARC64]: Beginnings of SUN4V PCI controller support. 2006-03-20 01:12:10 -08:00
pconf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
percpu.h [PATCH] more for_each_cpu() conversions 2006-03-23 07:38:17 -08:00
perfctr.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pgalloc.h [SPARC64]: Kill pgtable quicklists and use SLAB. 2006-03-20 01:11:14 -08:00
pgtable.h [SPARC64]: Add a secondary TSB for hugepage mappings. 2006-03-22 01:15:14 -08:00
pil.h [SPARC64]: Fix new context version SMP handling. 2006-03-20 01:14:21 -08:00
poll.h [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
posix_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
processor.h [SPARC64]: Top-down address space allocation for 32-bit tasks. 2006-03-20 01:16:35 -08:00
psrcompat.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pstate.h [SPARC64]: Fixup TSTATE layout diagram in asm/pstate.h 2006-03-20 01:13:02 -08:00
ptrace.h [PATCH] consolidate sys_ptrace() 2005-11-07 07:53:42 -08:00
reg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
resource.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rwsem-const.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rwsem.h [PATCH] add sem_is_read/write_locked() 2005-10-29 21:40:35 -07:00
sbus.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scatterlist.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scratchpad.h [SPARC64]: Sun4v scratchpad register layout. 2006-03-20 01:11:44 -08:00
seccomp.h [SPARC64]: Add missing asm-sparc64/seccomp.h file. 2005-07-11 13:44:56 -07:00
sections.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
semaphore.h [PATCH] semaphore: Remove __MUTEX_INITIALIZER() 2005-10-30 17:37:27 -08:00
sembuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
setup.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sfafsr.h [SPARC64]: Revamp Spitfire error trap handling. 2005-08-29 12:45:11 -07:00
sfp-machine.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmparam.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sigcontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
siginfo.h [PATCH] consolidate SIGEV_PAD_SIZE 2005-05-01 08:59:08 -07:00
signal.h [SPARC64]: Add support for IRQ pre-handlers. 2005-07-04 13:24:38 -07:00
smp.h [SPARC64]: Add SMT scheduling support for Niagara. 2006-03-20 01:14:24 -08:00
socket.h [NET]: Introduce SO_{SND,RCV}BUFFORCE socket options 2005-08-29 15:31:35 -07:00
sockios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
solerrno.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sparsemem.h [SPARC64]: Move over to sparsemem. 2006-03-20 01:14:22 -08:00
spinlock.h [SPARC64]: Implement __raw_read_trylock() 2006-01-23 21:03:56 -08:00
spinlock_types.h [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
spitfire.h [SPARC64]: Add 'hypervisor' to ultra_tlb_type enumeration. 2006-03-20 01:11:39 -08:00
starfire.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
stat.h [PATCH] sparc64: Fix stat 2005-04-18 15:13:15 -07:00
statfs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
string.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sunbpp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
svr4.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
system.h [SPARC64]: Kill all %pstate changes in context switch code. 2006-03-20 01:11:49 -08:00
termbits.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
termios.h [SPARC]: remove duplicate TIOCPKT_ definitions 2005-11-07 14:10:42 -08:00
thread_info.h [SPARC64]: Correctable ECC errors cannot occur at trap level > 0. 2006-03-20 01:11:33 -08:00
timer.h [SPARC64]: Privatize sun5_timer. 2005-07-24 19:36:13 -07:00
timex.h [SPARC64]: Define ARCH_HAS_READ_CURRENT_TIMER. 2006-03-20 01:13:29 -08:00
tlb.h [SPARC64] mm: simpler tlb_flush_mmu 2005-11-07 14:12:08 -08:00
tlbflush.h [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
topology.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tsb.h [SPARC64]: Create a seperate kernel TSB for 4MB/256MB mappings. 2006-03-20 01:13:56 -08:00
ttable.h [SPARC64]: More TLB/TSB handling fixes. 2006-03-20 01:13:34 -08:00
types.h [PATCH] sab: consolidate kmem_bufctl_t 2005-09-05 00:05:48 -07:00
uaccess.h [SPARC64]: __bzero_noasi --> __clear_user 2006-03-20 01:13:28 -08:00
uctx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unaligned.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unistd.h [SPARC]: sys_newfstatat --> sys_fstatat64 2006-02-12 23:30:11 -08:00
upa.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
utrap.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vdev.h [SPARC64]: Decode virtual-devices interrupts correctly. 2006-03-20 01:13:05 -08:00
vga.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
visasm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
watchdog.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xor.h [SPARC64]: Niagara optimized XOR functions for RAID. 2006-03-20 01:14:03 -08:00