Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys



Module Name:    src
Committed By:   dyoung
Date:           Thu Apr  2 00:09:34 UTC 2009

Modified Files:
        src/sys/arch/i386/isa: npx_isa.c
        src/sys/arch/i386/pci: elan520.c
        src/sys/arch/x86/include: pic.h
        src/sys/arch/x86/pci: pcib.c
        src/sys/dev/ata: ata.c wd.c
        src/sys/dev/cardbus: cardbus.c cardslot.c if_atw_cardbus.c
        src/sys/dev/gpio: gpio.c
        src/sys/dev/isa: com_isa.c wdc_isa.c
        src/sys/dev/mii: nsphyter.c
        src/sys/dev/pci: if_sip.c pccbb.c pci.c ppb.c
        src/sys/dev/pcmcia: pcmcia.c
        src/sys/kern: kern_pmf.c subr_autoconf.c
        src/sys/sys: device.h pmf.h

Log Message:
During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks.  For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown.  Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags.  Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag.  The default for kern.detachall is 0.  SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress.  In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs.  Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/isa/npx_isa.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/pci/elan520.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/include/pic.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/pcib.c
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.370 -r1.371 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/cardbus/cardslot.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/cardbus/if_atw_cardbus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/gpio/gpio.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/isa/com_isa.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/isa/wdc_isa.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/nsphyter.c
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/if_sip.c
cvs rdiff -u -r1.184 -r1.185 src/sys/dev/pci/pccbb.c
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/pci/pci.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ppb.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/pcmcia/pcmcia.c
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/kern_pmf.c
cvs rdiff -u -r1.173 -r1.174 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.116 -r1.117 src/sys/sys/device.h
cvs rdiff -u -r1.14 -r1.15 src/sys/sys/pmf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Home | Main Index | Thread Index | Old Index