diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-07-02 01:34:01 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-07-02 01:34:01 +0000 |
commit | 2277e32f451a4f2c2df9aa238a1ebc6e7d6e6993 (patch) | |
tree | ff697f8d41973078e583ab4e3ceabd929083ff04 /sys/arch/m88k | |
parent | 2ccfb985fa190982dc0c9985889c6cfb80d7268d (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/m88k')
-rw-r--r-- | sys/arch/m88k/include/cpu.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h index 247f5f31b29..7b1c28d7901 100644 --- a/sys/arch/m88k/include/cpu.h +++ b/sys/arch/m88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.63 2015/02/11 07:05:39 dlg Exp $ */ +/* $OpenBSD: cpu.h,v 1.64 2015/07/02 01:33:59 dlg Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -96,6 +96,10 @@ struct cpu_info { u_int ci_cpuid; /* cpu number */ +#if defined(MULTIPROCESSOR) + struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; +#endif + /* * Function pointers used within mplock to ensure * non-interruptability. |