Declare ci_ipl volatile to prevent the compiler from optimizing
authorvisa <visa@openbsd.org>
Sat, 24 Feb 2018 11:42:30 +0000 (11:42 +0000)
committervisa <visa@openbsd.org>
Sat, 24 Feb 2018 11:42:30 +0000 (11:42 +0000)
commitcb5217fba3727742f326b0c20baed47113c0e1ef
tree7677698afd97f8b200bbc90cd3c42a7528790590
parenta85f610768c55340df893086b71b0a619400c25d
Declare ci_ipl volatile to prevent the compiler from optimizing
or reordering accesses to the variable. Assume that the assembler
preserves the correct sequence of instructions, which allows the
removal of the explicit noreorder/reorder toggles from the C code.

With ci_ipl being volatile, drop mips_sync() calls that follow
the accesses of the variable. The sync is redundant as a compiler
barrier. In addition, the MIPS64 CPU designs should not need the
sync for pipeline or write buffer control. According to miod@,
the use of the instruction is a carryover from code targeting
early MIPS designs that lack tight integration with the cache
and write buffer.

Discussed with and testing help from miod@.
Tested on CN5020, CN6120, CN7130, CN7360, Loongson 2F and 3A1000,
R4400, R8000, R10000 and R16000.
14 files changed:
sys/arch/loongson/dev/bonito.c
sys/arch/loongson/loongson/generic2e_machdep.c
sys/arch/loongson/loongson/isa_machdep.c
sys/arch/loongson/loongson/loongson3_intr.c
sys/arch/loongson/loongson/yeeloong_machdep.c
sys/arch/mips64/include/cpu.h
sys/arch/mips64/mips64/interrupt.c
sys/arch/octeon/dev/octcit.c
sys/arch/octeon/dev/octciu.c
sys/arch/sgi/localbus/int.c
sys/arch/sgi/localbus/macebus.c
sys/arch/sgi/sgi/intr_template.c
sys/arch/sgi/sgi/ip27_machdep.c
sys/arch/sgi/xbow/xheart.c