aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_mountroot.c
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2017-12-31 09:23:52 +0000
committerColin Percival <cperciva@FreeBSD.org>2017-12-31 09:23:52 +0000
commit8b8a7c43a9ac39b9765c7ac3d4615ee5991c5126 (patch)
tree4cabe2cbac73cabccaa999b19e28622136eec9cc /sys/kern/vfs_mountroot.c
parent82614df42c3f81147eae28c8ca58961679f604c5 (diff)
downloadsrc-8b8a7c43a9ac39b9765c7ac3d4615ee5991c5126.tar.gz
src-8b8a7c43a9ac39b9765c7ac3d4615ee5991c5126.zip
Instrument "boot holds" for the benefit of the TSLOG framework. These
are places where the "main thread" of the booting kernel (either the thread which later becomes swapper or the thread which later becomes init) has to stop and wait for action to take place in another thread before continuing. There are currently three such holds: 1. The intr_config_hooks SYSINIT waits for hooks registered via the config_intrhook_establish function; this allows (typically) devices which need interrupts enabled to complete their initialization to do so before root is mounted. 2. The g_waitidle function waits for the GEOM event queue to be empty; this ensures that all of the disks which have been attached have been tasted before we attempt to mount root. 3. The vfs_mountroot_wait function (in addition to calling g_waitidle) waits for holds registered via root_mount_hold; among other things, this is used by the USB subsystem to ensure that we don't fail to mount root if it's located on a USB disk which takes a while to probe.
Notes
Notes: svn path=/head/; revision=327430
Diffstat (limited to 'sys/kern/vfs_mountroot.c')
-rw-r--r--sys/kern/vfs_mountroot.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index 89641b6dbb56..4b1a56ccddef 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -176,6 +176,7 @@ root_mount_hold(const char *identifier)
h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
h->who = identifier;
mtx_lock(&root_holds_mtx);
+ TSHOLD("root mount");
LIST_INSERT_HEAD(&root_holds, h, list);
mtx_unlock(&root_holds_mtx);
return (h);
@@ -190,6 +191,7 @@ root_mount_rel(struct root_hold_token *h)
mtx_lock(&root_holds_mtx);
LIST_REMOVE(h, list);
+ TSRELEASE("root mount");
wakeup(&root_holds);
mtx_unlock(&root_holds_mtx);
free(h, M_DEVBUF);
@@ -956,8 +958,10 @@ vfs_mountroot_wait(void)
printf(" %s", h->who);
printf("\n");
}
+ TSWAIT("root mount");
msleep(&root_holds, &root_holds_mtx, PZERO | PDROP, "roothold",
hz);
+ TSUNWAIT("root mount");
}
TSEXIT();