Index: sys/arm/at91/at91_rst.c =================================================================== --- sys/arm/at91/at91_rst.c +++ sys/arm/at91/at91_rst.c @@ -124,7 +124,7 @@ at91_rst_sc = sc = device_get_softc(dev); sc->sc_dev = dev; - callout_init(&sc->tick_ch, 0); + callout_init(&sc->tick_ch, 1); rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, Index: sys/dev/syscons/syscons.c =================================================================== --- sys/dev/syscons/syscons.c +++ sys/dev/syscons/syscons.c @@ -3858,22 +3858,28 @@ case RBT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(0); + } #endif break; case HALT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(RB_HALT); + } #endif break; case PDWN: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(RB_HALT|RB_POWEROFF); + } #endif break; Index: sys/kern/init_main.c =================================================================== --- sys/kern/init_main.c +++ sys/kern/init_main.c @@ -703,10 +703,6 @@ struct thread *td; struct proc *p; - mtx_lock(&Giant); - - GIANT_REQUIRED; - TSENTER(); /* Here so we don't overlap with mi_startup. */ td = curthread; @@ -801,7 +797,6 @@ * to user mode as init! */ if ((error = sys_execve(td, &args)) == EJUSTRETURN) { - mtx_unlock(&Giant); TSEXIT(); return; } Index: sys/kern/kern_shutdown.c =================================================================== --- sys/kern/kern_shutdown.c +++ sys/kern/kern_shutdown.c @@ -268,13 +268,10 @@ if (error == 0) error = priv_check(td, PRIV_REBOOT); if (error == 0) { - if (uap->opt & RB_REROOT) { + if (uap->opt & RB_REROOT) error = kern_reroot(); - } else { - mtx_lock(&Giant); + else kern_reboot(uap->opt); - mtx_unlock(&Giant); - } } return (error); } Index: sys/kern/vfs_bio.c =================================================================== --- sys/kern/vfs_bio.c +++ sys/kern/vfs_bio.c @@ -1240,25 +1240,20 @@ #ifdef PREEMPTION /* - * Drop Giant and spin for a while to allow - * interrupt threads to run. + * Spin for a while to allow interrupt threads to run. */ - DROP_GIANT(); DELAY(50000 * iter); - PICKUP_GIANT(); #else /* - * Drop Giant and context switch several times to - * allow interrupt threads to run. + * Context switch several times to allow interrupt + * threads to run. */ - DROP_GIANT(); for (subiter = 0; subiter < 50 * iter; subiter++) { thread_lock(curthread); mi_switch(SW_VOL, NULL); thread_unlock(curthread); DELAY(1000); } - PICKUP_GIANT(); #endif } printf("\n"); Index: sys/kern/vfs_mountroot.c =================================================================== --- sys/kern/vfs_mountroot.c +++ sys/kern/vfs_mountroot.c @@ -579,9 +579,7 @@ if (root_mount_mddev != -1) { mdio->md_unit = root_mount_mddev; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); - PICKUP_GIANT(); /* Ignore errors. We don't care. */ root_mount_mddev = -1; } @@ -590,9 +588,7 @@ mdio->md_options = MD_AUTOUNIT | MD_READONLY; mdio->md_mediasize = sb.st_size; mdio->md_unit = 0; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio); - PICKUP_GIANT(); if (error) goto out; @@ -601,9 +597,7 @@ mdio->md_file = NULL; mdio->md_options = 0; mdio->md_mediasize = 0; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); - PICKUP_GIANT(); /* Ignore errors. We don't care. */ error = ERANGE; goto out; @@ -960,9 +954,7 @@ curfail = 0; while (1) { - DROP_GIANT(); g_waitidle(); - PICKUP_GIANT(); mtx_lock(&root_holds_mtx); if (LIST_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); @@ -1004,9 +996,7 @@ * Note that we must wait for GEOM to finish reconfiguring itself, * eg for geom_part(4) to finish tasting. */ - DROP_GIANT(); g_waitidle(); - PICKUP_GIANT(); if (parse_mount_dev_present(dev)) return (0); @@ -1038,6 +1028,8 @@ time_t timebase; int error; + mtx_assert(&Giant, MA_NOTOWNED); + TSENTER(); td = curthread; Index: sys/sparc64/pci/psycho.c =================================================================== --- sys/sparc64/pci/psycho.c +++ sys/sparc64/pci/psycho.c @@ -664,7 +664,7 @@ INTVEC(PSYCHO_READ8(sc, intrmap)) != vec || intr_vectors[vec].iv_ic != &psycho_ic || bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], - INTR_TYPE_MISC | INTR_BRIDGE, filt, intr, sc, + INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, filt, intr, sc, &sc->sc_ihand[index]) != 0) panic("%s: failed to set up interrupt %d", __func__, index); } Index: sys/sparc64/sbus/sbus.c =================================================================== --- sys/sparc64/sbus/sbus.c +++ sys/sparc64/sbus/sbus.c @@ -411,7 +411,7 @@ INTIGN(vec = rman_get_start(sc->sc_ot_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE, + bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0) panic("%s: failed to set up temperature interrupt", __func__); i = 3; @@ -421,7 +421,7 @@ INTIGN(vec = rman_get_start(sc->sc_pf_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE, + bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0) panic("%s: failed to set up power fail interrupt", __func__);