summaryrefslogtreecommitdiff
path: root/sys/arch/mips64
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-07-02 01:34:01 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-07-02 01:34:01 +0000
commit2277e32f451a4f2c2df9aa238a1ebc6e7d6e6993 (patch)
treeff697f8d41973078e583ab4e3ceabd929083ff04 /sys/arch/mips64
parent2ccfb985fa190982dc0c9985889c6cfb80d7268d (diff)
introduce srp, which according to the manpage i wrote is short for
"shared reference pointers". srp allows concurrent access to a data structure by multiple cpus while avoiding interlocking cpu opcodes. it manages its own reference counts and the garbage collection of those data structure to avoid use after frees. internally srp is a twisted version of hazard pointers, which are a relative of RCU. jmatthew wrote the bulk of a hazard pointer implementation and changed bpf to use it to allow mpsafe access to bpfilters. however, at s2k15 we were trying to apply it to other data structures but the memory overhead of every hazard pointer would have blown out significantly in several uses cases. a bulk of our time at s2k15 was spent reworking hazard pointers into srp. this diff adds the srp api and adds the necessary metadata to struct cpuinfo on our MP architectures. srp on uniprocessor platforms has alternate code that is optimised because it knows there'll be no concurrent access to data by multiple cpus. srp is made available to the system via param.h, so it should be available everywhere in the kernel. the docs likely need improvement cos im too close to the implementation. ok mpi@
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r--sys/arch/mips64/include/cpu.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index e3ad5627d97..b7596b51ff7 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.104 2015/02/11 07:05:39 dlg Exp $ */
+/* $OpenBSD: cpu.h,v 1.105 2015/07/02 01:33:59 dlg Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -154,6 +154,10 @@ struct cpu_info {
struct cpu_hwinfo
ci_hw;
+#if defined(MULTIPROCESSOR)
+ struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
+#endif
+
/* cache information and pending flush state */
uint ci_cacheconfiguration;
uint64_t ci_cachepending_l1i;