linux-stable/include/asm-x86_64
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
..
8253pit.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
a.out.h [PATCH] x86_64: TASK_SIZE fixes for compatibility mode processes 2005-06-21 18:46:12 -07:00
acpi.h Revert "[PATCH] x86_64: Only do the clustered systems have unsynchronized TSC assumption on IBM systems" 2006-02-27 20:41:56 -08:00
agp.h [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
apic.h [PATCH] x86_64: Allow to run main time keeping from the local APIC interrupt 2006-02-04 16:43:13 -08:00
apicdef.h [PATCH] x86_64: timer interrupt lockup due to pending interrupt 2006-03-25 09:10:57 -08:00
atomic.h [PATCH] atomic: add_unless cmpxchg optimise 2006-03-23 07:38:17 -08:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bitops.h [PATCH] bitops: x86_64: use generic bitops 2006-03-26 08:57:14 -08:00
boot.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bootsetup.h [PATCH] Increase number of e820 entries hard limit from 32 to 128 2005-05-01 08:58:51 -07:00
bug.h [PATCH] x86-64: reduce x86-64 bug frame by 4 bytes 2005-09-12 10:50:58 -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 [PATCH] x86/x86_64: mark rodata section read-only: x86-64 support 2006-01-06 08:33:36 -08:00
calling.h [PATCH] x86-64: Fix CFI information 2005-09-12 10:50:56 -07:00
checksum.h [NET]: Fix ipl=>ihl typo in ip_fast_csum 2005-08-29 16:02:48 -07:00
compat.h [PATCH] amd64: task_pt_regs() 2006-01-12 09:08:51 -08:00
cpu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpufeature.h [PATCH] x86_64: Undo the earlier changes to remove unrolled copy/memset functions 2006-02-04 16:43:13 -08:00
cputime.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
current.h kbuild: alpha,x86_64 use generic asm-offsets.h support 2005-09-09 21:28:48 +02:00
debugreg.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
desc.h [PATCH] x86_64: Align and pad x86_64 GDT on page boundary 2006-01-11 19:04:53 -08:00
div64.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma-mapping.h [PATCH] x86_64: Use function pointers to call DMA mapping functions 2006-01-11 19:04:55 -08:00
dma.h [PATCH] x86_64: Add 4GB DMA32 zone 2005-11-14 19:55:13 -08:00
dmi.h [PATCH] x86_64: Implement early DMI scanning 2006-03-25 09:10:55 -08:00
dwarf2.h [PATCH] x86_64: Separate CONFIG_UNWIND_INFO from CONFIG_DEBUG_INFO 2006-01-11 19:01:10 -08:00
e820.h [PATCH] kdump: x86_64: add memmmap command line option 2006-01-10 08:01:27 -08:00
edac.h [PATCH] EDAC: core EDAC support code 2006-01-18 19:20:31 -08:00
elf.h [PATCH] x86_64: Increase the variability of the process stack on 64bit architectures 2006-03-25 09:10:52 -08:00
emergency-restart.h [PATCH] x86_64: Implemenent machine_emergency_restart 2005-07-26 14:35:42 -07:00
errno.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
fixmap.h [PATCH] mark several functions __always_inline 2006-01-14 18:27:15 -08:00
floppy.h [PATCH] x86_64: Don't invoke OOM killer while allocating floppy DMA buffers 2006-03-25 09:10:55 -08:00
fpu32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
futex.h [PATCH] lightweight robust futexes updates 2006-03-27 08:44:49 -08:00
gart-mapping.h [PATCH] x86_64: Use function pointers to call DMA mapping functions 2006-01-11 19:04:55 -08:00
genapic.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hardirq.h [PATCH] i386/x86-64: Don't ack the APIC for bad interrupts when the APIC is not enabled 2006-02-04 16:43:15 -08:00
hpet.h [PATCH] x86-64: Fix HPET timer on x460 2006-02-11 21:41:11 -08:00
hw_irq.h [PATCH] x86_64: Remove useless KDB vector 2006-01-11 19:05:00 -08:00
i387.h [PATCH] amd64: task_thread_info() 2006-01-12 09:08:51 -08:00
ia32.h [PATCH] x86_64: Flexmap for 32bit and randomized mappings for 64bit 2006-01-16 23:18:35 -08:00
ia32_unistd.h [PATCH] fstatat64 support 2006-02-11 21:41:10 -08:00
ide.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
idle.h [PATCH] x86_64: Add idle notifiers 2006-01-11 19:04:55 -08:00
io.h [PATCH] x86_64: Remove CONFIG_UNORDERED_IO 2006-03-25 09:14:38 -08:00
io_apic.h [ACPI] delete CONFIG_ACPI_BOOT 2005-08-24 12:08:54 -04:00
ioctl.h [PATCH] Generic ioctl.h 2006-01-10 08:01:34 -08:00
ioctls.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
ipi.h [PATCH] x86_64: Remove useless KDB vector 2006-01-11 19:05:00 -08:00
irq.h [PATCH] x86_64: Increase NR_IRQ_VECTORS to 32 * NR_CPUS 2006-01-16 11:27:59 -08:00
kdebug.h [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
kexec.h [PATCH] Compilation of kexec/kdump broken 2006-02-03 08:32:09 -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
ldt.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
linkage.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
local.h [PATCH] x86_64: Make local_t 64bit instead of 32bit 2006-03-25 09:14:38 -08:00
mach_apic.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
mce.h [PATCH] x86_64: Support for AMD specific MCE Threshold. 2005-11-14 19:55:13 -08:00
mman.h [PATCH] add asm-generic/mman.h 2006-02-15 15:32:22 -08:00
mmsegment.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmu_context.h [PATCH] x86_64: {set,clear,test}_bit() related cleanup and pci_mmcfg_init() fix 2006-03-24 07:33:15 -08:00
mmx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmzone.h [PATCH] unify pfn_to_page: x86_64 pfn_to_page 2006-03-27 08:44:44 -08:00
module.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mpspec.h Pull pnpacpi into acpica branch 2006-01-07 03:50:18 -05:00
msgbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msi.h [PATCH] PCI: Change MSI to use physical delivery mode always 2005-11-10 16:09:18 -08:00
msr.h [PATCH] Fix x86_64/msr.h interface to agree with i386/msr.h 2005-11-20 11:52:59 -08:00
mtrr.h [PATCH] Clean up mtrr compat ioctl code 2005-10-30 17:37:13 -08:00
mutex.h Fix mutex_trylock() copy-and-paste bug (x86, x86-64, generic mutex-dec.h) 2006-01-11 15:50:47 -08:00
namei.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nmi.h [PATCH] x86_64: Collected NMI watchdog fixes. 2005-05-17 07:59:16 -07:00
node.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
numa.h [PATCH] x86_64: Rename struct node in x86-64 NUMA code to struct bootnode 2006-03-25 09:10:52 -08:00
numnodes.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
page.h [PATCH] unify pfn_to_page: x86_64 pfn_to_page 2006-03-27 08:44:44 -08:00
param.h [PATCH] Avoid namespace pollution in <asm/param.h> 2006-01-02 08:38:38 -08:00
parport.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci-direct.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci.h [PATCH] x86_64: no_iommu removal in pci-gart.c 2006-02-26 09:53:29 -08:00
pda.h [PATCH] x86_64: Reorder one field of the PDA to reduce padding 2006-03-25 09:10:56 -08:00
percpu.h [PATCH] more for_each_cpu() conversions 2006-03-23 07:38:17 -08:00
pgalloc.h [PATCH] x86_64: actively synchronize vmalloc area when registering certain callbacks 2006-03-25 09:10:53 -08:00
pgtable.h [PATCH] x86_64: actively synchronize vmalloc area when registering certain callbacks 2006-03-25 09:10:53 -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
prctl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
processor.h [PATCH] sched: new sched domain for representing multi-core 2006-03-27 08:44:43 -08:00
proto.h [PATCH] x86_64: Removed duplicated declaration of force_iommu 2006-03-25 09:14:39 -08:00
ptrace.h [PATCH] xen: x86: Rename usermode macro 2005-06-23 09:45:14 -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
rwlock.h [PATCH] Fix typo in x86_64 __build_write_lock_const assembly 2005-12-24 12:30:22 -08:00
scatterlist.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
seccomp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sections.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
segment.h [PATCH] x86_64: Remove unused segments 2006-01-11 19:05:01 -08: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
serial.h [PATCH] Serial: Split 8250 port table (part 2) 2005-06-29 18:45:19 +01:00
setup.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
sigcontext32.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 [PATCH] Replace extern inline with static inline in asm-x86_64/* 2005-09-12 10:50:56 -07:00
smp.h [PATCH] sched: new sched domain for representing multi-core 2006-03-27 08:44:43 -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
sparsemem.h [PATCH] add x86-64 specific support for sparsemem 2005-06-23 09:45:07 -07:00
spinlock.h [PATCH] x86_64: Use int operations in spinlocks to support more than 128 CPUs spinning. 2005-11-14 19:55:15 -08:00
spinlock_types.h [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
stat.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
statfs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
string.h [PATCH] x86_64: Don't define string functions to builtin 2006-03-25 09:10:53 -08:00
suspend.h [PATCH] x86_64: eliminate set_debug() 2006-03-25 09:10:52 -08:00
swiotlb.h [PATCH] x86_64: Use function pointers to call DMA mapping functions 2006-01-11 19:04:55 -08:00
system.h [PATCH] x86_64: eliminate set_debug() 2006-03-25 09:10:52 -08:00
termbits.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
termios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
thread_info.h [PATCH] death of get_thread_info/put_thread_info 2006-01-12 09:08:59 -08:00
timex.h [PATCH] x86_64: On Intel CPUs don't do an additional CPU sync before RDTSC 2006-01-11 19:04:58 -08:00
tlb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tlbflush.h [PATCH] x86-64: Increase TLB flush array size 2005-09-12 10:49:58 -07:00
topology.h [PATCH] sched: new sched domain for representing multi-core 2006-03-27 08:44:43 -08:00
types.h [PATCH] sab: consolidate kmem_bufctl_t 2005-09-05 00:05:48 -07:00
uaccess.h [PATCH] mark several functions __always_inline 2006-01-14 18:27:15 -08:00
ucontext.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 [PATCH] lightweight robust futexes: x86_64 2006-03-27 08:44:49 -08:00
user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
user32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vga.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vsyscall.h [PATCH] x86_64: sparse warning cleanups 2006-01-11 19:05:02 -08:00
vsyscall32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xor.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00