compiler.h: add READ_ONCE/WRITE_ONCE macro

These macros are needed to make sure the compiler does not optimize away
atomic constructs such as "while (!READ_ONCE(foo))" loops that do not
modify foo within the loop

Also move the barrier() define where it belongs while we are here, it is
needed for READ_ONCE/WRITE_ONCE and including ihk/cpu.h here causes
include loops

Change-Id: Ia533a849ed674719ccbc0495be47d22a3c47b8f8
This commit is contained in:
Dominique Martinet
2018-09-21 12:30:52 +09:00
committed by Masamichi Takagi
parent 13e71ac9dc
commit 3e3ccf377c
6 changed files with 65 additions and 13 deletions

View File

@ -25,8 +25,6 @@ void cpu_safe_halt(void);
void cpu_restore_interrupt(unsigned long);
void cpu_pause(void);
#define barrier() arch_barrier()
unsigned long cpu_disable_interrupt_save(void);
struct ihk_mc_interrupt_handler {