android_kernel_xiaomi_sm8350/drivers/scsi
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
..
aacraid [SCSI] aacraid: use kthread_ API 2006-02-27 22:55:14 -06:00
aic7xxx [SCSI] aic79xx: Avoid renegotiation on inquiry 2006-03-12 09:06:57 -06:00
aic7xxx_old
arm [PATCH] Remove MODULE_PARM 2006-03-25 08:22:52 -08:00
dpt
ibmvscsi [SCSI] ibmvscsi: handle re-enable firmware message 2006-01-26 08:10:08 -05:00
lpfc [PATCH] mempool: use common mempool kmalloc allocator 2006-03-26 08:56:59 -08:00
megaraid [PATCH] s/;;/;/g 2006-03-24 07:33:24 -08:00
pcmcia [SCSI] scsi: aha152x pcmcia driver needs spi transport 2006-03-05 08:00:47 -06:00
qla2xxx [PATCH] mempool: use mempool_create_slab_pool() 2006-03-26 08:57:00 -08:00
sym53c8xx_2 Merge ../linux-2.6 2006-03-14 14:18:01 -06:00
.gitignore gitignore: misc files 2006-01-01 22:21:50 +01:00
3w-9xxx.c [SCSI] 3ware 9000 add big endian support 2006-03-19 10:18:42 -06:00
3w-9xxx.h [SCSI] 3ware 9000 add big endian support 2006-03-19 10:18:42 -06:00
3w-xxxx.c [SCSI] sem2mutex 3w-[x9]xxx 2006-01-14 10:55:12 -06:00
3w-xxxx.h [SCSI] sem2mutex 3w-[x9]xxx 2006-01-14 10:55:12 -06:00
53c7xx_d.h_shipped
53c7xx_u.h_shipped
53c7xx.c [SCSI] Rename scsi_print_msg to spi_print_msg 2005-12-15 18:41:27 -08:00
53c7xx.h
53c7xx.scr
53c700_d.h_shipped
53c700.c [SCSI] Add spi_populate_*_msg functions 2006-02-27 22:55:09 -06:00
53c700.h [SCSI] 53c700: update endian processing macros 2005-12-16 09:51:01 -08:00
53c700.scr
a100u2w.c
a100u2w.h
a2091.c
a2091.h
a3000.c
a3000.h
advansys.c
advansys.h
aha152x.c Merge ../linux-2.6 2006-03-14 14:18:01 -06:00
aha152x.h [SCSI] aha152x: fix variable use before initialisation and other bugs 2006-02-28 11:20:45 -06:00
aha1542.c
aha1542.h
aha1740.c
aha1740.h
ahci.c [PATCH] ahci: add softreset 2006-03-22 19:56:53 -05:00
aic7xxx_old.c [PATCH] Unlinline a bunch of other functions 2006-01-14 18:27:06 -08:00
amiga7xx.c
amiga7xx.h
ata_piix.c [libata] export ata_dev_pair; trim trailing whitespace 2006-03-24 09:56:57 -05:00
atari_dma_emul.c
atari_NCR5380.c [SCSI] Rename scsi_print_msg to spi_print_msg 2005-12-15 18:41:27 -08:00
atari_scsi.c [PATCH] Remove MODULE_PARM 2006-03-25 08:22:52 -08:00
atari_scsi.h
atp870u.c
atp870u.h
blz1230.c [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
blz2060.c [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
BusLogic.c [SCSI] Pass proper device from BusLogic to SCSI layer 2006-01-12 15:26:13 -06:00
BusLogic.h
bvme6000.c
bvme6000.h
ch.c [SCSI] MODULE_ALIAS_{BLOCK,CHAR}DEV_MAJOR for drivers/scsi 2006-03-12 09:11:16 -06:00
constants.c [SCSI] Move scsi_print_msg to SPI class 2005-12-15 18:41:13 -08:00
cyberstorm.c [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
cyberstormII.c [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
dc395x.c [SCSI] dc395x: "fix" virt_addr calculation on AUTO_REQSENSE 2006-01-26 08:11:13 -05:00
dc395x.h
dec_esp.c
dmx3191d.c [SCSI] dmx3191d: fix a NULL pointer dereference 2006-03-12 09:45:56 -06:00
dpt_i2o.c [SCSI] I2O: move pci_request_regions() just behind pci_enable_device() 2006-01-14 10:54:54 -06:00
dpti.h
dtc.c
dtc.h
eata_generic.h
eata_pio.c
eata_pio.h
eata.c
esp.c [SCSI] esp: fix eh locking 2006-02-22 14:35:52 -08:00
esp.h
fastlane.c [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
fcal.c
fcal.h
fd_mcs.c
fdomain.c
fdomain.h
FlashPoint.c [SCSI] drivers/scsi/FlashPoint.c: don't use parenthesis with "return" 2006-03-12 09:18:47 -06:00
g_NCR5380_mmio.c
g_NCR5380.c [PATCH] remove ISA legacy functions: drivers/scsi/g_NCR5380.c 2006-03-24 07:33:19 -08:00
g_NCR5380.h [PATCH] remove ISA legacy functions: drivers/scsi/g_NCR5380.c 2006-03-24 07:33:19 -08:00
gdth_ioctl.h
gdth_kcompat.h
gdth_proc.c
gdth_proc.h
gdth.c [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
gdth.h
gvp11.c
gvp11.h
hosts.c [SCSI] SCSI core kmalloc2kzalloc 2006-02-27 22:55:02 -06:00
hosts.h
ibmmca.c [SCSI] ibmmca: fix a NULL pointer dereference 2006-03-12 09:46:11 -06:00
ibmmca.h
ide-scsi.c [PATCH] sem2mutex: drivers/scsi/ide-scsi.c 2006-03-23 07:38:10 -08:00
imm.c
imm.h
in2000.c [PATCH] remove ISA legacy functions: drivers/scsi/in2000.c 2006-03-24 07:33:19 -08:00
in2000.h
initio.c
initio.h
ipr.c [SCSI] PCI Error Recovery: IPR SCSI device driver 2006-02-27 22:55:05 -06:00
ipr.h [SCSI] ipr: Fix adapter initialization failure 2006-02-12 11:05:44 -06:00
ips.c [SCSI] don't call ips_eh_reset in ips_queue to avoid deadlock 2006-02-27 23:32:39 -06:00
ips.h
iscsi_tcp.c [PATCH] mempool: use mempool_create_slab_pool() 2006-03-26 08:57:00 -08:00
iscsi_tcp.h [SCSI] iscsi update: rm conn lock 2006-02-04 16:19:08 -06:00
jazz_esp.c Merge ../linux-2.6 2006-03-14 14:18:01 -06:00
Kconfig [libata] sata_vsc: fix inconsistent NULL checking 2006-03-21 22:07:13 -05:00
lasi700.c
libata-bmdma.c [libata] export ata_dev_pair; trim trailing whitespace 2006-03-24 09:56:57 -05:00
libata-core.c [PATCH] libata: Remove dependence on host_set->dev for SAS 2006-03-24 10:18:43 -05:00
libata-scsi.c [PATCH] libata: ata_scsi_ioctl cleanup 2006-03-24 10:18:43 -05:00
libata.h [SCSI] libata: implement minimal transport template for ->eh_timed_out 2006-03-21 13:07:05 -06:00
mac53c94.c [PATCH] drivers/scsi/mac53c94.c __iomem annotations 2006-02-07 20:57:14 -05:00
mac53c94.h
mac_esp.c
mac_scsi.c
mac_scsi.h
Makefile scsi: link in the debug driver last 2006-03-22 17:39:38 -08:00
mca_53c9x.c
megaraid.c [SCSI] megaraid_legacy: kobject_register failure 2006-02-12 11:11:09 -06:00
megaraid.h [SCSI] megaraid_legacy: kobject_register failure 2006-02-12 11:11:09 -06:00
mesh.c [PATCH] powerpc: Remove device_node addrs/n_addr 2006-01-09 14:53:55 +11:00
mesh.h
mvme16x.c
mvme16x.h
mvme147.c
mvme147.h
ncr53c8xx.c [SCSI] Add spi_populate_*_msg functions 2006-02-27 22:55:09 -06:00
ncr53c8xx.h [SCSI] ncr53c8xx update 2006-02-27 22:55:08 -06:00
NCR53c406a.c
NCR53C9x.c [PATCH] m68k: fix PIO case in esp 2006-01-12 09:09:05 -08:00
NCR53C9x.h
NCR5380.c [SCSI] Rename scsi_print_msg to spi_print_msg 2005-12-15 18:41:27 -08:00
NCR5380.h
NCR_D700.c [SCSI] NCR_D700: fix a NULL dereference 2006-03-12 09:45:43 -06:00
NCR_D700.h
NCR_Q720.c
NCR_Q720.h
nsp32_debug.c
nsp32_io.h
nsp32.c
nsp32.h
oktagon_esp.c [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
oktagon_io.S
osst_detect.h
osst_options.h
osst.c [SCSI] MODULE_ALIAS_{BLOCK,CHAR}DEV_MAJOR for drivers/scsi 2006-03-12 09:11:16 -06:00
osst.h [SCSI] osst: changes required to move forward to block request 2006-03-07 09:16:01 -06:00
pas16.c
pas16.h
pci2000.h
pdc_adma.c Merge branch 'master' 2006-03-22 19:13:54 -05:00
pluto.c
pluto.h
ppa.c
ppa.h
psi240i.c
psi240i.h
psi_chip.h
ql1040_fw.h
ql1280_fw.h
ql12160_fw.h
qla1280.c [SCSI] qla1280: remove < 2.6.0 support 2006-01-26 08:08:26 -05:00
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
qlogicfc_asm.c
qlogicfc.c
qlogicpti_asm.c
qlogicpti.c
qlogicpti.h
raid_class.c [SCSI] raid_class.c - adding RAID10 and RAID10 defines 2006-01-12 11:35:15 -06:00
sata_mv.c Merge branch 'master' 2006-03-22 19:13:54 -05:00
sata_nv.c [libata sata_nv] eliminate duplicate codepaths with iomap 2006-03-22 23:59:46 -05:00
sata_promise.c [SCSI] libata: implement minimal transport template for ->eh_timed_out 2006-03-21 13:07:05 -06:00
sata_promise.h
sata_qstor.c [SCSI] libata: implement minimal transport template for ->eh_timed_out 2006-03-21 13:07:05 -06:00
sata_sil24.c [libata] export ata_dev_pair; trim trailing whitespace 2006-03-24 09:56:57 -05:00
sata_sil.c [PATCH] libata: make per-dev transfer mode limits per-dev 2006-03-24 09:28:33 -05:00
sata_sis.c [SCSI] libata: implement minimal transport template for ->eh_timed_out 2006-03-21 13:07:05 -06:00
sata_svw.c Merge branch 'master' 2006-03-22 19:13:54 -05:00
sata_sx4.c [SCSI] libata: implement minimal transport template for ->eh_timed_out 2006-03-21 13:07:05 -06:00
sata_uli.c [libata sata_uli] kill scr_addr abuse 2006-03-23 00:14:36 -05:00
sata_via.c [SCSI] libata: implement minimal transport template for ->eh_timed_out 2006-03-21 13:07:05 -06:00
sata_vsc.c [libata] export ata_dev_pair; trim trailing whitespace 2006-03-24 09:56:57 -05:00
script_asm.pl
scsi_debug.c [SCSI] SCSI core kmalloc2kzalloc 2006-02-27 22:55:02 -06:00
scsi_debug.h
scsi_devinfo.c [SCSI] Add Brownie to blacklist 2006-03-02 22:44:06 -06:00
scsi_error.c Merge ../linux-2.6 2006-03-21 13:05:45 -06:00
scsi_ioctl.c [SCSI] SCSI core kmalloc2kzalloc 2006-02-27 22:55:02 -06:00
scsi_lib.c [PATCH] mempool: use mempool_create_slab_pool() 2006-03-26 08:57:00 -08:00
scsi_logging.h
scsi_module.c
scsi_priv.h [SCSI] remove target parent limitiation 2006-01-14 10:55:05 -06:00
scsi_proc.c [SCSI] remove target parent limitiation 2006-01-14 10:55:05 -06:00
scsi_scan.c [SCSI] scsi: move target_destroy call 2006-03-14 14:36:00 -06:00
scsi_sysctl.c
scsi_sysfs.c [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE. 2006-03-24 09:51:36 -05:00
scsi_transport_fc.c Merge ../linux-2.6 2006-03-21 13:05:45 -06:00
scsi_transport_iscsi.c [SCSI] SCSI core kmalloc2kzalloc 2006-02-27 22:55:02 -06:00
scsi_transport_sas.c [SCSI] eliminate rphy allocation in favour of expander/end device allocation 2006-03-19 10:21:16 -06:00
scsi_transport_spi.c [SCSI] fix minor problem in spi transport message functions 2006-03-12 09:54:19 -06:00
scsi_typedefs.h
scsi.c [SCSI] Remove devfs support from the SCSI subsystem 2006-02-27 22:55:04 -06:00
scsi.h
scsicam.c
sd.c [PATCH] git-scsi-misc: min() warning fix 2006-03-25 08:23:02 -08:00
seagate.c
seagate.h
sg.c Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2006-03-22 10:47:24 -08:00
sgiwd93.c [SCSI] Make sgiwd93_detect and sgiwd93_detect static. 2006-03-12 09:24:55 -06:00
sim710.c [SCSI] sim710: fix a NULL pointer dereference 2006-03-12 09:46:23 -06:00
sr_ioctl.c [PATCH] kill cdrom ->dev_ioctl method 2006-03-23 07:38:09 -08:00
sr_vendor.c [SCSI] Missing const in sr_vendor 2005-12-17 10:50:23 -06:00
sr.c [PATCH] kill cdrom ->dev_ioctl method 2006-03-23 07:38:09 -08:00
sr.h [PATCH] kill cdrom ->dev_ioctl method 2006-03-23 07:38:09 -08:00
st_options.h
st.c [SCSI] MODULE_ALIAS_{BLOCK,CHAR}DEV_MAJOR for drivers/scsi 2006-03-12 09:11:16 -06:00
st.h [SCSI] convert st to use scsi_execute_async 2005-12-14 19:16:31 -08:00
sun3_NCR5380.c [SCSI] Rename scsi_print_msg to spi_print_msg 2005-12-15 18:41:27 -08:00
sun3_scsi_vme.c
sun3_scsi.c
sun3_scsi.h
sun3x_esp.c
sym53c416.c
sym53c416.h
t128.c
t128.h
tmscsim.c
tmscsim.h
u14-34f.c
ultrastor.c
ultrastor.h
wd33c93.c [SCSI] wd33c93: Fix missing prototypes by including <linux/interrupt.h>. 2006-03-12 08:48:26 -06:00
wd33c93.h
wd7000.c
zalon.c