summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/machine/boot.c2
-rw-r--r--kern/turnstile.c6
-rw-r--r--kern/turnstile.h9
3 files changed, 16 insertions, 1 deletions
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c
index 6ad1552a..bc8b6522 100644
--- a/arch/x86/machine/boot.c
+++ b/arch/x86/machine/boot.c
@@ -59,6 +59,7 @@
#include <kern/sref.h>
#include <kern/syscnt.h>
#include <kern/thread.h>
+#include <kern/turnstile.h>
#include <machine/biosmem.h>
#include <machine/boot.h>
#include <machine/cga.h>
@@ -428,6 +429,7 @@ void __init
boot_main(void)
{
sleepq_bootstrap();
+ turnstile_bootstrap();
syscnt_setup();
percpu_bootstrap();
trap_setup();
diff --git a/kern/turnstile.c b/kern/turnstile.c
index 43629376..f5e94db5 100644
--- a/kern/turnstile.c
+++ b/kern/turnstile.c
@@ -500,14 +500,18 @@ turnstile_ctor(void *ptr)
}
void __init
-turnstile_setup(void)
+turnstile_bootstrap(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(turnstile_htable); i++) {
turnstile_bucket_init(&turnstile_htable[i]);
}
+}
+void __init
+turnstile_setup(void)
+{
kmem_cache_init(&turnstile_cache, "turnstile", sizeof(struct turnstile),
CPU_L1_SIZE, turnstile_ctor, 0);
}
diff --git a/kern/turnstile.h b/kern/turnstile.h
index 21a5a1a9..4bc8f74d 100644
--- a/kern/turnstile.h
+++ b/kern/turnstile.h
@@ -101,6 +101,15 @@ turnstile_td_get_turnstile(const struct turnstile_td *td)
void turnstile_td_propagate_priority(struct turnstile_td *td);
/*
+ * Early initialization of the turnstile module.
+ *
+ * This module is initialized by architecture-specific code. It should
+ * be one of the first modules to be initialized since it's used by
+ * synchronization objects that may be accessed very early.
+ */
+void turnstile_bootstrap(void);
+
+/*
* Initialize the turnstile module.
*/
void turnstile_setup(void);