summaryrefslogtreecommitdiff
path: root/kern/llsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/llsync.c')
-rw-r--r--kern/llsync.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/kern/llsync.c b/kern/llsync.c
index 1942576d..c432fc68 100644
--- a/kern/llsync.c
+++ b/kern/llsync.c
@@ -32,24 +32,24 @@
* TODO Gracefully handle large amounts of deferred works.
*/
+#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
-#include <stdio.h>
-#include <kern/assert.h>
#include <kern/condition.h>
#include <kern/cpumap.h>
#include <kern/init.h>
#include <kern/list.h>
+#include <kern/log.h>
#include <kern/llsync.h>
#include <kern/llsync_i.h>
#include <kern/macros.h>
#include <kern/mutex.h>
-#include <kern/param.h>
#include <kern/percpu.h>
#include <kern/spinlock.h>
#include <kern/syscnt.h>
#include <kern/work.h>
+#include <kern/thread.h>
#include <machine/cpu.h>
/*
@@ -82,7 +82,7 @@ llsync_ready(void)
return llsync_is_ready;
}
-void __init
+static int __init
llsync_setup(void)
{
struct llsync_cpu_data *cpu_data;
@@ -104,9 +104,18 @@ llsync_setup(void)
work_queue_init(&cpu_data->queue0);
}
- llsync_is_ready = true;
+ return 0;
}
+INIT_OP_DEFINE(llsync_setup,
+ INIT_OP_DEP(log_setup, true),
+ INIT_OP_DEP(mutex_setup, true),
+ INIT_OP_DEP(percpu_setup, true),
+ INIT_OP_DEP(spinlock_setup, true),
+ INIT_OP_DEP(syscnt_setup, true),
+ INIT_OP_DEP(thread_bootstrap, true),
+ INIT_OP_DEP(work_setup, true));
+
static void
llsync_process_global_checkpoint(void)
{
@@ -122,7 +131,7 @@ llsync_process_global_checkpoint(void)
/* TODO Handle hysteresis */
if (!llsync_data.no_warning && (nr_works >= LLSYNC_NR_PENDING_WORKS_WARN)) {
llsync_data.no_warning = 1;
- printf("llsync: warning: large number of pending works\n");
+ log_warning("llsync: large number of pending works\n");
}
if (llsync_data.nr_registered_cpus == 0) {
@@ -182,6 +191,10 @@ llsync_register(void)
unsigned long flags;
unsigned int cpu;
+ if (!llsync_is_ready) {
+ llsync_is_ready = true;
+ }
+
cpu = cpu_id();
cpu_data = llsync_get_cpu_data();