Add a garbage RCU implementation
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 1 Mar 2018 02:10:35 +0000 (21:10 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 30 Apr 2018 18:29:22 +0000 (14:29 -0400)
It's a placeholder for now while I build the tree_file code.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/rcu.h [new file with mode: 0644]

diff --git a/kern/include/rcu.h b/kern/include/rcu.h
new file mode 100644 (file)
index 0000000..cbd7c8b
--- /dev/null
@@ -0,0 +1,36 @@
+/* Copyright (c) 2018 Google Inc
+ * Barret Rhoden <brho@cs.berkeley.edu>
+ * See LICENSE for details.
+ *
+ * Junk, racy implementation of RCU
+ */
+
+#pragma once
+
+#include <trap.h>
+
+struct rcu_head {
+};
+
+static void __call_rcu_kmsg(uint32_t srcid, long a0, long a1, long a2)
+{
+       void (*f)(struct rcu_head *) = (void*)a0;
+
+       f((void*)a1);
+}
+
+static void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *head))
+{
+       send_kernel_message(core_id(), __call_rcu_kmsg, (long)func, (long)head, 0,
+                           KMSG_ROUTINE);
+}
+
+#define hlist_for_each_entry_rcu hlist_for_each_entry
+#define hlist_add_head_rcu hlist_add_head
+#define hlist_del_rcu hlist_del
+
+#define rcu_read_lock()
+#define rcu_read_unlock()
+#define synchronize_rcu()
+#define rcu_dereference(x) (x)
+#define rcu_barrier() kthread_usleep(10000)